react-native ios app webview plays audio muted when screen turrned off
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 ?
android ios react-native react-native-ios
New contributor
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 ?
android ios react-native react-native-ios
New contributor
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours 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 ?
android ios react-native react-native-ios
New contributor
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 ?
android ios react-native react-native-ios
android ios react-native react-native-ios
New contributor
New contributor
New contributor
asked 17 hours ago
rami-sf
61
61
New contributor
New contributor
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours ago
add a comment |
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours ago
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours ago
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours 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 17 hours ago
answered 17 hours ago
Sateesh
1,058313
1,058313
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
What package are you using right now for audio playing? Show the code in the question please.
– Sateesh
17 hours ago