Can't play live rtmp stream on mobile
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 URL with a recorded file and it played. Can anyone tell me what I've done wrong?
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)
{
super();
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);
}
}
}
