Media Element Js 视频播放器无法正常播放
早上好,
我尝试使用 mediaelementjs 视频播放器。 我的 html:
<video id="player" width="758px" height="400px" controls="controls" autoplay preload="auto">
<source type="video/flv" src="media/demo.flv" />
</video>
Javascript:
var player = new MediaElementPlayer("#player",{
success: function (mediaElement, domObject) {
// call the play method
mediaElement.play();
}
});
我收到此错误:
Uncaught TypeError: Object #<HTMLEmbedElement> has no method 'pauseMedia'
mejs.PluginMediaElement.pausemediaelement-and-player.min.js:28
mejs.MediaElementPlayer.pausemediaelement-and-player.min.js:94
mejs.MediaElementPlayer.meReadymediaelement-and-player.min.js:85
mejs.PluginMediaElement.dispatchEventmediaelement-and-player.min.js:32
mejs.MediaPluginBridge.fireEventmediaelement-and-player.min.js:34
(anonymous function)
出了什么问题?
你能帮我吗?
似乎是这样的:
pause: function () {
if (this.pluginApi != null) {
if (this.pluginType == 'youtube') {
this.pluginApi.pauseVideo();
} else {
this.pluginApi.pauseMedia();
}
this.paused = true;
}
},
更新 我尝试:
var player = new MediaElementPlayer("#player");
player.play();
我没有收到错误,但它不播放。
Good morning,
I try work with mediaelementjs video player.
My html:
<video id="player" width="758px" height="400px" controls="controls" autoplay preload="auto">
<source type="video/flv" src="media/demo.flv" />
</video>
Javascript:
var player = new MediaElementPlayer("#player",{
success: function (mediaElement, domObject) {
// call the play method
mediaElement.play();
}
});
I obtain this error:
Uncaught TypeError: Object #<HTMLEmbedElement> has no method 'pauseMedia'
mejs.PluginMediaElement.pausemediaelement-and-player.min.js:28
mejs.MediaElementPlayer.pausemediaelement-and-player.min.js:94
mejs.MediaElementPlayer.meReadymediaelement-and-player.min.js:85
mejs.PluginMediaElement.dispatchEventmediaelement-and-player.min.js:32
mejs.MediaPluginBridge.fireEventmediaelement-and-player.min.js:34
(anonymous function)
What's wrong?
Can you help me please?
Seems it call this:
pause: function () {
if (this.pluginApi != null) {
if (this.pluginType == 'youtube') {
this.pluginApi.pauseVideo();
} else {
this.pluginApi.pauseMedia();
}
this.paused = true;
}
},
Update
I try:
var player = new MediaElementPlayer("#player");
player.play();
I dont' obtain error but it doesn't play.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用这个:
HTML:
I`m using this:
HTML:
至于我从远处可以看出,我认为 MediaElementPlayer 需要一个 mediaElement.pause();
我从 mediaElementjs.com 找到了这个:
也许尝试设置暂停();并看看它给出了什么错误。
As for what I can tell from a far I think that the MediaElementPlayer needs a mediaElement.pause();
I've found this from mediaElementjs.com:
Maybe try to set the pause(); and see what errors it gives.
试试这个:
或者这个:
try this:
or this: