August 8, 2020 at 7:24 am #2163
I am facing this issue where on closing the InAppBrowser by clicking the close button in the title bar of the browser, it just hides the browser panel and does not close the browser entirely. Now the reason this is an issue for me as I am streaming a video in the browser and when I close the browser, I am still able to hear the sound of the video and my in-game sound simply mutes.
I am using the latest version of InAppBrowser 2.0.2 with Unity 2019.4.7 and I have tried it on both android Xiaomi Poco f1 and Moto X and iOS device iPad 6th Generation.
I am simply opening the InAppBrowser using below static util:
public static void PlayVideoInBrowser(string url, string title)
InAppBrowser.DisplayOptions browserOptions = new InAppBrowser.DisplayOptions();
browserOptions.backButtonText = ” X”; //white spaces for left padding
browserOptions.shouldStickToLandscape = true;
browserOptions.shouldUsePlaybackCategory = true;
browserOptions.displayURLAsPageTitle = false;
title = “Video”;
browserOptions.pageTitle = title;
browserOptions.hidesTopBar = false;
browserOptions.shouldStickToLandscape = true;
browserOptions.hidesHistoryButtons = true;
browserOptions.textColor = Constants.WHITE_COLOR;
browserOptions.barBackgroundColor = Constants.DARK_GREY_COLOR;
browserOptions.loadingIndicatorColor = Constants.RED_COLOR;
How can I close the browser instance fully to hear back the audio of the game?
Please let me if there is there any quick workaround or if I am not using the plugin correctly.August 14, 2020 at 11:14 am #2172
Could you give me a URL to a video you are testing? Browser is definitely closed, probably video asset isn’t released correctly and it’s run by some other process.August 14, 2020 at 11:42 am #2173
You can try this URL: https://www.triumdesigns.com/media/default.mp4
I guess when the browser plays a video, it might be using the internal video player of the corresponding platform and this internal video player does not get closed on browser close. I can say this from the video player UI on iOS. The player keeps on playing the video in the background when I close the InAppBrowser while the video is playing. You will still be able to hear the sound of the video after closing the browser. If I pause the video and then close the browser, it works normally.
Let me know if I can somehow work around this.August 18, 2020 at 4:15 pm #2185
Same problem here.
Still trying to figure out the exact conditions when it occurs.August 18, 2020 at 8:39 pm #2186
btw. why are you using this plugin to play videos?
Isn’t Unity already providing API for videos?August 19, 2020 at 6:46 am #2187
Well, you are right, Unity does have a Video playing API to play videos, but it is quite bad for streaming online videos.
The native implementation of InAppBrowser allows it to use native video players that are far better at streaming online videos than Unity’s API. While in fact, it does stream our videos quite well, but only on browser close, the native video player still keeps on playing the video in the background.August 26, 2020 at 11:33 pm #2199
Is this something you’ll get a chance to work on
sooner or later or..August 28, 2020 at 12:31 pm #2205
I am not able to reproduce it.
Let’s talk about iOS:
How is this video playing on iOS after clicking on a back button?
After video starts playing I see close button coming from a player, so I click on it. Then I can click on a back button from browser but video is already closed – so how is it possible the audio is still playing for you?
Here is screenshot from it:
August 28, 2020 at 3:33 pm #2209
Ah, you nailed the clue.
It was inconsistent because of how I was viewing the video.
If I close with the X on video, everything is fine.
But if I shrink the video with a zoom action (0:22),
it continues to play inside the browser window.
Then if I close it, the audio continues to play.
I’m guessing the short term solution is for us to just disable the pinch and zoom.August 28, 2020 at 4:58 pm #2210
Never mind on disabling pinch/zoom.
Pinch/zoom in only in relation to the inappbrowser window.
Turning it off doesn’t stop me from ‘minimizing’ the video window.August 29, 2020 at 12:25 pm #2214August 30, 2020 at 10:30 am #2216
I tried the new jar file in the project that I shared with you on email, but it still doesn’t seem to solve my issue of in-game sound going mute on closing the IAB.
You can try the project I shared with you where I have just edited your sample scene to have a text box to enter a URL to be opened in IAB on button click. And I am having a background score playing on a loop in the background.
I tried the new InAppBrowser.jar, that you shared, in this project and the results are still the same, the in-game sound goes on mute on closing the browser playing a video.
Just FYI, the unity project is on my google drive here:
Hope this helps.August 30, 2020 at 10:52 am #2217
This is completely different issue – can you use
OnBrowserClosedcallback and simply resume your audio there?August 30, 2020 at 12:00 pm #2218
Well, I tried that, but the in-game audio is not paused/stopped, its muted maybe because the InAppBrowser video player takes over the audio on playing a video. Even if I increase the volume it does not change anything.
But if I press the home button in android, and open the app again, I am able to hear back the in-game sound.
Now, this was the actual issue that I raised here. I thought because I was playing a video in the IAB, the instance might not be closing properly on browser close and this might be causing the in-game audio to not resume.
Normally, when I open the IAB browser, the in-game audio is playing no matter which web page I load, but the moment I play a video, it does not return to the in-game audio on browser close and no sounds are not heard on the speaker (not even button clicks) after that.
August 31, 2020 at 10:03 pm #2225
- This reply was modified 1 year, 1 month ago by Sanket. Reason: typo
Thanks. Both files worked perfect for me.
I couldn’t actually test the Android,
since I never get that full screen scenario like in iOS.
Sorry Sanket. I must’ve misunderstood your initial request and
ended up inadvertently hijacking your thread. 🙂
- You must be logged in to reply to this topic.