VideoPlayerManager icon indicating copy to clipboard operation
VideoPlayerManager copied to clipboard

Way to Set looping on MediaPlayer?

Open niftynei opened this issue 10 years ago • 2 comments

Hi, is there a way to set a video to looping? I see the method in the MediaPlayerWrapper, but there's no good example of how to call this method from any of the other classes (VideoView or the VideoPlayerManager)

niftynei avatar Feb 11 '16 18:02 niftynei

Hi,

I had a similar question a few days ago.

There is a problem with looping on some devices. We cannot use native method MediaPlayer.setLooping().

We've seen the problem with some Samsung or running Anroid 5.0 with NuPlayer. They just ignore this call to MediaPlayer.setLooping().

You have to run the full cycle again : reset, release, setDataSource, prepare, start.

It's very screwed up, but I didn't find any other way. For now. Maybe we can rewind somehow to the start or something.

danylovolokh avatar Feb 12 '16 22:02 danylovolokh

Ah OK. Yeah, I've definitely seen this behavior, esp on Samsung devices. I've got a hack in my current video implementation that attempts to detect bad loops and restart the vid, but it's not fool proof.

The nice thing abt the native loop (when it works) is that it keeps the video buffered. Tearing down and restarting won't let you loop seamlessly. On Feb 12, 2016 17:23, "Danylo Volokh" [email protected] wrote:

Hi,

I had a similar question a few days ago.

There is a problem with looping on some devices. We cannot use native method MediaPlayer.setLooping().

We've seen the problem with some Samsung or running Anroid 5.0 with NuPlayer. They just ignore this call to MediaPlayer.setLooping().

You have to run the full cycle again : reset, release, setDataSource, prepare, start.

It's very screwed up, but I didn't find any other way. For now. Maybe we can rewind somehow to the start or something.

— Reply to this email directly or view it on GitHub https://github.com/danylovolokh/VideoPlayerManager/issues/16#issuecomment-183510362 .

niftynei avatar Feb 13 '16 01:02 niftynei