Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created September 16, 2011 17:04
Show Gist options
  • Select an option

  • Save jonalter/1222557 to your computer and use it in GitHub Desktop.

Select an option

Save jonalter/1222557 to your computer and use it in GitHub Desktop.
iOS: using videoPlayer to play remote content
var win = Ti.UI.createWindow({
backgroundColor : 'black',
orientationModes : [Ti.UI.PORTRAIT]
});
win.open();
var activeVideo = Titanium.Media.createVideoPlayer({
top : 0,
height : 200
});
win.add(activeVideo);
var data = [{
title : "video 1",
contentURL : "http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov"
}, {
title : "video 2",
contentURL : "http://c0222252.cdn.cloudfiles.rackspacecloud.com/0032_MotoBlur.m4v"
}];
var tableView = Ti.UI.createTableView({
top : 200,
data : data
});
win.add(tableView);
tableView.addEventListener('click', function(e) {
activeVideo.setUrl(e.rowData.contentURL);
activeVideo.play();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment