Advertisement
Guest User

videoplayer.js

a guest
Apr 2nd, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. try {
  3.     if(Ti.App.Properties.getString('device') == 'android') {
  4.         exports.player = Ti.UI.createWindow();
  5.     } else {
  6.         exports.player = Ti.UI.createView();
  7.     }
  8.  
  9.     var contentURL = 'http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov';
  10.     if(Ti.Platform.name == 'android') {
  11.         //contentURL = "http://c0222252.cdn.cloudfiles.rackspacecloud.com/0032_MotoBlur.m4v";
  12.     }
  13.     exports.getstate = function() {
  14.  
  15.         return activeMovie.getPlaybackState();
  16.     };
  17.     var activeMovie = Titanium.Media.createVideoPlayer({
  18.         contentURL : contentURL,
  19.         backgroundColor : '#111',
  20.         movieControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
  21.         //scalingMode : Titanium.Media.VIDEO_SCALING_MODE_FILL,
  22.         scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
  23.         autoplay : false
  24.        
  25.     });
  26.  
  27.     if(parseFloat(Titanium.Platform.version) >= 3.2) {
  28.         exports.player.add(activeMovie);
  29.     }
  30.  
  31.     exports.player.add(activeMovie);
  32.  
  33.     exports.playvideo = function(url) {
  34.         activeMovie.stop();
  35.         activeMovie.url = url;
  36.         activeMovie.play();
  37.     };
  38.  
  39.     exports.setfullscreen = function(bValue) {
  40.         if(Ti.App.Properties.getString('device') !== 'android') {
  41.             activeMovie.setFullscreen(bValue);
  42.         }
  43.     };
  44. } catch(ex) {
  45.     functions.logError(ex);
  46. }
  47. activeMovie.play();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement