mklimek / frame-video-view

Less issues with VideoView
Other
63 stars 19 forks source link

Release on texture surface destroyed #8

Closed m-kubis closed 8 years ago

m-kubis commented 8 years ago

Hi, there is a re-initialization issue on surface destruction. For example when placing the video into the RecyclerView. The recycling of the view can be handled with #onResume()/#onPause() with the RecycleView#onBindViewHolder(...)/#onViewRecycled(...) callbacks. However the surface state change callbacks of the implementation are not accessible from the outside. The exact moment the texture view goes out of view (the last pixel scrolls out of the screen), TextureViewImpl#onSurfaceTextureDestroyed(Surface) gets called and the following onSurfaceTextureAvailable(Surface) doesn't initialize the media player due to not being released (and flag set).

The player should be released and the placeholder view shown. Simple doing #onResume() in TextureViewImpl#onSurfaceTextureDestroyed(Surface) should do the trick. Before After releasing on surface destruction

mklimek commented 8 years ago

Thanks for a feedback! If you already solved it, can you create a pull request?

m-kubis commented 8 years ago

Ok, I did. The thing is I have no way to test the video view implementation for the issue. You might want to look at that.

mklimek commented 8 years ago

I think VideoView impl support itsn't a big deal because API Level 13 and lower is running roughly 2% of all devices. Thanks for a contribution 👍