RenderHeads / UnityPlugin-AVProVideo

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

MediaPlayer is not resumed(play) after I swipe the incoming call banner on iOS #1261

Closed garric closed 1 year ago

garric commented 2 years ago

Describe the issue Vedio played by MediaPlayer(AvProVideo) is paused after an incoming iPhone call。After I swipe or refuse the incoming call, the MediaPlayer is still paused(It's expected to be resumed/play)

Your Setup (please complete the following information):

To Reproduce 1.Play a video by MediaPlayer

  1. An iPhone call is incoming as a banner
  2. Video is paused
  3. Swipe the incoming iPhone call or refuse the incoming iPhone call
  4. Video is still paused

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

Screenshots If applicable, add screenshots to help explain your problem.

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

Chris-RH commented 2 years ago

Does it allow you to resume the video playing afterwards or will it not play at all?

garric commented 2 years ago

not play at all

Chris-RH commented 2 years ago

OK. Our iOS dev is on leave at the moment, but he'll look at this as when he gets back. Thanks for reporting it.

huujiee commented 2 years ago

same issue. and I found that in MediaPlayer_AppFocus.cs the first line code:

if !(UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_TVOS)

may be define incorrect, hope it helpful.

MorrisRH commented 2 years ago

This issue has been fixed, playback will resume after an interruption such as receiving a call.

Chris-RH commented 2 years ago

Version 2.6.1 has been released. Please let us know if the issue has not been fixed for you.

garric commented 2 years ago

Where can I get this version 2.6.1? The version we bought is Version 1.10.2。Is version 1.10.2 is compatible with 2.6.1?

Chris-RH commented 2 years ago

Hi @garric,

There are a few different editions of version 2 that you can purchase, more information here: https://www.renderheads.com/content/docs/AVProVideo/articles/download.html#editions

If you already own version 1, if you use the same Unity account then you will be able to go through a discounted upgrade route; https://www.renderheads.com/content/docs/AVProVideo/articles/download.html#upgrade-pricing

AVPro Video 2.x has many API changes, so upgrading a project from AVPro Video 1.x is not recommended or should be done carefully at least. There are also feature differences between version 1.x and 2.x which are summarised in the table on the What's New page. If you do plan to upgrade your existing project then do follow the migration guide.

garric commented 2 years ago

Hi @Chris-RH , The Version 2.6.1 with bug fixed have trial vesion? If it's avaiable, I can first use the trial version and test the bug. And then to evaluate it's worth to upgrade version :)

Chris-RH commented 2 years ago

The trial version of 2.6.1 is available here:

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

On Sat, 3 Sept 2022 at 15:21, garric @.***> wrote:

The Version 2.6.1 with bug fixed have trial vesion? If it's avaiable, I can first use the trial version and test the bug. And then to evaluate it's worth to upgrade version :)

— Reply to this email directly, view it on GitHub https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1261#issuecomment-1236129407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYRROUNEJKOSUZHBUWT4N2LV4NNF7ANCNFSM56ZV3SLQ . You are receiving this because you commented.Message ID: @.***>

garric commented 1 year ago

@Chris-RH hi,I have integrated 2.6.1 trival version, and tested the issue is fixed now. I have another 2 questions:

  1. OnApplicationFocus and OnApplicationPause in Player_AppFocus.cs doesn't be called on iPhone, due to the marco:

    if !(UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_TVOS)

    Is this on purpose? This brings another bug on iPhone, the MediaPlayer will not paused when I open the control center。Is there any risk if I remove the UNITY_IOS macro from the #if defines.

  2. What's the difference between trial version and official version, especially on C# files?

MorrisRH commented 1 year ago

Hey @garric

  1. Yes this is on purpose. On Apple platforms playback is implicitly paused when an application moves to the background so to keep the pause logic as simple as possible this was removed. It shouldn't break things if you enable it but you may find the player doesn't report its pause/playing state correctly. I just did a quick test and playback is paused for me when I open the control centre so not sure why you're not seeing this (tested using our media player demo scene, Unity 2021.3.10f1, iPhone 13 Pro running iOS 16).
  2. The full version removes the RH logo from the video. There is no difference to the C# scripts between the trial and full releases, the differences are all internal to the native part of the plugin.
garric commented 1 year ago

Hi, @MorrisRH My test context: Unity Engine Source code with very little modification based on Unity 2019.4.22f1 iPhone 13, iOS 15.2.1

garric commented 1 year ago

Hi, @MorrisRH I have just tested on Unity 2019.4.22f1, which downloaded from https://unity3d.com/get-unity/download/archive, the bug(The MediaPlayer is not paused when I open the control center) is indeed existed. The tested case(https://drive.google.com/file/d/1WgJhKjZ-0wXY79u7iMK6wDmCc6bIfGT3/view?usp=sharing) is just an empty project with the 2.6.1 trival package, and a Unity default SampleScene containing DisplayuGUI component with default MediaPlayer setting. (The Demo-MediaPlayer scene is Ok) The tested devices: iPhone 13, iOS 15.2.1 iPhone 11, iOS 14.6

garric commented 1 year ago

By the way, MediaPlayer(The Demo-MediaPlayer) does not resume and play at the same moment as when it's paused(like opening control center). Is this correct? e.g. MediaPlayer is paused at 5th seconds of vedio, after a while, the MediaPlayer is resumed and played directly from the 10th seconds, not just at 5th seconds.

MorrisRH commented 1 year ago

Hmmm... I see what you mean, yeah that's not correct. I'll investigate.

MorrisRH commented 1 year ago

Reproduced and will be fixed in the next release

garric commented 1 year ago

Ok :)

garric commented 1 year ago

Hi, @MorrisRH Please let me know if the bug has been fixed. And I will test this new version and decide to buy v2 if it's ok.

MorrisRH commented 1 year ago

@garric this was fixed in the last release

garric commented 1 year ago

Hi @Chris-RH I've tried 2.6.4 package with empty project, and it seems like ok now.

  1. I integrated 2.6.1 package to my project last week, and today ONLY replace the iOS plugin folder with 2.6.4 package(I have compared 2.6.1 with 2.6.4 using beyondcompare, and it looks like only iOS plugin folder change for iOS platform?). But the bug still occures on my project. Is there anything I miss?
garric commented 1 year ago

for Android, If we just play video from local path, can I ignore the following change from 2.6.4? image image

Ste-RH commented 1 year ago

That is an Android only code path. You should be able to safely ignore those changes if you are not targeting Android. Not bringing that change over is unlikely to negatively affect your project. That said, why not bring 2.6.4 over in it's entirety?

garric commented 1 year ago

I stripped some c# and shader files, and modified some c# logic to satisfy our online project's special needs when I integrated 2.6.1 last week. So I planned to integrate 2.6.4 with minimal change based on 2.6.1, but it seemed not ok yesterday.

Anyway, I will try to integrate 2.6.4 entirely today, and see what it will happen.

garric commented 1 year ago

Hi, @MorrisRH I have entrily integrate 2.6.4 to my project and it's ok now for the bug metioned above.

But I find that: when earphone connects to iPhone, the video continue to play, but when earphone disconnects to iPhone, the vedio pause。 Is this behaviour in your exception? Or is there any event in Avpro, which I can listen to? That means, when I am notified that the iPhone is disconnected to eraphone, I can choose to play video by script again。

MorrisRH commented 1 year ago

This is the standard (and expected) behaviour on Apple platforms. We do provide an option to override this though, enable Resume Playback After Audio Session Route Change in the iOS section of the platform specific options for the media player, details of which can be found here.

garric commented 1 year ago

This is the standard (and expected) behaviour on Apple platforms. We do provide an option to override this though, enable Resume Playback After Audio Session Route Change in the iOS section of the platform specific options for the media player, details of which can be found here.

Thanks. I'll try it

garric commented 1 year ago

This is the standard (and expected) behaviour on Apple platforms. We do provide an option to override this though, enable Resume Playback After Audio Session Route Change in the iOS section of the platform specific options for the media player, details of which can be found here.

Hi @MorrisRH I have done a test in an empty project with 2.64 and toggle on the opiton Resume playback after audio route change. But it doesn't work. i mean, when headphone disconnects to iPhone, the vedio still pause. image

garric commented 1 year ago

Hi, @MorrisRH The bug mentioned above (Resume playback after audio route change doesn't work) will be fixed?

MorrisRH commented 1 year ago

Hey @garric, I can't reproduce the issue. It's working fine for me here, playback resumes after disconnecting headphones (wired and Bluetooth). I just tested using our MediaPlayerDemo scene.

garric commented 1 year ago

Hi, @MorrisRH Ok, I'll try MediaPlayerDemo scene.