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

Video stalling after completing and can't be restarted #1914

Open heritageint opened 6 days ago

heritageint commented 6 days ago

Describe the issue Playing a video and allowing it to complete (fires the FinishedPlaying event) then attempting to replay the same file results in the file Stalling - have tried to rewind the file, seekToFrame, seekToTime, etc. and none work. Pressing Play then Pause then Play does restart the video.

The files are local on PC (StreamingAssets folder).

This can be recreated just in the Media Player component in the Editor - play a file and allow it to finish, try pressing Play and it stalls (and never plays).

Have tested in V2.9.3 and no issue, using the same project with V3.0.4 introduces the problem.

Your Setup (please complete the following information):

To Reproduce

  1. Load a video in the Media Player component
  2. Play the video and allow it to finish
  3. Press Play and the video stalls
Chris-RH commented 5 days ago

Confirmed in MF and DS, not WinRT.

In the mediaplayer demo scene, it reaches the end of the clip and FinishedPlaying event occurs. Pressing the 'play/pause' button causes Paused event, pressing again causes Unpaused event, pressing again causes Paused event. Pressing 'play' a fourth time causes StartSeeking, Unpaused and FinishedSeeking events to occur and then the clip starts playing again. It works as expected in version 3.0.0

WinRT gets FinishedPlaying and Paused events at the end of the clip. 'Play' button restarts the clip from the beginning (no Seek events though).

RichRH commented 5 days ago

Hi @heritageint,

Thanks for reporting this - I'm still looking into it but it looks like recent changes may actually be showing up a bug in the Windows Media Player 'IsPlaying()' function.. whereby it never reports back 'false' when the video has actually ended (and hence it sticks in a 'Finished' + 'Playing' state).

I would however expect if 'IsFinished' has been fired/detected manually, then 'Rewind()' + 'Play()' is called that the video would restart - similar to dragging the playhead back in the Media Player component once it's finished, which works for me here.

I'll keep you posted once I know more.

Cheers,

RichRH commented 3 days ago

I've looked further into this and it seemed to stem from an old bug (https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/263) whereby MF and DS 'IsPlaying()' functionality didn't match WinRT/other platforms, now exacerbated by more recent changes.

I've now tried to bring MF and DS into line with the others, so:

Hopefully this addresses both this issue and #263 - changes should be in the next build.

Chris-RH commented 2 days ago

AVPro Video version 3.0.5 has been released. Please let us know if it has not fixed your issue.