react-native ios app webview plays audio muted when screen turrned off

Multi tool use
up vote
1
down vote
favorite
I built a react-native webview app which has audio when the screen turns off the audio keep playing in android while it turned off in ios.
is there any solution ?

New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
1
down vote
favorite
I built a react-native webview app which has audio when the screen turns off the audio keep playing in android while it turned off in ios.
is there any solution ?

New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I built a react-native webview app which has audio when the screen turns off the audio keep playing in android while it turned off in ios.
is there any solution ?

New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I built a react-native webview app which has audio when the screen turns off the audio keep playing in android while it turned off in ios.
is there any solution ?


New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
rami-sf
61
61
New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
rami-sf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago
add a comment |
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Please make sure that the Background Modes
of Xcode
project should be enabled.
If not enabled, go to Xcode project -> Select the target -> Capabilities section -> Background Modes -> Turn it on.
Then select Audio, AirPlay, and Picture in Picture
.
Code:
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Please make sure that the Background Modes
of Xcode
project should be enabled.
If not enabled, go to Xcode project -> Select the target -> Capabilities section -> Background Modes -> Turn it on.
Then select Audio, AirPlay, and Picture in Picture
.
Code:
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
add a comment |
up vote
2
down vote
Please make sure that the Background Modes
of Xcode
project should be enabled.
If not enabled, go to Xcode project -> Select the target -> Capabilities section -> Background Modes -> Turn it on.
Then select Audio, AirPlay, and Picture in Picture
.
Code:
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
add a comment |
up vote
2
down vote
up vote
2
down vote
Please make sure that the Background Modes
of Xcode
project should be enabled.
If not enabled, go to Xcode project -> Select the target -> Capabilities section -> Background Modes -> Turn it on.
Then select Audio, AirPlay, and Picture in Picture
.
Code:
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
Please make sure that the Background Modes
of Xcode
project should be enabled.
If not enabled, go to Xcode project -> Select the target -> Capabilities section -> Background Modes -> Turn it on.
Then select Audio, AirPlay, and Picture in Picture
.
Code:
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
import React, Component from 'react';
import StyleSheet, View, Button from 'react-native';
import SoundPlayer from 'react-native-sound-player';
export default class Touchables extends Component
constructor(props)
super(props);
playTrack()
try
SoundPlayer.playUrl('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3')
catch (e)
alert('Cannot play the file')
console.log('cannot play the song file', e)
render()
return (
<View style=styles.container>
<Button title="play me" onPress=this.playTrack />
</View>
);
const styles = StyleSheet.create(
container:
marginTop: 100,
,
);
edited 2 days ago
answered 2 days ago
Sateesh
1,077513
1,077513
add a comment |
add a comment |
rami-sf is a new contributor. Be nice, and check out our Code of Conduct.
rami-sf is a new contributor. Be nice, and check out our Code of Conduct.
rami-sf is a new contributor. Be nice, and check out our Code of Conduct.
rami-sf is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237714%2freact-native-ios-app-webview-plays-audio-muted-when-screen-turrned-off%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
VeJmeBIBvayZOYhQnMg4oxr,hWEj 7RTM83Ee2NBfCWn,CXR E1wIT8Jb UpbtEFsALM
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
2 days ago