Ziggeo / ReactNativeSDK

React Native SDK
Apache License 2.0
7 stars 6 forks source link

Video should have sound even iphone is silent from the side button #18

Closed MrHazimAli closed 6 years ago

MrHazimAli commented 6 years ago

Hye, I would like to ask whether this functionality is supported by this package?

For example in youtube app, when I open the video and play it, then I silent the Iphone from the side button, the video sound still on and I wonder if I can do the same with this package using ziggeo as of right now, when I silent the Iphone using side button, my video inside the app also got silent.

Thanks!

3akat commented 6 years ago

@MrHazimAli I assume your question is for iOs only? Because on android there are different sound streams for phone and music, so should work fine.

MrHazimAli commented 6 years ago

@3akat , yes.. ios only.. I'm using version 1.2.0 but apparently, when the device is silent, the video from ziggeo also got silent. any additional setting that I need to do to ensure when the device is silent, the video sound should not be affected?

3akat commented 6 years ago

@MrHazimAli don't know yet, will discuss this with iOs dev

MrHazimAli commented 6 years ago

alright.. thanks again @3akat ! 👍

alexyats commented 6 years ago

@MrHazimAli this feature is not available right now, but we will add an option for that case in next release. If you need it right now, try to add this code before the video playback: [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];

MrHazimAli commented 6 years ago

noted! thanks @alexyats 👍

3akat commented 6 years ago

Hi @MrHazimAli! Please, take a look at the version 1.3.0.

alexyats commented 6 years ago

Hi @MrHazimAli. For the iOS please modify the didFinishLaunchingWithOptions method at the ApplicationDelegate.m file to enable the audio while iPhone is in silent mode:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
                                     withOptions:AVAudioSessionCategoryOptionDuckOthers | AVAudioSessionCategoryOptionDefaultToSpeaker
                                           error:nil];
    return YES;
}