Created
September 16, 2011 17:04
-
-
Save jonalter/1222557 to your computer and use it in GitHub Desktop.
iOS: using videoPlayer to play remote content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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