我修好了它!!!
我知道这个回复是 5.5 年后,但这仍然可以帮助某人。我遇到了同样的问题,经过数小时的寻找答案后,我得以解决。您只需要为媒体播放器中的缓冲区设置一个非零值。
例子:
使用 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>
使用 OSMF 组件:
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);
希望这对那里的人有帮助!