Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Ads audio still playing when exiting the video (iOS only) #3716

Closed
tenet-angelstrizioli opened this issue Apr 25, 2024 · 6 comments
Closed
Labels

Comments

@tenet-angelstrizioli
Copy link

Version

"react-native-video": "6.0.0-rc.0"

What platforms are you having the problem on?

iOS

Architecture

Old architecture

What happened?

Using adTagUrl on iOS, load an ad and then go back or unmount the video component you can still hear the audio of the ad for 4-5 seconds.
This happen both on emulator and real device.

rn.ads.continue.playing.physical.device.mp4

On android is working as expected.

Reproduction

repository link

Reproduction

Step to reproduce this bug are:

  1. Create a react app
  2. Install react-native-video@6.0.0-rc.0
  3. Create a video component and add adTagUrl
  4. Enter video and go back, you will hear for 4-5 seconds the audio of the ad loaded before.

Expected behaviour:
When exiting the video the ad should stop reproducing the audio.

@Khuongnb
Copy link
Contributor

They likely forgot to call the destroy method when the player is detached from the super view. While waiting for the fixes, you can use my patch-package file for a temporary solution.

Please note that in this patch file, I've also added 2 events for iOS, (AD_CUEPOINTS & AD_ERROR) to grab all ad positions, error when loading adTagUrl and additional metadata of the playing ad break to know which ad position is playing (use cases are included in the file), these event will not included in others release without patching so use at your own risk.

react-native-video+6.0.0-rc.0.patch

@tenet-angelstrizioli
Copy link
Author

This works like a charm, thank you a lot!
I don't know if i should leave this ticket open so they can add this solution to the library logic or close it cause this solution its working

@KrzysztofMoch
Copy link
Collaborator

@Khuongnb do you want to create PR 😄 or I should do it ?

@freeboub
Copy link
Collaborator

Thank you for the patch, I confirm this is looking good, just need to add new events in the documentation !

@Khuongnb
Copy link
Contributor

Khuongnb commented Apr 30, 2024

Sorry for the late response. I created a PR for this issue, which only addresses the ad audio problem. The new ad events will need to be implemented on Android before they can be used to ensure functionality on both platforms, I will open another PR when it's available. Thanks everyone.

KrzysztofMoch pushed a commit that referenced this issue May 1, 2024
… (#3722)

* fix(ios): destroy adsManager when player detach from super view (#3716)

* fix: swift format
@freeboub
Copy link
Collaborator

freeboub commented May 3, 2024

PR has been merged, will be available in 6.0.0-RC.1

@freeboub freeboub closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants