You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Excellent plugin, thank you. I'm using it for an Android text-to-speech TTS project (read text from a page - and the user can play/stop the reading using the MusicControls) and it works perfectly.
On iOS it does not seem to load the music controls when the text to speech reading is active (audio can be heard). Here is some sample code to illustrate how I'm using it. My iOS device is an iPhone SE with iOS 13.4.1 (in case that's helpful). I have also tried with iPhone 8 XCode simulator running iOS 14.4.
** EDIT: the controls are launched on the simulator for iPhone 8 with iOS 14.4 (but not on the device with iOS 13.4.1), once i removed the following lines from the config.xml file. Oddly enough it does not fire the following functions: onMusicControlsCreateSuccess() or onMusicControlsCreateFailure() on either platform**
...
// User has clicked a button on the app to read the screen content
// reading begins successfully and can be heard on iOS & android.
// Next we want to fire up the controls to let the user stop the playing from the home screen / notification area
// this works on Android but not for iOS
let musicControlOptions = {
track: voiceTrack,
artist: voiceArtist,
album: voiceAlbum,
dismissable : true,
hasPrev: true,
hasNext: true,
hasClose: true,
isPlaying: false
};
if (vDevice === 'ios' || vDevice === 'android') { // the vDevice variables are set earlier
if (vDevice === 'ios'){
let isBGModeActive = cordova.plugins.backgroundMode.isActive();
if (isBGModeActive === false) {
cordova.plugins.backgroundMode.enable();
}
console.log('bgmode: ', isBGModeActive); // this is logged properly, gives true if in background
}
MusicControls.create(musicControlOptions, onMusicControlsCreateSuccess, onMusicControlsCreateFailure);
// other code here
}
function onMusicControlsCreateFailure() {
console.log('could not create controls'); // this is not logged, appears not to fire for iOS
}
function onMusicControlsCreateSuccess() {
MusicControls.updateIsPlaying(true);
console.log('success creating controls'); // this is not logged, appears not to fire for iOS
// more code to handle player button events
MusicControls.subscribe(events);
MusicControls.listen();
}
```
The text was updated successfully, but these errors were encountered:
Hi,
Excellent plugin, thank you. I'm using it for an Android text-to-speech TTS project (read text from a page - and the user can play/stop the reading using the MusicControls) and it works perfectly.
On iOS it does not seem to load the music controls when the text to speech reading is active (audio can be heard). Here is some sample code to illustrate how I'm using it. My iOS device is an iPhone SE with iOS 13.4.1 (in case that's helpful). I have also tried with iPhone 8 XCode simulator running iOS 14.4.
** EDIT: the controls are launched on the simulator for iPhone 8 with iOS 14.4 (but not on the device with iOS 13.4.1), once i removed the following lines from the config.xml file. Oddly enough it does not fire the following functions: onMusicControlsCreateSuccess() or onMusicControlsCreateFailure() on either platform**
Using the code below, neither the onMusicControlsCreateSuccess() nor the onMusicControlsCreateFailure() seem to fire.
I'm not sure if the issue is with TTS + Music Controls use or if I'm doing something wrong.
Note: have also installed your plugin from https://github.com/ghenry22/cordova-plugin-background-mode on iOS
Any advice is welcome. Thanks.
The text was updated successfully, but these errors were encountered: