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

ios videos no sound #874

Closed
banli17 opened this issue Dec 15, 2017 · 17 comments
Closed

ios videos no sound #874

banli17 opened this issue Dec 15, 2017 · 17 comments
Labels
stale Closed due to inactivity or lack or resources

Comments

@banli17
Copy link

banli17 commented Dec 15, 2017

i don't know why, android is ok,ios can play video ,but no voice. not playback,and not silent mode。
react-native 0.44
react-native-video 1.0

<Video
	resizeMode="cover"
	style={{
		width: WinWidth,
		height: WinWidth * 9 / 16,
		backgroundColor: '#000'
	}}
	source={{uri: 'http://58.63.233.44/v.cctv.com/flash/mp4video6/TMS/2011/01/05/cf752b1c12ce452b3040cab2f90bc265_h264818000nero_aac32-1.mp4'|| liveUri}}
	ref={(ref) => {this.player = ref}}
	onLoad={this.onLoad}
	onEnd={this.onEnd}
	playInBackground={isPlayBack}
	onError={this.videoError}
	paused={paused}
/>
@taylorgoolsby
Copy link

taylorgoolsby commented Dec 16, 2017

I am experiencing the same problem with the same versions.

My device is running iOS 11.2

@teng231
Copy link

teng231 commented Dec 17, 2017

Plz update .On device audio muted. i dont know how to fix it

@taylorgoolsby
Copy link

I fixed this by adding this in my AppDelegate.m file:

#import <AVFoundation/AVFoundation.h>  // import

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];  // allow
  ...
}

@sunweiyang
Copy link

Could it be that you just have your silent mode hardware switch enabled on your iPhone?
If you want your app to ignore the silent switch, have the following prop in your <Video> component:

ignoreSilentSwitch={"ignore"}

@j3rin
Copy link

j3rin commented Jun 24, 2018

I'm experiencing the same issue, any solution?

@youngjuning
Copy link

@sunweiyang Thanks Bro.

@amil-m
Copy link

amil-m commented Aug 16, 2018

I tried all the suggestions, finally this worked for me:

In the AppDelegate.m i added:

#import <AVFoundation/AVFoundation.h>  // import

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...

  // Play Audio in Silent Mode  
  AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  NSError *setCategoryError = nil;
  [audioSession setCategory:AVAudioSessionCategoryPlayback
                      error:&setCategoryError];
  ...
}

@deathemperor
Copy link

I added the [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; on iOS 12 but still no sound on silent mode

@luongs3
Copy link

luongs3 commented Dec 6, 2018

me too. Got this error on IOS 12.

@Kiran0791
Copy link

+1

@djw27
Copy link

djw27 commented Dec 10, 2018

We were seeing this regularly with the more recent versions of the library. v3.0 seems to be a bit more stable

@cactis
Copy link

cactis commented Jan 12, 2019

No sound on Android, no error message.

@voxspox
Copy link

voxspox commented Sep 25, 2019

<Video
    ...
    ignoreSilentSwitch="ignore"
/>

worked for me

@katiachumakova
Copy link

I have a project I've recently updated and audio stopped working, I've since reverted to previous commits and it's no longer working anywhere. I'm at a loss, any ideas? (I've tried all the stuff above)

@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Apr 22, 2022
@amalmohann-dgnl
Copy link

@deathemperor @luongs3 @Kiran0791 you guys have missed the import?

please add the import as well

#import <AVFoundation/AVFoundation.h>

@dipkrao
Copy link

dipkrao commented Jan 9, 2023

I fixed this by adding this in my AppDelegate.m file:

#import <AVFoundation/AVFoundation.h>  // import

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];  // allow
  ...
}

yes, it really works. thanks a lot for saving my time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

No branches or pull requests