Flex: Multi bitrate switching between live streams using the VideoDisplay component
I am passing to the source property of a VideoDisplay component a DynamicStreamingVideoSource object with 3 different dynamic live stream items, described by this XML, for your consideration:
src="rtmp://88.87.56.214:1935/live/fashiontv_tmo_h.stream" bitrate="19200"
src="rtmp://88.87.56.214:1935/live/fashiontv_tmo_m.stream" bitrate="9000"
src="rtmp://88.87.56.214:1935/live/fashiontv_tmo_l.stream" bitrate="3600"
But the play开发者_Python百科er then runs the stream with the lowest bitrate, out of those 3. Wasn't it supposed to go for the stream with the highest bitrate, that is viewable by the end-user? All 3 streams have been individually tested and they are all viewable.
Thanks, Liviu
I fixed it!!!
I know this reply is 5.5 years later, but this could still help someone. I had the same problem and was able to fix it after hours and hours of searching for an answer. All you need is to have a non-zero value for the buffer in the media player.
Examples:
Using Spark VideoDisplay:
<s:VideoDisplay id="rtmpABRVideo" width="320" height="240" initialize="rtmpABRVideo.mx_internal::videoPlayer.bufferTime=2">
<s:DynamicStreamingVideoSource host="rtmp://localhost:1935/live" streamType="live">
<s:DynamicStreamingVideoItem streamName="webcam_1000" bitrate="1000" />
<s:DynamicStreamingVideoItem streamName="webcam_500" bitrate="500" />
<s:DynamicStreamingVideoItem streamName="webcam_150" bitrate="150" />
</s:DynamicStreamingVideoSource>
</s:VideoDisplay>
Using OSMF Components:
var dynResource:DynamicStreamingResource = new DynamicStreamingResource('rtmp://localhost/live');
dynResource.urlIncludesFMSApplicationInstance = false;
dynResource.streamItems = Vector.<DynamicStreamingItem>([
new DynamicStreamingItem("mp4:webcam_150", 150, 320, 240),
new DynamicStreamingItem("mp4:webcam_500", 500, 320, 240),
new DynamicStreamingItem("mp4:webcam_1000", 1000, 320, 240)
]);
var videoElement:VideoElement = new VideoElement();
videoElement.resource = dynResource;
var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
mediaPlayerSprite.width = 320;
mediaPlayerSprite.height = 240;
mediaPlayerSprite.media = videoElement;
mediaPlayerSprite.mediaPlayer.bufferTime = 2;
addChild(mediaPlayerSprite);
Hope this was helpful for someone out there!
I was pretty sure the VideoDisplay component will display whatever source URL you send it. Without seeing code, I'm not sure what is going on.
If you want to display a different bitrate stream you'll have to tell the VideoDisplay component to switch the URL. If you want to do some automatic bitrate switching "on the fly" I believe that has to be done at the server, not the client.
I have posted a post on my blog with some source code that is very easy to understand a while back.
check it out here
精彩评论