Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

No audio when on silent more #7

Closed
muqeet-khan opened this issue Mar 10, 2017 · 4 comments
Closed

No audio when on silent more #7

muqeet-khan opened this issue Mar 10, 2017 · 4 comments
Assignees

Comments

@muqeet-khan
Copy link

I only checked this on ios, however, there is no audio when the video is played under silent mode. Is there anything that can be done to resolve this?

@adamfisher
Copy link
Owner

I am a little confused by your question. If you put the phone into silent mode, why would the audio still play? Unless you are messing with the player's Volume property, it does not mess with the system default behavior in any way. So the default behavior of an AVPlayerViewController matches what you would expect. If there is some overriding you wish to do, you might need to create a Xamarin Forms custom renderer to accomplish it.

@muqeet-khan
Copy link
Author

Hope this is clearer. I am using the control in a test app but it only plays audio when the "ringer" is not in silent mode. If the ringer button (upper left) on iPhone is on silent then the audio does not play. I am not sure if that is the default behavior as every other app including Apple's play video and audio fine when the ringer is on silent mode.

@jaybaldwin
Copy link

Was there any resolution to this issue? I see it's closed, but I'm running into the same problem with the demo.

@adamfisher -- I think what OP was saying is ... it's normal on iPhone for media to play despite the silent switch being on. I actually never turn my silent switch off, but I can still hear media if I want. The silent switch affects most system sounds and the ringer, but if the user requests media playback in an app, etc, the normal behavior is apps know that / are able to tell, and respond by beginning media (in some contexts with the mute on) but they hook the app to "request" media playback audio access from the system despite the mute switch if it's reasonable to conclude the user would want that.

For instance: I have no headphones in ... silent mode is engaged, but I select the speakerphone option and push play on a song in the music app. Boom, sound. Or I press play and unmute on a video on Facebook. Boom, sound.

This seems different, b/c it isn't normally how Android works, as the silent toggle is usually respected system-wide, but iOS def make exceptions. Here's an example in another project: TheWidlarzGroup/react-native-video#204

@jaybaldwin
Copy link

Just a note for those who may find this thread on the Googles ... I fixed it with this code in the MyApp.iOS/AppDelegate.cs file. I added one line to the FinishedLaunching(UIApplication app, NSDictionary options) method:

NSError error = AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.Playback);

The expected behavior is now in place. FYI - this was mentioned in the Xamarin documentation here: https://developer.xamarin.com/api/member/AVFoundation.AVAudioSession.SetCategory/p/AVFoundation.AVAudioSessionCategory/.

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

No branches or pull requests

3 participants