Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created February 6, 2015 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/81f8ccdb6978d8da4a71 to your computer and use it in GitHub Desktop.
Save anonymous/81f8ccdb6978d8da4a71 to your computer and use it in GitHub Desktop.
VideoPlayer issue test case
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Video Test',
backgroundColor:'#fff'
});
var videoPlayer = Ti.Media.createVideoPlayer({
backgroundColor: "#000",
top: 50,
height: 300,
autoplay: false
});
win1.add(videoPlayer);
var button = Ti.UI.createButton({
top: 380,
title: "Select video from media gallery"
});
win1.add(button);
button.addEventListener("click",function() {
Ti.Media.openPhotoGallery({
success:function(mediaBlob) {
videoPlayer.media = mediaBlob.media;
},
error:function(resp) {
var a = Ti.UI.createAlertDialog({title:'Camera'});
if (resp.code == Ti.Media.NO_CAMERA) {
a.setMessage('Please run this on device');
} else {
a.setMessage('Unexpected error: ' + resp.code);
}
a.show();
},
mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO]
});
});
// open tab group
win1.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment