【发布时间】:2015-10-05 21:00:45
【问题描述】:
(对不起我的英语)
我正在尝试使用 TextureView 显示视频,但我需要知道是否有一种方法可以在不停止音频播放的情况下隐藏视频。
我正在这样做:
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mySurface = new Surface(surface);
if(MyService.mMediaPlayer != null) MyService.mMediaPlayer.setSurface(mySurface);
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
if(MyService.mMediaPlayer != null) MyService.mMediaPlayer.setSurface(null);
return false;
}
您可以看到我正在尝试使用 setSurface(null),但是当我尝试此操作时音频不会保留。
编辑: 我的主要活动中有一个按钮(“显示视频”);此按钮启动我放置上述代码的第二个活动。
我需要在按下返回按钮或主页按钮时继续播放音频
【问题讨论】: