简体   繁体   English

是否可以通过JavaScript与嵌入的电影进行互动?

[英]Is it possible to interact with an embed movie via javascript?

I am embedding a movie in a web page with the embed tag, but I would like to interact and be interacted via javascript with the embedded movie in .mov. 我正在使用embed标签将电影嵌入网页中,但是我想通过javascript与.mov中的嵌入电影进行交互。 In particular, I would like to get the timings so I can perform actions on the web pages when a particular moment in the movie is reached (like adding subtitles or karaoke effects in the page as the movie plays). 特别是,我想获得时间,以便在到达电影中的特定时刻时可以在网页上执行操作(例如,在电影播放时在页面中添加字幕或卡拉OK效果)。

Is this possible with standard HTML 4 and javascript, or do I need flash or maybe html 5 ? 标准HTML 4和javascript是否可以实现此功能,或者我是否需要Flash或html 5?

You most certainly can do this, I've done this with MOVs on a major project. 您最肯定可以做到这一点,我已经在大型项目中使用MOV做到了。 Refer to this page for all you need to know. 有关所有您需要了解的内容,请参考此页面

Applies only to embedded flash content - post was made before OP clarified that he was using mov files. 仅适用于嵌入式Flash内容-在OP明确表示他正在使用mov文件之前发布。


Yes it is - provided you have access to the source code of the flash movie. 是的-只要您可以访问Flash电影的源代码即可。 Interaction between Flash movie and the javascript is done through ExternalInterface - check out the call() and addCallback() methods in that page. Flash电影和javascript之间的交互是通过ExternalInterface完成的-在该页面中检出call()addCallback()方法。

As for getting the timings, you can use playheadTime property of the video player control. 至于获取时间,您可以使用视频播放器控件的playheadTime属性。 You might also want to check out the cue points - FLV player dispatches cuePoint events when the play head reaches cue points set at the time of creating the FLV. 您可能还需要检查提示点-当播放头达到创建FLV时设置的提示点时,FLV播放器将调度cuePoint事件

You can Listen to these events and call appropriate javascript functions using ExternalInterface . 您可以使用ExternalInterface收听这些事件并调用适当的javascript函数。

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

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