[AC-6466] Duration of TiMediaAudioPlayer
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2020-01-07T14:34:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Rainer Schleevoigt |
Assignee | Shak Hossain |
Created | 2020-01-06T19:06:54.000+0000 |
Updated | 2020-01-07T14:34:02.000+0000 |
Description
Use case:
The user want play a remote source (i.e. HLS).
First the user starts the downloader. The length of piece is 30 min. (for example)
After 10 sec (100 sec are downloaded) the player will started. After 100 sec. the player ends playing with regular completed event. Why? the player "thinks" at the time of starting that the file is 100 sec. long (this is the length at time of start).
I think this is false behaviour. How can I fix?
Here the dowloader:
https://github.com/AppWerft/Ti.FFmpeg
var FFmpeg = require('ti.ffmpeg')
const URL = "https://dradiohls-vh.akamaihd.net/i/2020/01/03/eine_musik_worueber_die_welt_erstaunen_soll_von_der_drk_20200103_2230_e87b80e8.mp4/master.m3u8");
const hlsClient = FFmpeg.createHLSClient();
const onProgess = (p) => {
if (p.time > 10) { // 10 sec. buffer time
hlsClient.removeEventListener("onProgress",onProgress);
const Player = Ti.Media.createAudioPlayer();
Player.url = event.localfile;
Player.start(); // stops after 100 sec, if download speed is 10x
}
};
hlsClient.setInput(URL).setFile(Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'drw','worueber_die_welt_erstaunen_soll_von_der_.mp3');
// callback as observer:
hlsClient.addEventListener("onProgress",onProgress);
hlsClient.execute();
I found a dirty solution: oncomplete event I'm looking in the downloader and if I see the file is longer, than I restart the player at the same position. - stop - release - seeking - setting url - start You can close. Better would be a possibility to set the duration of player