RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
238 stars 29 forks source link

If video doesn't play once, then even after reloading the scene or restaring the game, the video still doesn't play #518

Closed sanathkukkillaya closed 3 years ago

sanathkukkillaya commented 4 years ago

Describe the bug In my game, I use the AVPro plugin to play HLS videos from the web. Most of the times it plays fine. However, there are some times, when the video does not play for some particular network or some particular device. It will be stuck with a white screen with the last event: Started Buffering. The event: First Frame Ready is never called.

Also once this happens, if I restart the player, or if I try to watch any other video (we have something like a list of videos that can be watched), I will face this same issue with all the other videos as well. Even restarting the game does not seem to fix this issue. I only get event: Started Buffering message.

During this time, I tried playing the same video on another device, and on another test website, since I thought this might be a server issue. However I was able to get the videos to work on these other devices and websites. Hence it was not a server issue.

The only way I was able to get the video to play again was to wait for some time (I waited overnight one time, and waited one full day another time). Weirdly, even clearing cache didn't help in this scenario.

I am using a script which is based on the VCR.cs file from the demo scene. I am displaying it on a Canvas with the Display UGUI component.

Your Setup (please complete the following information):

To Reproduce

  1. Open the game, and try to play the video.
  2. If the error, occurs, then close and restart the game
  3. Try to play any video, same issue will occur

Logs If applicable, add error logs to help explain your problem.

Screenshots MicrosoftTeams-image (1) MicrosoftTeams-image (2)

Videos If applicable, add a copy of your video or the URL

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us unitysupport@renderheads.com

sanathkukkillaya commented 4 years ago

Any helpful update on this?

Ste-RH commented 4 years ago

Would it be possible to get a URL(s) for the stream you are seeing this issue with? If you would rather not make them public, you can send them over to unitysupport@renderheads.com

Have you tried updating to the latest version of the asset? (1.11.7)

Have you tried reproducing this in Unity 2018 LTS?

sanathkukkillaya commented 3 years ago

Sorry for the delay in my response. Was a bit preoccupied with my project.

I have shared the url for the stream with you through email. We use videos hosted on dotstudiopro website. This issue occured for me in Unity 2019.4 LTS. However I haven't been able to check in 1.11.7 or in Unity 2018 LTS.

One possible way to encounter this could be by removing network connectivity while playing a video and then trying to play it again. It is not 100% replicable, but when it does, the only option that has worked for me is to wait overnight and check again in the morning.

Ste-RH commented 3 years ago

Thanks for sending over the stream URL.

I have ran the stream through our stress test scene (which reloads and plays the video automatically over and over). I have done this on two different Android devices. Both devices are still playing the video after over 200 re-load cycles. (EDIT: Now ran for over 500 iterations)

Here are the things I would suggest trying.

1) Update to the very latest version of the asset 2) Send me a (Android) logcat output from a device when it happens - or indeed a log from any platform 3) Send me a (camera phone) video of it happening on a device 4) Try reproducing the issue in one of our demo scenes to rule out something in your scene/code causing the problem 5) Try serving the video on another server - I have noticed that the server is extremely slow to serve up the video - I am based in the UK, so maybe this is the factor why I am seeing this. I see you already tried this, maybe you could send the stream files and I could serve it on AWS for us both to try? 6) You could even try making a copy of your project, removing the AVPro Vide v1 asset files and import the AVPro Video v2 beta package

You originally mentioned that you see the problem on Android, iOS and (on occasion) Windows in the Unity editor. This makes it unlikely that the root of the problem is in the AVPro Video asset...as we use completely different APIs on each platform. The chances of them all throwing up the same issue is, whilst possible, extremely unlikely.

Ste-RH commented 3 years ago

Side note, and specific to Android only...in v 1.11.6 we fixed the following:

'Fixed bug which meant CanPlay() was always returning false after a network connection loss when streaming media. This was causing some developers to not be able to resume playback on calling Play() following the connection loss.'

https://github.com/RenderHeads/UnityPlugin-AVProVideo/releases/tag/1.11.6

Ste-RH commented 3 years ago

Another additional...

You say when it happens, you have no choice but to leave it over night...

When it happens, have you tried seeing if the same video plays back on another device(s) (which is on the same internet connection - so same IP address)?

sanathkukkillaya commented 3 years ago

We updated to the latest build, now this does not seems to be happening. Maybe it was something in older version.

There are a couple of other issues that I have in AVPro, Can I ask them here or should I open a new thread for them? For example, there is one issue in iOS, where in my game I call mediaplayer.CloseVideo() and go to the next stage, and the audio starts playing again.(it is just a panel hiding and enabling another panel). This issue occurs only on the iOS build and not on the android or editor. If you are aware of any setting that I must be missing, do let me know. If not, I'll open a new thread for the same.

AndrewRH commented 3 years ago

thanks @sanathkukkillaya please start a new thread for each issue - this will keep things organised

Thanks,

AndrewRH commented 3 years ago

Glad to hear that you're no longer having the issue - I will close this thread.