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

Audio still playing after closing Safari View Controller #91

Open
mblistan opened this issue Jan 18, 2018 · 8 comments
Open

Audio still playing after closing Safari View Controller #91

mblistan opened this issue Jan 18, 2018 · 8 comments

Comments

@mblistan
Copy link

In case when page contains audio file, after closing the Safari View Controller and returning back to previous screen, the audio is still playing.

@koenpunt
Copy link
Collaborator

I guess this is an issue with the safari view rather than with this library per se

@mblistan
Copy link
Author

I tried the exact same link in other app (native), after dismissing Safari View audio stopped playing.

@stevenleeg
Copy link

I've been running into this issue as well. Has anyone found a workaround?

@koenpunt
Copy link
Collaborator

koenpunt commented Jul 7, 2018

Might have been solved with #85, since there the safari view is explicitly deallocated. Can you try with the current master?

@tobiastimm
Copy link

@koenpunt could you release a new npm package?

@redreceipt
Copy link

What's the status on this?

@stevenleeg
Copy link

@redreceipt not sure where the maintainer went but I've been using the latest commit on my project while we wait for an updated npm package:

yarn add git://github.com/naoufal/react-native-safari-view@d828e79

@tbissonnette
Copy link

It looks like there's a bug in SafariViewManager.m safariViewControllerDidFinish: where the SafariViewController is never actually dismissed when the user hits the 'dismiss' button. And since that method sets _safariView = nil before notifying any onDismiss listeners, even if one of them subsequently called dismiss( ) it wouldn't help.

So the call to dismiss needs to be done as the first action in safariViewControllerDidFinish: like this:

-(void)safariViewControllerDidFinish:(nonnull SFSafariViewController *)controller
{
[_safariView dismissViewControllerAnimated:true completion:nil];
_safariView = nil;
NSLog(@"[SafariView] SafariView dismissed.");
if (hasListeners) {
[self sendEventWithName:@"SafariViewOnDismiss" body:nil];
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants