Merge pull request #3077 from francescoben/bug/3068_ios_ads_muted

fix: iOS Ads are reproduced with sound even if muted or volume set to 0
This commit is contained in:
Olivier Bouillet
2023-04-05 22:40:38 +02:00
committed by GitHub
3 changed files with 10 additions and 0 deletions

View File

@@ -77,6 +77,10 @@ class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {
// MARK: - IMAAdsManagerDelegate
func adsManager(_ adsManager: IMAAdsManager, didReceive event: IMAAdEvent) {
// Mute ad if the main player is muted
if (_video.isMuted()) {
adsManager.volume = 0;
}
// Play each ad once it has been loaded
if event.type == IMAAdEventType.LOADED {
adsManager.start()

View File

@@ -500,6 +500,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
applyModifiers()
}
@objc
func isMuted() -> Bool {
return _muted
}
@objc
func setMuted(_ muted:Bool) {
_muted = muted