Skip navigation
Currently Being Moderated

Adding Video to Mobile Air project using Flash Builder 4.6/4.7

Dec 24, 2013 7:45 AM

Tags: #video #flex #osmf #osmf_player

I'm trying to add video to my mobile Air project using Flash Builder.  I'm reading some tutorials on OSMF and have gotten up to the point where it seems like the video loads and plays (I can here the audio) but the video is not viewable. In the tutorial I'm reading, they add a MediaPlayer object to the stage using the addChild() method. This does not seem to work for a mobile project though. I get an error whenever using addChild() on a view within my application.

 

So is there a different way to add this MediaPlayer object for a mobile application?   So far here is what I have, which gets at least the audio to play...

 

                                        var urlResource:URLResource = new URLResource("http://...);

 

  var video:VideoElement = new VideoElement();

 

  var player:MediaPlayer = new MediaPlayer();

 

  video.resource = urlResource;

     

  player.autoPlay = false;

 

                                        player.addEventListener(MediaPlayerCapabilityChan geEvent.CAN_PLAY_CHANGE, canPlay);

 

                                        player.media = video;

   

  

                                        function canPlay(e:MediaPlayerCapabilityChangeEvent):void

                                        {

                                                       trace("Can Play");

 

                                                       player.play();

                                        }

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points