VideoPlayerManager
VideoPlayerManager copied to clipboard
java.lang.RuntimeException: cannot be in main thread
Process: com.volokh.danylo.videolist, PID: 11999 java.lang.RuntimeException: cannot be in main thread at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.checkThread(VideoPlayerView.java:117) at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.setOnVideoStateChangedListener(VideoPlayerView.java:288) at com.volokh.danylo.videolist.video_list_demo.adapter.items.BaseVideoItem.setActive(BaseVideoItem.java:51) at com.volokh.danylo.visibility_utils.calculator.DefaultSingleItemCalculatorCallback.activateNewCurrentItem(DefaultSingleItemCalculatorCallback.java:28) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.setCurrentItem(SingleListViewItemActiveCalculator.java:359) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.calculateMostVisibleItem(SingleListViewItemActiveCalculator.java:189) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.onScrollStateIdle(SingleListViewItemActiveCalculator.java:159) at com.volokh.danylo.videolist.video_list_demo.fragments.VideoRecyclerViewFragment$3.run(VideoRecyclerViewFragment.java:145) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Download VideoPlayerManager code and you need to import the VideoManager libs module to your project and comment on the lines inUiThread function call in class MediaPlayerWrapper.
It will work as per expectation.