是否可以在没有播放器的情况下一致地为 MediaElement.js 换肤?
如果我只调用 MediaElement 而不是 MediaElementPlayer,我仍然可以仅使用 CSS 来为 HTML 和 Flash 播放器设置皮肤吗?或者我必须修改实际的 FLA 吗?
If I just call MediaElement and not MediaElementPlayer, can I still skin both the HTML and Flash players using only CSS? Or do I have to modify the actual FLA?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以,我做了一些尝试,结果证明是的,这是可能的(有一个问题):控件实际上是相同的 UI,即这一切都是在 HTML/JS 中完成的,而 Flash 实际上根本不读取。您所做的就是使用 MediaElement API 控制 HTML5 和 SWF 播放器。
这并不是立即显而易见的,但为了删除默认的 SWF 控件,您所要做的就是使用 JavaScript 删除
video
的controls
属性(如果已设置) )在调用MediaElement
之前,MediaElement.js 也会智能地排除 SWF 控件。然而,问题是目前有一个错误(我已提交)阻止Flash 播放器不会通过 HTML 进行控制,直到通过其他方式(SWF 控件或直接使用 JS)激活
play()
为止。因此,在解决这个问题之前,它对于生产使用来说是不安全的。So, I did some playing around, and it turns out that yes, it is possible (with a catch): the controls are literally the same UI, i.e. it's all done in HTML/JS which isn't actually read by Flash at all. All you're doing is controlling the HTML5 and SWF players using the MediaElement API.
It wasn't immediately apparent, but in order to remove the default SWF controls, all you have to do is remove the
controls
attribute of yourvideo
with JavaScript (if it's set) before you callMediaElement
, and MediaElement.js will intelligently exclude the SWF controls as well.However, the catch is that there is currently a bug (which I have filed) that prevents the Flash player from being controlled via HTML until
play()
is activated through other means (SWF controls or with JS directly). So until that is fixed it isn't safe for production use.