tempo-riz commented on issue #358:
URL: 
https://github.com/apache/cordova-plugin-media/issues/358#issuecomment-1420435324

   @ghenry22 Hey I finally made it work for m4a files (default for ios and 
android if I remember), this is the code I used hope it helps
   `
   mediaPlayer = new Media(src,
           // success callback
           () => {
               console.log('succes callback')
           },
           // error callback
           (err) => {
               console.log(err)
           },
           (status_codes) => {
               console.log(status_codes)
               if (status_codes == Media.MEDIA_STARTING || status_codes == 
Media.MEDIA_RUNNING) {
                   getMediaPlayerDuration().then(dur => {
                       duration = dur;
                   })
               }
           }
       );
   
    //play trigger Media.MEDIA_STARTING and seekto trigger Media.MEDIA_RUNNING 
(android)
       //only play trigger Media.MEDIA_RUNNING (ios)
       setTimeout(()=>mediaPlayer.play(), 500); //timeout to avoid crash ios
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to