You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/20 21:34:31 UTC

[GitHub] [cordova-plugin-media] HussamBarbour commented on issue #293: Getting status on file loaded

HussamBarbour commented on issue #293:
URL: https://github.com/apache/cordova-plugin-media/issues/293#issuecomment-823614498


   I solved this issue in the following way:
   I added a new method
   
   ```javascript
   async start(url) {
       this.player = this.media.create(url);
       await this.startPlay();
   }
   startPlay() {
       return new Promise((resolve, reject) => {
         let playInterval = setInterval(() => {
           this.player.play({ numberOfLoops: 1, playAudioWhenScreenIsLocked: true });
           this.player.getCurrentPosition().then((position) => {
             if (position > 0) {
               resolve(position);
               clearInterval(playInterval);
             }
           });
         }, 2000);
       })
   }
   ```
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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