Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

友盟统计报了个这个错误 #1869

Open
dary123 opened this issue Mar 11, 2019 · 30 comments
Open

友盟统计报了个这个错误 #1869

dary123 opened this issue Mar 11, 2019 · 30 comments

Comments

@dary123
Copy link

dary123 commented Mar 11, 2019

231
设备机型
M5 Note
java.lang.IllegalStateException
at android.media.MediaPlayer.getVideoHeight(Native Method)
at tv.danmaku.ijk.media.player.AndroidMediaPlayer.getVideoHeight(AndroidMediaPlayer.java:201)
at com.shuyu.gsyvideoplayer.f.d.getVideoHeight(SystemPlayerManager.java:160)
at com.shuyu.gsyvideoplayer.c.getVideoHeight(GSYVideoBaseManager.java:483)
at com.shuyu.gsyvideoplayer.video.base.GSYVideoView.getCurrentVideoHeight(GSYVideoView.java:224)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.isVerticalVideo(GSYBaseVideoPlayer.java:473)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.isVerticalFullByVideoSize(GSYBaseVideoPlayer.java:523)
at com.shuyu.gsyvideoplayer.utils.OrientationUtils$1.onOrientationChanged(OrientationUtils.java:49)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:713)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:328)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:6519)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)

@CarGuo
Copy link
Owner

CarGuo commented Mar 11, 2019

这个错误在某些场景会出现,代码中我记得强行catch住了,理论上是不会抛出的

@dary123
Copy link
Author

dary123 commented Mar 11, 2019

我就是直接用的你的库,没有做任何修改

@CarGuo
Copy link
Owner

CarGuo commented Mar 11, 2019

是的,因为这个理论上已经处理了,可能需要你看看复现的步骤。

@malonecoder
Copy link

@CarGuo 我也遇到了一模一样的问题,请问有解决途径吗

@malonecoder
Copy link

@dary123 你好 我想问下这个问题解决了吗

@dary123
Copy link
Author

dary123 commented Mar 14, 2019

@dary123 你好 我想问下这个问题解决了吗

还没解决

@malonecoder
Copy link

@CarGuo大佬 我用的是6.0.0版本的 7.0.0处理这个问题了吗 - -

使用场景大多数应该是来回旋转屏幕导致的~
java.lang.IllegalStateException
at android.media.MediaPlayer.getVideoHeight(Native Method)
at tv.danmaku.ijk.media.player.b.j(AndroidMediaPlayer.java:201)
at com.shuyu.gsyvideoplayer.e.d.j(SystemPlayerManager.java:160)
at com.shuyu.gsyvideoplayer.b.t(GSYVideoBaseManager.java:475)
at com.shuyu.gsyvideoplayer.video.base.GSYVideoView.getCurrentVideoHeight(GSYVideoView.java:220)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.N(GSYBaseVideoPlayer.java:472)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.Q(GSYBaseVideoPlayer.java:523)
at com.shuyu.gsyvideoplayer.g.h$1.onOrientationChanged(OrientationUtils.java:49)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:707)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
2019-03-13 20:18:10.808 2756-4124/? W/ActivityManager: Force finishing activity

@CarGuo
Copy link
Owner

CarGuo commented Mar 14, 2019

@bysir521 一般如果配置了manifest,选择屏幕不会导致重构的啊

@malonecoder
Copy link

malonecoder commented Mar 15, 2019 via email

@CarGuo
Copy link
Owner

CarGuo commented Mar 19, 2019

是的

@shangqianglong
Copy link

最后怎么处理的

@malonecoder
Copy link

@shangqianglong 禁止屏幕自动旋转了 哈哈 手动旋转没事

@equationl
Copy link
Contributor

@CarGuo大佬 我用的是6.0.0版本的 7.0.0处理这个问题了吗 - -

使用场景大多数应该是来回旋转屏幕导致的~
java.lang.IllegalStateException
at android.media.MediaPlayer.getVideoHeight(Native Method)
at tv.danmaku.ijk.media.player.b.j(AndroidMediaPlayer.java:201)
at com.shuyu.gsyvideoplayer.e.d.j(SystemPlayerManager.java:160)
at com.shuyu.gsyvideoplayer.b.t(GSYVideoBaseManager.java:475)
at com.shuyu.gsyvideoplayer.video.base.GSYVideoView.getCurrentVideoHeight(GSYVideoView.java:220)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.N(GSYBaseVideoPlayer.java:472)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.Q(GSYBaseVideoPlayer.java:523)
at com.shuyu.gsyvideoplayer.g.h$1.onOrientationChanged(OrientationUtils.java:49)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:707)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
2019-03-13 20:18:10.808 2756-4124/? W/ActivityManager: Force finishing activity

请问一下,您能自己重现出这个问题吗?我也尝试自己瞎旋转,可是也无法重现啊

@shangqianglong
Copy link

@CarGuo大佬 我用的是6.0.0版本的 7.0.0处理这个问题了吗 - -
使用场景大多数应该是来回旋转屏幕导致的~
java.lang.IllegalStateException
at android.media.MediaPlayer.getVideoHeight(Native Method)
at tv.danmaku.ijk.media.player.b.j(AndroidMediaPlayer.java:201)
at com.shuyu.gsyvideoplayer.e.d.j(SystemPlayerManager.java:160)
at com.shuyu.gsyvideoplayer.b.t(GSYVideoBaseManager.java:475)
at com.shuyu.gsyvideoplayer.video.base.GSYVideoView.getCurrentVideoHeight(GSYVideoView.java:220)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.N(GSYBaseVideoPlayer.java:472)
at com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.Q(GSYBaseVideoPlayer.java:523)
at com.shuyu.gsyvideoplayer.g.h$1.onOrientationChanged(OrientationUtils.java:49)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:707)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
2019-03-13 20:18:10.808 2756-4124/? W/ActivityManager: Force finishing activity

请问一下,您能自己重现出这个问题吗?我也尝试自己瞎旋转,可是也无法重现啊

我也是重现不了 可是我的统计 次数占比 已经达到了97.13%;用户反馈是播放一段时间就闪退;现在考虑换个播放器了

@CarGuo
Copy link
Owner

CarGuo commented Jul 5, 2019

@shangqianglong @equationl 我也很郁闷,复现不出来······

@CarGuo
Copy link
Owner

CarGuo commented Jul 9, 2019

首先需要确定,是否因为屏幕选择导致的生命周期重构,还有是否因为混淆导致的类方法错误

@NiaNingXue
Copy link

NiaNingXue commented Jul 10, 2019

有同样的问题,目前还是小概率,无法复现。报错的位置倒是很明确,新版本能不能catch下

 orientationEventListener = new OrientationEventListener(activity.getApplicationContext()) {
            @Override
            public void onOrientationChanged(int rotation) {
                boolean autoRotateOn = (Settings.System.getInt(activity.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1);
                if (!autoRotateOn && mRotateWithSystem) {
                    return;
                }
                if (gsyVideoPlayer != null && gsyVideoPlayer.isVerticalFullByVideoSize()) {
                    return;
                }
                if (mIsPause) {
                    return;
                }

OrientationUtils类里gsyVideoPlayer.isVerticalFullByVideoSize()这个地方

@wang6793453
Copy link

wang6793453 commented Jul 23, 2019

横屏视频源全屏播放的时候出现这个问题,后来把 android:configChanges="keyboard|orientation|keyboardHidden"
改成
android:configChanges="keyboard|orientation|keyboardHidden|screenSize" 就好了

@CarGuo
Copy link
Owner

CarGuo commented Jul 23, 2019

@wang6793453 我猜测也是

@dary123
Copy link
Author

dary123 commented Jul 28, 2019

横屏视频源全屏播放的时候出现这个问题,后来把 android:configChanges="keyboard|orientation|keyboardHidden"
改成
android:configChanges="keyboard|orientation|keyboardHidden|screenSize" 就好了

没有用,还是出现了

@lrnrzg
Copy link

lrnrzg commented Aug 26, 2019

希望得到解决,目前线上崩溃率极高

@w13159584927
Copy link

出现同样的问题,线上版本友盟统计到的。

@haohaozaici
Copy link
Contributor

  1. 如果是生命周期导致
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
  • 在activity中处理好enabledisablerelease的时机。
  • 也可以参考我的实现AutoRotationUtil.java,单独处理屏幕自动旋转逻辑。
  1. Android O 透明activity不允许旋转bug
    项目中OrientationUtils没有处理此问题,Android O里activity如果使用透明主题,调用mActivity.setRequestedOrientation(mScreenType);时会崩溃。

  2. 平板旋转方向问题
    手机和部分平板的默认正方向(角度)是不同的,比如部分三星、sony平板,默认方向时Surface.ROTATION_270,这一点需要单独处理。

之前主要借鉴了OrientationUtils的实现,后来完善了一下,希望大家能早日解决问题~

CarGuo added a commit that referenced this issue Jan 2, 2020
@anonyein
Copy link

anonyein commented Jan 2, 2020

  1. 如果是生命周期导致
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
  • 在activity中处理好enabledisablerelease的时机。
  • 也可以参考我的实现AutoRotationUtil.java,单独处理屏幕自动旋转逻辑。
  1. Android O 透明activity不允许旋转bug
    项目中OrientationUtils没有处理此问题,Android O里activity如果使用透明主题,调用mActivity.setRequestedOrientation(mScreenType);时会崩溃。
  2. 平板旋转方向问题
    手机和部分平板的默认正方向(角度)是不同的,比如部分三星、sony平板,默认方向时Surface.ROTATION_270,这一点需要单独处理。

之前主要借鉴了OrientationUtils的实现,后来完善了一下,希望大家能早日解决问题~

今天凌晨才突然机遇发现了ui模式改变的问题,要是早看到大佬的信息估计就能更早解决了,感谢!

@anonyein
Copy link

这个Crash基本上探明了,是在反向全屏的自动播放的时候发生的。。。OrientationUtils.禁用是锁不住,因为一般来说 orientationUtils.setEnable(true)是在onPrepared里面调用的,但是这时候如果是反向全屏,从上一个视频跳转过来并自动播放的时候,一方面是屏幕是默认是倒的,要翻转(OrientationEventListener监听到),二方面前面的视频放空(NULLPOINT),getCurrentPlayer其实是放空的。。。
orientationEventListener = new OrientationEventListener(activity.getApplicationContext()) {
@OverRide
public void onOrientationChanged(int rotation) {
boolean autoRotateOn = (Settings.System.getInt(activity.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1);
if (!autoRotateOn && mRotateWithSystem) {
return;
}
if (gsyVideoPlayer != null && gsyVideoPlayer.isVerticalFullByVideoSize()) {
return;
}
if (mIsPause) {
return;
}
里面的gsyVideoPlayer.isVerticalFullByVideoSize()一调用就崩溃了(因为里面要取getHeight)。。。

@elenin
Copy link

elenin commented Jul 15, 2020

这个问题现在有修复方案么?

@BoBoSama
Copy link

BoBoSama commented Aug 5, 2020

我使用了demo里的DanmakuVideoPlayer, 还是出现了同样的问题

android.media.MediaPlayer._getVideoHeight(Native Method)
android.media.MediaPlayer.getVideoHeight(MediaPlayer.java:2167)
tv.danmaku.ijk.media.player.AndroidMediaPlayer.getVideoHeight()
a.m.a.q.e.getVideoHeight()
a.m.a.d.getVideoHeight()
com.shuyu.gsyvideoplayer.video.base.GSYVideoView.getCurrentVideoHeight()
com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.isVerticalVideo()
com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer.isVerticalFullByVideoSize()
com.shuyu.gsyvideoplayer.utils.OrientationUtils$1.onOrientationChanged()
android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)

@BoBoSama
Copy link

BoBoSama commented Aug 5, 2020

用的7.1.5版本 manifest也配置了

@CarGuo
Copy link
Owner

CarGuo commented Aug 5, 2020

#2873 (comment) @BoBoSama 初步怀疑是这个问题 2829be0

@linkaipeng
Copy link

linkaipeng commented Feb 24, 2021

我遇到过此问题,并解决了;但不确定场景是否一致;

出现系统:Android 10

我的场景:进入 activity 后,player 开始播放后马上设置横屏 orientationUtils.resolveByClick(),然后就出现一样问题;

解决方式:首次进入页面,将 orientationUtils.resolveByClick() 放到 onWindowFocusChanged hasFocus 为 true 的时候调用;

可以看下是否有参考意义

xwaitalonec pushed a commit to xwaitalonec/GSYVideoPlayer that referenced this issue Aug 19, 2021
hudawei996 pushed a commit to hudawei996/GSYVideoPlayer that referenced this issue Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests