如何使用FlvPlayBack回放和直播视频?
我希望它自动检测是否有直播视频,然后播放直播;否则播放。
怎样才能做到这一点呢?
I want it to automatically detect if there's a live video,then play live;otherwise play back.
How to do it that way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
礼貌地询问服务员?
(不,这是实际的答案)
编辑:我的意思是(因为有人显然不明白)在服务器上保留一个变量,例如isLive,它将根据关于某物是否存在。然后,在开始传输任何内容之前,请在客户端中进行检查(可能使用简单的 HTTP 请求)。如果有东西正在直播,则再次发送 HTTP 请求,例如“liveStream.php”,如果没有则“some-other-video.flv”...
此外,如果没有东西正在直播,但仍会发送对 liveStream.php 的请求,只需传输“离线媒体”之类的内容即可。
为了确保实时流自动关闭(在客户端),请定期检查 isLive 变量(例如 10 秒间隔),或者(如果您有 FMS,或任何真正与 OSMF 配合使用的东西)使用可以以 FLV 格式沿着 A/V 传输的元数据。
Politely ask the server?
(no that is the actual answer)
EDIT: I MEANT (as someone apparently does not understand) to keep a variable on the server, like isLive, which will be changed based on if something IS live or not. Then, before you start to stream anything, check for that in the client, maybe using a simple HTTP request. If something is live, again, HTTP request for something like "liveStream.php", if not then "some-other-video.flv"...
Also, if nothing is live, but the request for liveStream.php is still sent, just transmit something like "media offline" or whatever.
To ensure the live stream automatically turns off (in client), either check for the isLive variable periodically (like 10 second interval), or (IF you have got FMS, or anything that works with OSMF really) use the metadata that can be transmitted along A/V in FLV format.
目前,无法检测流是否实时。您需要将某种元数据传递到播放器中(如 Aurel300 建议的那样)。
-安德里安
Currently, there is no way to detect if a stream is live or not. You need some kind of metadata passed into the player (like Aurel300 suggested).
-Andrian