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 2019/01/31 22:05:43 UTC

[GitHub] garalimedkarim opened a new issue #216: getDuration returns a big number like 316000 and I can't kill the media file anywhere I still bloqued.

garalimedkarim opened a new issue #216: getDuration returns a big number like 316000 and I can't kill the media file anywhere I still bloqued.
URL: https://github.com/apache/cordova-plugin-media/issues/216
 
 
   Hi everybody, 
   
   I'm working in Ionic 3 Project and All My current Project is based on this plugin, I get an issue when I try to get the duration for more then 30 local files in Android 5.01 and Android 5.1 ( I have tested only in those 2 devices )
   
   So for test purpose I duplicate the same src local file in 30 tracks, and I try to get their duration all, sometimes it works fine but for more then 30 tracks the last tracks, getDuration() return a big number as 316520, and the Media File still bloqued at this situation:
   
   I'm asking how to kill the Media file when it's bloqued in this situation Or is there a Direct Solution for this problem:
   
   **My Function Code:**
   
   ```
       this.myTracks[index] = this.media.create(url);
       this.myTracks[index].play();
       this.myTracks[index].setVolume(0.0);
       let self = this;
   
       this.tracks[index].get_duration_interval = setInterval(()=> {
         if(self.tracks[index].duration == -1) {
           self.tracks[index].duration = ~~(self.myTracks[index].getDuration());
         } else {
           self.myTracks[index].getCurrentPosition().then((position) => {
             if(position > 0 && position < 20000){
               self.stopPlayRecording(index);
               self.myTracks[index].setVolume(1.0);
               self.myTracks[index].stop();
               self.setRecordingToPlay(index);
               clearInterval(self.tracks[index].get_duration_interval);
             }
           });
         }
       }, 500);
   ```
   
   I'm using a for loop to call this function to get all tracks duration simutaniously:
   ```
   for (let index in urls){
       this.getDurationAndSetToPlay(index,urls[index]);
   ```

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