Flex:使用 VideoDisplay 组件在直播流之间进行多比特率切换

发布于 2024-09-10 12:12:11 字数 449 浏览 7 评论 0原文

我将一个 DynamicStreamingVideoSource 对象传递给 VideoDisplay 组件的源属性,该对象包含 3 个不同的动态直播流项目,由以下 XML 描述,供您考虑:

src="rtmp://88.87.56.214:1935/live/fashiontv_tmo_h .stream”比特率=“19200” src =“rtmp://88.87.56.214:1935/live/fashiontv_tmo_m.stream”比特率=“9000” src="rtmp://88.87.56.214:1935/live/fashiontv_tmo_l.stream" bitrate="3600"

但是播放器随后以最低比特率运行流,这三个比特率中的最低比特率。这不是应该的吗寻找最终用户可以观看的最高比特率的流?所有 3 个流均已单独测试并且均可观看。

谢谢, 利维乌

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 player 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

救星 2024-09-17 12:12:11

我修好了!

我知道这个回复是 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);

希望这对那里的人有帮助!

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!

超可爱的懒熊 2024-09-17 12:12:11

我非常确定 VideoDisplay 组件将显示您发送给它的任何源 URL。如果没有看到代码,我不确定发生了什么。

如果您想显示不同的比特率流,您必须告诉 VideoDisplay 组件切换 URL。如果您想“即时”进行一些自动比特率切换,我相信必须在服务器而不是客户端完成。

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.

薄暮涼年 2024-09-17 12:12:11

我不久前在我的博客上发布了一篇文章,其中包含一些非常容易理解的源代码。

请查看此处< /a>

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文