简体   繁体   English

swf在flv视频中寻找下一个提示点时如何显示加载消息?

[英]how to display loading message as swf seeks next cuepoint in flv video?

I am building a SWF interface that plays specific segments of FLV videos on demand. 我正在构建一个SWF界面,可按需播放FLV视频的特定片段。 When the user clicks on a specific button, the playhead goes to a predefined startValue. 当用户单击特定按钮时,播放头将转到预定义的startValue。

vid1.playheadTime = startValue;
vid1.play();

This works fine, but sometimes it takes a long time for the video to go to the startValue, and I want to display a "Loading, please wait" message while this happens. 这可以正常工作,但有时视频需要很长时间才能进入startValue,并且在发生这种情况时我想显示“正在加载,请稍候”消息。

I tried using timers to check the current time of the playhead, and display a message (contained in loading_mc movieclip) if it is different from the playheadTime. 我尝试使用计时器检查播放头的当前时间,并显示一条消息(包含在loading_mc movieclip中),如果它与playheadTime不同。

var myTimer:Timer = new Timer(100);
myTimer.addEventListener(TimerEvent.TIMER, video_ready);
myTimer.start();

function video_ready (e:TimerEvent):void{
    if (vid1.playheadTime != startValue){
      loading_mc.visible = true;
}
else { 
      myTimer.stop();
      vid1.play();
      loading_mc.visible = false;
} 

This works perfectly if I test it within Flash, but when tested in a browser, it often causes the SWF player to crash or, sometimes, the loading_mc clip does not go away. 如果我在Flash中对其进行测试,则此方法非常理想,但是在浏览器中进行测试时,它通常会导致SWF播放器崩溃,或者有时候,loading_mc剪辑不会消失。 I also believe this might not be the most elegant solution. 我也相信这可能不是最优雅的解决方案。 Any thoughts on an alternative way to deal with this? 对解决此问题的其他方式有何想法?

Thanks a lot. 非常感谢。

Just in case anyone stumbles upon a similar problem: 以防万一有人偶然发现类似的问题:

I found out the problem was in the format of the video, which prevented the player from seeking correctly through the video and wanted to fully load it before it could perform any seek functions. 我发现问题出在视频格式上,这阻止了播放器正确搜索视频,并希望在执行任何搜索功能之前将其完全加载。 I converted the video to F4V and then the code above worked just fine. 我将视频转换为F4V,然后上面的代码运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM