You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/12/21 17:37:21 UTC

[GitHub] lolaswift opened a new issue #210: How to release() properly

lolaswift opened a new issue #210: How to release() properly
URL: https://github.com/apache/cordova-plugin-media/issues/210
 
 
   Many thanks for the wonderful plugin. I am using it in many ionic 3 projects and it works great! However, I am facing some resource release issue and I don't know how to address.
   
   I have a list of song
   
   song1
   song2
   song3
   …
   
   When user tap song1, I play song1.mp3. If user tap song2 before song1 finishes, I’d like to stop song 1 and start playing song2. My question is how to do it without memory leaking.
   
   I tried:
   
   play(song) {
   
   const file: MediaObject = this.media.create('song');
   
   // to listen to plugin events:
   
   file.onStatusUpdate.subscribe(status => console.log(status)); // fires when file status changes
   
   file.onSuccess.subscribe(() => console.log('Action is successful'));
   
   file.onError.subscribe(error => console.log('Error!', error));
   
   // play the file
   file.play();
   
   }
   
   I don’t know how to stop and release the previous song. Can anyone help?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org