5 Replies Latest reply on Oct 9, 2011 2:06 AM by Mike_Dobs

    Anything special needed to play a live rtmp stream on Mobile?

    StardusterII Level 1

      I'm trying to play live audio from an rtmp stream on a mobile device (Android) that was built with Flash Builder 4.5.1.  I can hear the stream with a Flex 3 project so I know it's playing.  I also replaced the MediaPlayerExample URL with a link to a recorded file on my server and it played.


      I also seem to recall reading somewhere that the URL request string had to be different on OSMF, do I need to add anything to my path/stream?


      Anyway, can anyone tell me what I need to do to play a live rtmp stream?



      In the View:


      private var instructorMedia:MediaPlayerExample;


      var rtmpPath:String = "rtmp://myServer/eTutor";

      var rtmpSession = "host9938850";


      instructorMedia = new MediaPlayerExample(rtmpPath + "/" + rtmpSession);




      In the Class


      package views
      import flash.display.Sprite;


      import org.osmf.containers.MediaContainer;
      import org.osmf.elements.AudioElement;
      import org.osmf.events.TimeEvent;
      import org.osmf.media.MediaPlayer;
      import org.osmf.media.URLResource;


      public class MediaPlayerExample extends Sprite
        private var mediaPlayer:MediaPlayer;
        public function MediaPlayerExample(URL:String)
         mediaPlayer = new MediaPlayer();
         var audioElement:AudioElement = new AudioElement();
         audioElement.resource = new URLResource(URL);
         mediaPlayer.volume = .7;
         mediaPlayer.addEventListener(TimeEvent.CURRENT_TIME_CHANGE, onTimeUpdated);       
         mediaPlayer.addEventListener(TimeEvent.DURATION_CHANGE, onTimeUpdated);
         mediaPlayer.autoPlay = true;
         mediaPlayer.media = audioElement;   
        private function onTimeUpdated(event:TimeEvent):void
         trace('time: ' + mediaPlayer.currentTime + ' duration: ' + mediaPlayer.duration);