Ijkplayer: Android 暂停状态进入后台,再进前台会黑屏。

Created on 10 Feb 2017  ·  25Comments  ·  Source: bilibili/ijkplayer

请问这个有解决办法不?
用的是SurfaceView播放的。

Most helpful comment

TextureMediaPlayer + TextureView 硬解 不会黑屏。 @binaryxiaobao

All 25 comments

android issue

2017-02-10 17:55 GMT+08:00 zhanggao notifications@github.com:

请问这个有解决办法不?
用的是SurfaceView播放的。


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Bilibili/ijkplayer/issues/2666, or mute the thread
https://github.com/notifications/unsubscribe-auth/AEOmlpl2bP0Z1scAMSS6UvVbnFbKR6QMks5rbDQegaJpZM4L9MYd
.

ijkplayer能强制渲染一帧或者视频截图吗?

no

2017-02-11 14:20 GMT+08:00 zhanggao notifications@github.com:

ijkplay能强制渲染一帧或者视频截图吗?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bilibili/ijkplayer/issues/2666#issuecomment-279124873,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEOmliJz2_6x4-tRGfKsGvcDZX8SSnadks5rbVMugaJpZM4L9MYd
.

为啥哔哩哔哩的客户端退后台重进不黑屏?
很多知名视频app退后台重进都黑屏。

黑屏只在surfaceview中,我们默认是textureview

2017-02-13 16:36 GMT+08:00 zhanggao notifications@github.com:

为啥哔哩哔哩的客户断退后台重进不黑屏?
很多知名视频app退后台重进都黑屏。


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bilibili/ijkplayer/issues/2666#issuecomment-279323881,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEOmlhM3KdT_dWet2RI0JDCn6nC5tPoMks5rcBX_gaJpZM4L9MYd
.

我的用的是 textureview 还是黑屏啊

我看你们的 demo ,设置视频 ijkplayer 和还是会黑屏

某些机型,例如华为可能也会出现黑屏问题

2017-02-21 16:03 GMT+08:00 xzy1213 notifications@github.com:

我看你们的 demo ,设置视频 ijkplayer 和还是会黑屏


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bilibili/ijkplayer/issues/2666#issuecomment-281271584,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEOmlq42IbnydMz7Tlk2NhmftBaemaHfks5reppRgaJpZM4L9MYd
.

三星手机 ,小米 魅族,所以的手机都黑屏了。。。

这个 在 后台是会自动调用 new IRenderView.IRenderCallback() 的onSurfaceDestroyed() 方法, demo 中是直接 mMediaPlayer.setDisplay(null);

demo只是示范下正常的使用方法,如果你有其他需求, java封装层自己修改编写

@xzy1213 你解决了没,我换textureview也会黑屏,
mMediaPlayer.setDisplay(null); 这句代码去掉也没用。

我也碰到这个问题,采用一个其他方法:切回前台时执行一次seek

我解决了 看了其他的解答,使用 textureview 并且使用 软解码,使用TextureMediaPlayer 就可以的,切换到后台,再到前台不会黑屏。视频影像还在。

@xzy1213 能具体聊聊这个问题的解决方案吗,QQ或者邮箱有吗?我邮箱[email protected]

@binaryxiaobao 使用软解码+TextureView,不需要其他操作就不会有这个问题了。
使用硬解码是一定存在的

TextureMediaPlayer + TextureView 硬解 不会黑屏。 @binaryxiaobao

@halfhq 我也碰到这个问题,采用一个其他方法:切回前台时执行一次seek
if key frame is long,this way is not a good idea.

@halfhq 我也碰到这个问题,采用一个其他方法:切回前台时执行一次seek 我用此方式解决了,谢谢

override fun onResume() {
    super.onResume()
    if (mediaPlayer != null) {
        if (mediaPlayer?.isPlayable!!) {
            surfaceView?.getHolder()?.addCallback(object : SurfaceHolder.Callback {
                override fun surfaceChanged(holder: SurfaceHolder?, format: Int, width: Int, height: Int) {

                }

                override fun surfaceDestroyed(holder: SurfaceHolder?) {

                }

                override fun surfaceCreated(holder: SurfaceHolder?) {
                    mediaPlayer?.setDisplay(surfaceView?.holder)
                    mediaPlayer?.start()
                }

            });
        }
    }
}

某些手机在退后台的时候,TextureView被销毁了(比如华为)。。
抖音不会。。不知道怎么解决。

某些手机在退后台的时候,TextureView被销毁了(比如华为)。。
抖音不会。。不知道怎么解决。

onSurfaceTextureDestroyed 这个的返回值改成true,退后台不销毁。

我的是android5,6,7上黑屏,8,9上的没有黑屏。真正的原因是什么呢?最正统的解决方法是什么呢?大家研究出来了的话共享一下哈。

我有两个”治标不治本的思路“仅大家参考:
1.因为暂停的时候黑屏,点播放的时候画面又出来了。所以我第一个思路就是切回到前台时把视频resume播放一个很短的时间,比如10毫秒,再暂停。
2.就是这个朋友的思路,拿到暂停的那一帧的图片,回来的时候显示这张图片,点击播放的时候再把图片隐藏起来。https://www.jianshu.com/p/220b00d00deb

为啥哔哩哔哩的客户端退后台重进不黑屏?
很多知名视频app退后台重进都黑屏。

比如说哪个视频app呢?

Was this page helpful?
0 / 5 - 0 ratings