Created
February 6, 2015 11:25
-
-
Save anonymous/81f8ccdb6978d8da4a71 to your computer and use it in GitHub Desktop.
VideoPlayer issue test case
This file contains 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
// 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