Skip to content

Instantly share code, notes, and snippets.

@srahim
Created December 5, 2012 02:03
Show Gist options
  • Save srahim/4211444 to your computer and use it in GitHub Desktop.
Save srahim/4211444 to your computer and use it in GitHub Desktop.
timob-11864
var win1 = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#fff'
});
var label = Ti.UI.createLabel({
top: 30,
width:100,
height:30,
text: 'start video',
backgroundColor:'white'
});
win1.add(label);
label.addEventListener('click', function(e){
activeMovie = Titanium.Media.createVideoPlayer({
width: 640/4, //if the aspect is not video default, then you'll get an exception
height: 360/4, //if the aspect is not video default, then you'll get an exception
fullscreen: true, //this one must be true, or the video must be resized for the exception
autoplay: false,
url: 'movie.mp4',
backgroundColor:'#000',
movieControlMode:Ti.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Ti.Media.VIDEO_SCALING_ASPECT_FIT
});
win1.add(activeMovie);
activeMovie.addEventListener('complete', function(e){
Ti.API.info('movie finished playing');
if (activeMovie.playing == true) {
Ti.API.info('movie is playing');
activeMovie.stop();
} else {
Ti.API.info('movie is stopped');
}
activeMovie.fullscreen = false;
win1.remove(activeMovie);
Ti.API.info('movie onComplete finished');
});
activeMovie.play();
});
win1.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment