apache / apache/cordova-plugin-media
getDuration returns a big number like 316000 and I can't kill the media file anywhere I still bloqued.
- Dominant language
- JavaScript
- Stars
- 391
- Forks
- 762
- PR merge metrics
- No merged PRs in 30d
Description
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 free or kill the Media file when it's bloqued in this situation Or is there a Direct Solution for this problem:
**My Function Code:**
```
getDurationAndSetToPlay(index,url){
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(()=> {
self.tracks[index].duration = ~~(self.myTracks[index].getDuration());
if(self.tracks[index].duration > 0) {
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]);
```
My Local URL is like:
`let urlLocal = this.file.externalRootDirectory+"MyProject/Folder1/Folder2/audioFile.mp3";`
The Last Tracks after the 30 first Tracks are All bloqued at status code = 2 but doesn't play really and their duration still big number 316578 ..
Please Help Me I have to provide an App which supports 100 tracks (local files)
Contributor guide
Research direction
Start by reproducing the issue through getDurationAndSetToPlay, media.create(), getDuration(), and stop() while loading more than 30 local files on Android 5.0/5.1. Done means all requested tracks avoid the blocked status and report valid durations, including a 100-track test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100