[TIMOB-6742] iOS: Video duration not available on device
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2011-12-17T17:51:58.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Sprint 2011-50 |
Components | iOS |
Labels | n/a |
Reporter | Stephen Tramer |
Assignee | Stephen Tramer |
Created | 2011-12-17T15:59:49.000+0000 |
Updated | 2017-03-03T23:17:20.000+0000 |
Description
Apparently the video duration is not available on device, even after the video begins playing or goes through a thumbnail grab (it may not be available beforehand, due to Apple bugs or other issues).
var win = Titanium.UI.currentWindow;
win.backgroundColor = '#FFFFFF'
var close_button = Titanium.UI.createButton({
title:'Close'
});
win.leftNavButton = close_button;
close_button.addEventListener('click', function(e) {
win.close();
});
var activeMovie = Titanium.Media.createVideoPlayer(
{
url : 'http://c0222252.cdn.cloudfiles.rackspacecloud.com/0032_MotoBlur.m4v',
mediaControlStyle:Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
autoplay : false
});
activeMovie.addEventListener('complete',function()
{
Ti.API.info ("[test_duration.js] Movie completed");
Ti.API.info ("[test_duration.js] duration after playing: " + activeMovie.duration);
});
//win.add(activeMovie);
var selected_video_thumbnail = activeMovie.thumbnailImageAtTime (5, Titanium.Media.VIDEO_TIME_OPTION_NEAREST_KEYFRAME);
Ti.API.info ("[test_duration.js] duration after getting thumbnail: " + activeMovie.duration);
Support ticket: http://support.appcelerator.com/tickets/APP-792614/tickets
Should make a drillbit or KS test available.
Duration cannot be retrieved until the "durationAvailable" event is triggered. Looking into the best way to manually trigger that event now, because there is no guarantee that the duration is valid until that event is received. For large video stored remotely, this could take some time, especially on radio connections.
Tested iPod 4GT / iOS 5.0.1 over WiFi (no WWAN support). Here are the findings: Video does not necessarily have all of its metadata loaded immediately after a request, especially for large remote files. You cannot get the duration until a video specifically says that the duration is available via the "durationAvailable" event. This property is documented, and so this bug is being marked "WON'T FIX" instead of being handled to docs (although the documentation could probably be better). Sample code which displays the MOST CORRECT behavior:
Filed a doc bug (TIMOB-6743) indicating that there may be a lack of useful information available about when certain metadata values are valid.
The 'durationAvailable' event never seems to appear for Android in 1.8.0.1.
Closing ticket.