RenderHeads / UnityPlugin-AVProVideo

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

PlaylistMediaPlayer with a particular video is not triggering the FirstFrameReady event on iOS and MacOS #1207

Closed Crambror closed 2 years ago

Crambror commented 2 years ago

Describe the issue

On iOS and MacOS we have a particular video that although can be played (in unity editor using MediaPlayer inspector controls) does not trigger the FirstFrameReady event like all our other videos. From what I see this event is used by PlaylistMediaPlayer to toggle between its 2 MediaPlayer. We also use this event to know when we can perform a seek and retrieve a thumbnail.

Note that this does work correctly on PC, in addition all of our other videos run on all platforms with no problems.

Your Setup (please complete the following information):

To Reproduce

  1. Add the provided video to the MediaPlaylistPlayer playlist
  2. Trigger the item to play using MediaPlaylistPlayer.JumpToItem
  3. Notice that you will never receive the FirstFrameRead event, note that the MediaPlaylistPlayer is waiting for that event to toggle between MediaPlayer

Videos https://user-images.githubusercontent.com/107559607/173839467-e166a1b0-9707-4cd8-95c6-7afc2e74a239.mp4

MorrisRH commented 2 years ago

The first frame of that video is at 0.023000s so it won't be available until Play has been called, hence FirstFrameReady not being triggered. There's not much we can do about this as that's just how the underlying player from the OS works. The quick solution would be to re-encode your video with the first frame at 0s.

Crambror commented 2 years ago

Many thanks for your feedback, I wasn't aware of that offset to the first frame. Unfortunately we're working with user generated content so we won't always be able to control this. However, you have given me some insight into what's happened now so at least I can try and find a way to catch and possibly work around.

christianYS commented 2 years ago

@MorrisRH We have some of our users that are reporting issues on iOS and macOS, and the reason seems that AvPro doesn't fire FirstFrameReady. On some random devices, the video player doesn't fire the FirstFrameReady event at all (not even after reinstalling the app) and the video seems to load forever. But on other devices it seems working fine. If we force calling .Play(), only audio is played and the video screen remains black. We weren't able to reproduce this on our end, but we see it happening in the wild (current AvPro version 2.5.1) Should I open a separate ticket for this? Did you identify a bug that can explain this behavior?

At the moment we observed the issue on at least these platforms:

MorrisRH commented 2 years ago

@christianYS Sounds like a similar issue. We would need to be able to investigate the media involved to know for sure.

christianYS commented 2 years ago

I'll send you the media by email

christianYS commented 2 years ago

sent

MorrisRH commented 2 years ago

@Crambror we're going to see if we can match windows and android in this and produce a frame when the video track is delayed as with your example video. @christianYS I think your issue is separate so if you want to make a new issue or we can continue via email

MorrisRH commented 2 years ago

Videos such as the one provided above will now generate frames from the start of playback which in turn will cause the FirstFrameReady event to be triggered.

Crambror commented 2 years ago

That's great news, many thanks for the quick handling of this issue. I look forward to trying the new version when released!

Ste-RH commented 2 years ago

@Crambror AVPro Video v2.5.3 has just been released. Please do let us know/close the issue if this fixes the issue for you.

Crambror commented 1 year ago

Confirm fix for us.