Titanium Android videoPlayer加载,有endPlaybackTime,只是不会播放

时间:2013-11-28 14:46:02

标签: android video titanium

我正在尝试在Android上播放视频并遇到一些奇怪的问题,我已将我的代码剥离回以下内容,尝试将其与我应用中其他地方的任何视图问题分开... 该文件似乎正在加载,以下注释是控制台日志,它显示它具有视频文件大小和可播放持续时间。但是,播放控件显示0长度,只有黑屏。视频是一个mp4,它播放得很好,我只能假设我试过的模拟器/设备支持格式并且它没有损坏,因为它们能够读取它的持续时间......还有什么可以阻止它播放? !

var file = Ti.Filesystem.getFile('file:///data/data/com.app.applite/app_appdata/master/D9E3BC7A_225C_458B_B298_C4.mp4');
console.log('Size: '+file.size); // Size: 269245

var activeMovie = Titanium.Media.createVideoPlayer({
    url : file.nativePath,
    backgroundColor : 'blue',
    movieControlMode : Titanium.Media.VIDEO_CONTROL_FULLSCREEN,
    scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
    fullscreen : true,
    autoplay : true
});

activeMovie.addEventListener('loadstate', function(evt) {
    console.log( JSON.stringify(evt));
    // "playableDuration":8315 Correct duration!!!
    // {"type":"loadstate","source":{"autoplay":true,"currentPlaybackTime":0,"bubbleParent":true,"playableDuration":8315,"rect":{"height":854,"y":0,"x":0,"width":480},"keepSc    reenOn":false,"url":"file:///data/data/com.app.applite/app_appdata/master/D9E3BC7A_225C_458B_B298_C4.mp4","size":{"height":854,"y":0,"width":480,"x":0},"volume":1,"    endPlaybackTime":8315,"backgroundColor":"blue","playing":true,"playbackState":1,"mediaControlStyle":2,"duration":8315,"movieControlMode":2,"scalingMode":2,"initialPlaybac    kTime":0,"loadState":1,"backgroundRepeat":false,"movieControlStyle":2,"children":[],"fullscreen":true,"_events":{"loadstate":{}}},"currentPlaybackTime":0,"loadState":0,"b    ubbles":true,"cancelBubble":false}
    activeMovie.play();
});
// Tried with and without these, makes no difference
activeMovie.show();
activeMovie.play();

0 个答案:

没有答案