mediaelement.js - 如何隐藏音频控件?
我正在尝试将 Mediaelement.js 实现到视频和音频网站中,视频运行良好,但我需要做的是隐藏音频元素,这样它根本不会显示在页面上,并且 MEJS 音频控件酒吧不可见。音频的播放将通过根据需要播放/暂停音频的函数来处理。
我尝试过更改 CSS 并更改音频代码以包含“hidden=true”,当前音频块如下所示:
<audio id="Audio101" hidden="true">
<source src="audio/audio1.mp3" />
<source src="audio/audio1.ogg" />
<embed src="audio/audio1.mp3" hidden=true autostart=false loop=false>
</audio>
有谁知道如何仅隐藏音频(而不是视频)MEJS 控件?
干杯。
I am trying to implement Mediaelement.js into a site for both video and audio, the video is all working great however what I need to do is hide the audio element so it does not show on the page at all and that the MEJS audio control bar isnt visible. Playback for the audio will be handled through a function to play/pause the audio as needed.
Ive tried altering the CSS and also changing the audio code to include "hidden=true" currently the audio blocks look like this:
<audio id="Audio101" hidden="true">
<source src="audio/audio1.mp3" />
<source src="audio/audio1.ogg" />
<embed src="audio/audio1.mp3" hidden=true autostart=false loop=false>
</audio>
Does anyone know how to hide only the Audio (not Video) MEJS controls?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以指定使用“features”参数显示的播放器控件。此示例仅显示音量控制并将播放器设置为该按钮的大小。
可用的“功能”是:
根本不显示控件:
You can specify the player controls that are displayed with the 'features' parameter. This example shows only the volume control and sets the player to the size of just that button.
The 'features' available are:
To show no controls at all:
您可以实例化一个
MediaElement
而不是一个完整的MediaElementPlayer
:然后您可以像这样播放/暂停:
You can instantiate a
MediaElement
instead of a full fledgedMediaElementPlayer
:You can then play/pause like this:
它有点脏,但这似乎有效:
it's a bit dirty, but this seems to work:
您还可以使用 JQuery 显示/隐藏控件:
将其添加到 css:
然后在 javascript 中使用它:
显示 -
$('.mejs-container .mejs-control').css('display','block');
隐藏 -
$('.mejs-container .mejs-control').css('display','none');
Also you can use JQuery to show/hide controls:
Add this to the css:
Then use this in javascript:
Show -
$('.mejs-container .mejs-control').css('display','block');
Hide -
$('.mejs-container .mejs-control').css('display','none');
MediaElement.js version 4.2.*
播放器支持名为 hideControls() 的 API,因此您可以这样做:
这样,播放器将隐藏控件,但播放器框仍然保留。
隐藏玩家框的其他技巧。你可以这样做:
请看例子:
MediaElement.js version 4.2.*
The player support API called hideControls(), so you can do like:
In this way, the player will hide the control but player box is still remain.
Other trick to hide the player box. you can do like:
Please see the example: