在 logcat 中抑制/混淆 URL
我想在我的应用程序中隐藏/模糊视频视图的 URL。目前,当视频活动在设备上运行时,URL 将显示在 logcat 中。我想尽可能隐藏 URL。有什么办法可以抑制这个输出到 logcat 吗?
以下是违规活动:
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setMediaController(new MediaController(this));
Bundle b = this.getIntent().getExtras();
path = b.getString("path");
mVideoView.setVideoURI(Uri.parse(path));
I would like to hide/obscure a URL for a videoview in my application. CUrrently, the URL is displayed in the logcat when the videoactivity runs on the device. I would like to hide the URL as much as possible. Is there any way to suppress this output to the logcat?
Here is the offending activity:
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setMediaController(new MediaController(this));
Bundle b = this.getIntent().getExtras();
path = b.getString("path");
mVideoView.setVideoURI(Uri.parse(path));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,可能有一个解决方案:
如果您查看
VideoView
的源代码,您会发现它调用MediaPlayer.setDataSource(..)
,依次调用URI.getScheme()
和URI.getPath()
。Sooo,您可以通过子类化 URI 并覆盖 Log 使用的
toString()
来解决您的问题。让它返回一些描述性信息(媒体名称?),但不返回媒体的 URL。Hmm, there could be a solution:
If you take a look at the source of
VideoView
, you'll see that it callsMediaPlayer.setDataSource(..)
, which in turn callsURI.getScheme()
andURI.getPath()
.Sooo, you might get around your problem by subclassing URI and overriding
toString()
which is used by Log. Make it return some descriptive info (media name?) but not the URL to media.