Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android videoPlayer, loads, has endPlaybackTime, just won't play

$
0
0

I'm trying to play a video on Android and having some weird issues, I've stripped my code right back to the following to try and separate it from any view issues elsewhere in my app...

the file does seems to be loading, the following comments are the console log which shows it has the video file size and playable duration. However, the playback controls show 0 length, and just a black screen. The video is an mp4, it plays fine, I can only assume the emulator/devices I've tried this on support the format and it's not corrupt, as they are able to read it's duration... what else could stop it playing?!

var file = Ti.Filesystem.getFile('file:///data/data/com.miituu.miituulite/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 !!!!!
    // {"type":"loadstate","source":{"autoplay":true,"currentPlaybackTime":0,"bubbleParent":true,"playableDuration":8315,"rect":{"height":854,"y":0,"x":0,"width":480},"keepScreenOn":false,"url":"file:///data/data/com.miituu.miituulite/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,"initialPlaybackTime":0,"loadState":1,"backgroundRepeat":false,"movieControlStyle":2,"children":[],"fullscreen":true,"_events":{"loadstate":{}}},"currentPlaybackTime":0,"loadState":0,"bubbles":true,"cancelBubble":false}
    activeMovie.play();
});
// Tried with and without these, makes no difference
activeMovie.show();
activeMovie.play();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>