Closed Piasy closed 8 years ago
@Piasy
I init ScalableVideoView in onViewCreated method, and when I destroy this fragment and recreate it again, the video could not be played
I don't understand why this happens. It would be great if u can see me ur sample project.
But setting mMediaPlayer = null;
in release()
seems better implementation.
Thanks for you PR.
fix IllegalStateException when release called release before onDetachedFromWindow.
Details: In my HM note(China Xiaomi Inc), I use ScalableVideoView in fragment, I init ScalableVideoView in onViewCreated method, and when I destroy this fragment and recreate it again, the video could not be played, when I call ScalableVideoView.release() in onDestroyView method, the video could be played again in the condition above, but my app will crash with IllegalStateException, when the fragment is destroyed again.
I think set
mMediaPlayer = null;
inrelease()
method could be solve this problem, and it does in my project (I introduce this repo's source into my project and setmMediaPlayer = null;
, and the crash goes off).