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
I'm creating an application using cordova vue JS together with VueX.
I installed this plugin and everything is working fine, however I was trying to add the play and pause function. In my code i do the following i my VueX storage.
` async createNativeAudioWidget({dispatch, state, commit}){
//Destory old one
MusicControls.destroy();
//Create the widget
MusicControls.create({
track : podcastInformation.title, // optional, default : ''
artist : 'Fonodio', // optional, default : ''
cover : podcastInformation.image, // optional, default : nothing
isPlaying : true, // optional, default : true
dismissable : true, // optional, default : false
// hide previous/next/close buttons:
hasPrev : false, // show previous button, optional, default: true
hasNext : false, // show next button, optional, default: true
hasClose : false, // show close button, optional, default: false
// iOS only, optional
album : '', // optional, default: ''
// duration : podcastInformation.duration, // optional, default: 0
duration : 0, // optional, default: 0
elapsed : 0, // optional, default: 0
hasSkipForward : false, //optional, default: false. true value overrides hasNext.
hasSkipBackward : false, //optional, default: false. true value overrides hasPrev.
skipForwardInterval : 15, //optional. default: 0.
skipBackwardInterval : 15, //optional. default: 0.
hasScrubbing : false, //optional. default to false. Enable scrubbing from control center progress bar
// Android only, optional
// text displayed in the status bar when the notification (and the ticker) are updated
ticker : 'Now playing ' + podcastInformation.title,
});
//Create events for listening
MusicControls.subscribe(this.musicControlEvent);
MusicControls.listen();
},
async musicControlEvent({dispatch, state}, action){
const message = JSON.parse(action).message;
switch(message) {
case 'music-controls-pause':
dispatch('pauseAudio');
break;
case 'music-controls-play':
dispatch('playAudio');
break;
default:
break;
}
},`
I'm first destroying the old created musiccontrol, create a new one and after that i set the listener.
You also see my switch case which needs to be called when we press on the native button.
When i'm testing this code I'm getting the following error:
TypeError: musicControls.updateCallback is not a function. (In 'musicControls.updateCallback(messageFromNative)', 'musicControls.updateCallback' is undefined)
I hope someone can help me out!
The text was updated successfully, but these errors were encountered:
Hi,
I'm creating an application using cordova vue JS together with VueX.
I installed this plugin and everything is working fine, however I was trying to add the play and pause function. In my code i do the following i my VueX storage.
` async createNativeAudioWidget({dispatch, state, commit}){
//Destory old one
MusicControls.destroy();
I'm first destroying the old created musiccontrol, create a new one and after that i set the listener.
You also see my switch case which needs to be called when we press on the native button.
When i'm testing this code I'm getting the following error:
TypeError: musicControls.updateCallback is not a function. (In 'musicControls.updateCallback(messageFromNative)', 'musicControls.updateCallback' is undefined)
I hope someone can help me out!
The text was updated successfully, but these errors were encountered: