Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
107 stars 83 forks source link

Admob showing an ad removes all sound from game until the next ad #3855

Closed maclemore closed 4 years ago

maclemore commented 4 years ago

Problem description

Once an interstitial video has been shown, it will mutes all of my music & sound. Then when another interstitial video is shown again, then the sound will comes back.

Attach a .c3p

admob-audio-issue.c3p.zip

Steps to reproduce

  1. Die 3 times, and ad will show and that will mute everything
  2. Die 3 more times, the 2nd ad will show and the audio will come back

[Uploading admob-audio-issue-video-suppplement_1_2.mp4.zip…]()

Observed result

Once an ad has been shown, audio will be muted/disabled.

Expected result

Showing abmob ads do not disable audio.

More details

Others have experienced this issue as well.

Screen Shot 2020-05-12 at 10 41 54 PM Screen Shot 2020-05-12 at 10 42 05 PM

Affected browsers/platforms: This issue only occurs on iOS when ads actually run.

First affected release: I don't remember the version since there were breaks in between but this issue started 8 days ago.

System details

View details PASTE HERE
vpaultech commented 4 years ago

I'm very certain this issue wasn't in r187. It is in r197 however. I've only been using stable releases lately since I was testing to do a new publish on IOS and r197 was released right in the middle of my extensive testing. To the developers, please check with IAP as well. Thank you for getting this posted! With best regards,

AshleyScirra commented 4 years ago

Please see the bug report guidelines. We require a minimal project in order to rule out a mistake in the events, which is very common. The provided project has over 100 events, which could easily have a mistake in them.

I used my own minimal ad test project with the ability to play sound. It worked fine. I tested it on an iPad Pro with iOS 13.4.1. I started some music playback and displayed both intersitital video ads and rewarded video ads. In both cases during the ad the music faded out and was muted and the ad played with audio; after the ad finished the music automatically faded back in and continued normally. Sound effects also continued to play normally. I tried this several times and it worked fine every time. This is further evidence that it is actually working correctly and you probably have a mistake in your events.

Here is the minimal test project I used so you can try it yourself - note you'll need to update all the IDs (publisher, app, and all ad units) from a valid and verified account: MobileAdTest (2).zip

Unless you can demonstrate a bug in a similarly minimal project, I can only assume there is a mistake in your events and this issue will be closed. Please always follow the bug report guidelines, they are specifically written to avoid bug reports ending this way.

maclemore commented 4 years ago

@AshleyScirra Hi Ashley! Thank you for the prompt reply. I exported your test project and tested it on my iPhone with iOS 13.4.1. The problem occurs if you play the ad first then try to play music or sound afterwards.

Here's a video the bug. I played the rewarded video ad once. After that, I tried playing music and sound but nothing came up: admob_no_audio_issue.mp4.zip

Here's your test project with just my IDs updated: MobileAdTest.c3p.zip

AshleyScirra commented 4 years ago

It looks like you are mixing up ad types. The original report mentions interstitial video ads, but your reply talks about rewarded video ads, which are a different type of ad. Which are affected? Both or just one?

I can reproduce an issue with audio playback failing if I immediately play an interstitial ad without playing any audio first. Then when the interstitial ad finishes audio playback does not work. However rewarded video ads seem to work fine, I can still play audio after they finish.

It's hard to tell what's going on but I don't think it's anything to do with Construct. Our engine does not control the audio playback - the browser/OS does. If ads break audio playback, then that is to do with Google's ad library. So I don't think there's anything we can do ourselves about this.

I reported this on the Google Mobile Ads SDK developers Google group here: https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/ios/t6xc-KHD17Y I can't find anywhere more appropriate to report this like a bug tracker, so I guess that will have to do. Since this seems to be out of our hands, closing this issue and will follow up there.

curtastic commented 3 years ago

I've found a solution for this. I don't use Construct, I port my javascript game manually. I'm supporting ios9 so I can't upgrade to AdMob 8. Even when I try to drop ios9 and upgrade AdMob I get linker errors. I've posted on StackOverflow but have gotten no help. Google is not a very helpful company these days, when their old version breaks they don't care, they want to force everyone to upgrade even when their documentation isn't complete for the new version (still no swift example code for rewarded ads in AdMob 8, and you can't even download AdMob 7 anymore. Thankfully I had the old AdMob 7 in my trash bin and I could recover it. You need to do audioContext.resume() after the ad stops showing. I wanted to do this with myWebView.evaluateJavascript("myAudioContext.resume()") in rewardedAdDidDismiss() but rewardedAdDidDismiss() callback never fires for some reason. I have tried searching online and cannot find any way of determining when the rewarded video ad stops being visible to the user (when they tap the close button after finishing viewing the ad). So right now I added to my javascript playSound function if(myAudioContext.state == 'suspended') myAudioContext.resume()