trying use the code to embed audio from yorlisten.com and it’s not working
https://www.anehdidunia.com
https://www.ads-software.com/plugins/media-element-html5-video-and-audio-player/
Hello,
I never install this plugin but I found it in WordPress core when I try to use audio and video shortcode.
How is it possible?
And by the way I really love this plugin. Could you please advise how to add multiple caption? Thank you very much.
Since the code below is only applied for one language only.
[video src="https://mysite.com/mymedia.mp4" captions="https://mysite.com/mymedia.srt"]
I apologise if this is a dumb or repetitive question, but I’m completely mystified by the upgrade to v4, it doesn’t appear to have a media object, not that I can figure out.
I used the standalone library to build a video player with my own interface and controls, and v2 passed a media object back through the success callback, and that had methods like play() and so on that I could call from my UI.
But v4 doesn’t have that. So where is the media object that the library creates?
]]>Please use plugins_url() instead of WP_PLUGIN_URL, otherwise plugin url is always http in it’s urls.
https://developer.www.ads-software.com/reference/functions/plugins_url/
Thanks.
]]>Hi
is the plugin still supported or is it stone dead?
The plugin has not been updated for over a year now so I think it is fair question to ask. You do not wish to use old code due to the potential security issues that may arise.
Thank you.
Kind regards
AngryWarrior
Hello,
How can achieve to play many mp3 audios one by one automatically in a file?
Please advise.
Thanks in advance!
]]>Hello,
Use this plugin for several years and still working good for the video play. Hope developer to update it to the latest version of WP so I can keep using it. I also plan to use the audio for my newly created post and page. I am willing to make a donation when the program updated.
Thanks in advance!
]]>Hi Devs,
I’try some days ago your plugin for a problem caused by the template (not from the video or plugins), so removed.
Now (after the uninstall) I’ve many “Medialements.js” items get married in the wp directory.
And this cause some problems with the native media manager.
./wp-content/themes/twentyseventeen/assets/css/editor-style.css:.mejs-container
./wp-content/themes/twentyseventeen/assets/css/editor-style.css:.wp-playlist-dark .mejs-container .mejs-controls
./wp-content/themes/twentyseventeen/style.css:.mejs-container
./wp-content/themes/twentyseventeen/style.css:.site-content .wp-playlist-dark .mejs-container .mejs-controls
./wp-includes/css/media-views.css:.mejs-container video
./wp-includes/css/media-views.css:.mejs-container:focus
./wp-includes/css/media-views.min.css: */.ui-draggable-handle....
./wp-includes/css/media-views-rtl.css:.mejs-container:focus
./wp-includes/css/media-views-rtl.css:.mejs-container video
./wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css:.mejs-offscreen
./wp-includes/js/mediaelement/wp-mediaelement.js: .not( '.mejs-container
./wp-includes/js/mediaelement/wp-mediaelement.css:.wp-playlist .mejs-container
./wp-includes/js/mediaelement/wp-mediaelement.css:.mejs-container .mejs-controls
./wp-includes/js/mediaelement/wp-mediaelement.css:.mejs-container
./wp-includes/js/mediaelement/wp-mediaelement.css:.mejs-container
./wp-includes/js/mediaelement/wp-mediaelement.css:.mejs-container
./wp-includes/js/mediaelement/wp-playlist.js: $( '.wp-playlist:not(:has(.mejs-container))
./wp-includes/js/mediaelement/wp-playlist.min.js:!function(a,b,c){"use strict";function d(){a(".wp-playlist:not(:has(.mejs-container......
./wp-includes/js/mediaelement/wp-mediaelement.min.css:.mejs-container{clear:both;max-width:100%}.mejs-container....
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container.mejs-hide-cues video::-webkit-media-text-track-container
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive a,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive a:focus,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive button,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive button:focus,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive [role=slider],
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-keyboard-inactive [role=slider]:focus
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container * {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container video::-webkit-media-controls,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container video::-webkit-media-controls-panel,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container video::-webkit-media-controls-panel-container,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container video::-webkit-media-controls-start-playback-button {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-fill-container .mejs-container {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container:focus {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-fullscreen {
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-fullscreen .mejs-mediaelement,
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css:.mejs-container-fullscreen video
./wp-admin/css/media-rtl.css:.mejs-container {
./wp-includes/js/mediaelement/wp-mediaelement.min.js:!function(a,b){function
./wp-admin/css/media.css:.mejs-container {
./wp-admin/css/media.min.css:.media-item .describe{border-collapse:collapse....
./wp-admin/css/media-rtl.min.css:.media-item .describe{border-collapse:collapse....
and again:
find ./ -iname *mediaelement*
./wp-includes/js/mediaelement
./wp-includes/js/mediaelement/wp-mediaelement.min.js
./wp-includes/js/mediaelement/mediaelementplayer.css
./wp-includes/js/mediaelement/mediaelementplayer-legacy.css
./wp-includes/js/mediaelement/mediaelement-migrate.min.js
./wp-includes/js/mediaelement/mediaelement-migrate.js
./wp-includes/js/mediaelement/mediaelementplayer.min.css
./wp-includes/js/mediaelement/mediaelement.js
./wp-includes/js/mediaelement/mediaelement-and-player.js
./wp-includes/js/mediaelement/mediaelement.min.js
./wp-includes/js/mediaelement/wp-mediaelement.min.css
./wp-includes/js/mediaelement/wp-mediaelement.css
./wp-includes/js/mediaelement/mediaelement-and-player.min.js
./wp-includes/js/mediaelement/wp-mediaelement.js
./wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css
What I could do now?
Many thanks!
Davide
]]>Hi, on mobile, on IOS, the audio player has a huge play button. Only when you zoom in does the player update.
I’m using an old default wordpress theme that I’d like to keep.
Are there updates I can make to the player code to make the play button smaller?
any help is appreciated, thank you.
Mike
]]>I’ve got a video I want to upload & embed in a WP page to promo an event, playing on a loop. However, Chrome requires that any autoplay content be muted (and frankly, it’s a best practice anyway.)
Is there a muted=”true” or equivalent option available as a shortcode in WordPress for this plugin/media player, so that my videos default to muted when the page loads?
Thanks in advance for the help!
]]>Hi to all here!
An online malware scan (at scanner.pcrisk.com) revealed a “potentially suspicious part of a JS file that is part of the mediaelement plugin. Should I worry, is the code OK like this or could it be changed by hacking of my site?
thank you!
this is the malware scan protocol:
/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/v4/mediaelement-and-player.min.js
Severity: Potentially Suspicious
Reason: Detected procedure that is commonly used in suspicious activity.
Details: Too low entropy detected in string [[':;:;0:;000000000:;:;0:;0:;:;:;:;:;00:;00plugin-native:;0:;:;:;:;:;:;:;:;:;:;:;:;00:;0:;000000:;:;:;:']] of length 103 which may point to obfuscation or shellcode.
Threat dump: View code
File size[byte]: 158159
File type: ASCII
MD5: CF5048EB309F9BF7144ADF34D15196C4
Scan duration[sec]: 6.690000
]]>
Hi,
is there a possibility to use the language files for controls / buttons? Labels are only in english so far – I would need german language file.
]]>Wordpress Core is using MediaElementJs
https://codex.www.ads-software.com/Audio_Shortcode
https://codex.www.ads-software.com/Video_Shortcode
What is the difference between this plugin and the shortcodes provided by WordPress Core.
Thanks
]]>I love the built-in audio player in WordPress. However, it’s not clear at all that on mobile devices it yields to the device’s volume controls. No issue with not displaying the audio volume bar, but it also hides the volume button, thus removing the mute function. That’s the issue.
Here’s how I restored the volume button on mobile devices using a filter and MediaElement.js configuration elements.
/*
Override WP's media element to display controls on iOS.
See https://github.com/mediaelement/mediaelement/blob/master/docs/api.md
*/
function my_mejs_settings( $settings ) {
$settings['alwaysShowControls'] = true;
$settings['iPadUseNativeControls'] = true;
$settings['iPhoneUseNativeControls'] = true;
$settings['AndroidUseNativeControls'] = true;
$settings['hideVolumeOnTouchDevices'] = false;
return $settings;
}
add_filter( 'mejs_settings', 'my_mejs_settings' );
]]>
I just installed to play an MP3 stream, which plays fine with the native HTML 5 player, but does not play with this plugin. I get many notices of undefined variables:
Notice: Undefined variable: src_attribute in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 410
Notice: Undefined variable: mp4_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 411
Notice: Undefined variable: mp3_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 412
Notice: Undefined variable: webm_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 413
Notice: Undefined variable: flv_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 414
Notice: Undefined variable: wmv_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 415
Notice: Undefined variable: ogg_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 416
Notice: Undefined variable: captions_source in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 417
Notice: Undefined variable: loop_option in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 423
Notice: Undefined variable: mediahtml in \media-element-html5-video-and-audio-player\mediaelement-js-wp.php on line 429
I was able to fix the undefined variables by initializing with with null, but it still does not play.
]]>What is the max video size that can be added to website with MP4 format so that it loads fast on the page? Thanks
]]>I have multiple players in iFrames. All works well, except for the full screen button. Would a target=”_parent” do the trick, or is there a better way to handle this?
The function called is:
fullscreenBtn.addEventListener('click', function () {
var isFullScreen = Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || player.isFullScreen;
if (isFullScreen) {
player.exitFullScreen();
} else {
player.enterFullScreen();
}
enterFullScreen: function enterFullScreen() {
var t = this,
isNative = t.media.rendererName !== null && /(html5|native)/i.test(t.media.rendererName),
containerStyles = getComputedStyle(t.getElement(t.container));
if (!t.isVideo) {
return;
}
if (t.options.useFakeFullscreen === false && Features.IS_IOS && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) {
t.media.originalNode.webkitEnterFullscreen();
return;
}
(0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen');
(0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen');
t.normalHeight = parseFloat(containerStyles.height);
t.normalWidth = parseFloat(containerStyles.width);
if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') {
Features.requestFullScreen(t.getElement(t.container));
if (t.isInIframe) {
setTimeout(function checkFullscreen() {
if (t.isNativeFullScreen) {
var percentErrorMargin = 0.002,
windowWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth,
screenWidth = screen.width,
absDiff = Math.abs(screenWidth - windowWidth),
marginError = screenWidth * percentErrorMargin;
if (absDiff > marginError) {
t.exitFullScreen();
} else {
setTimeout(checkFullscreen, 500);
}
}
}, 1000);
}
}
t.getElement(t.container).style.width = '100%';
t.getElement(t.container).style.height = '100%';
t.containerSizeTimeout = setTimeout(function () {
t.getElement(t.container).style.width = '100%';
t.getElement(t.container).style.height = '100%';
t.setControlsSize();
}, 500);
if (isNative) {
t.node.style.width = '100%';
t.node.style.height = '100%';
} else {
var elements = t.getElement(t.container).querySelectorAll('embed, object, video'),
_total = elements.length;
for (var i = 0; i < _total; i++) {
elements[i].style.width = '100%';
elements[i].style.height = '100%';
}
}
if (t.options.setDimensions && typeof t.media.setSize === 'function') {
t.media.setSize(screen.width, screen.height);
}
var layers = t.getElement(t.layers).children,
total = layers.length;
for (var _i = 0; _i < total; _i++) {
layers[_i].style.width = '100%';
layers[_i].style.height = '100%';
}
if (t.fullscreenBtn) {
(0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen');
(0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen');
}
t.setControlsSize();
t.isFullScreen = true;
var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height),
captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text');
if (captionText) {
captionText.style.fontSize = zoomFactor * 100 + '%';
captionText.style.lineHeight = 'normal';
t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = (screen.height - t.normalHeight) / 2 - t.getElement(t.controls).offsetHeight / 2 + zoomFactor + 15 + 'px';
}
var event = (0, _general.createEvent)('enteredfullscreen', t.getElement(t.container));
t.getElement(t.container).dispatchEvent(event);
},
]]>
Hello guys,
On my site I create phrases in English and create audios from each of these phrases for users to hear how to speak in English.
The default WP audio bar is too large. I wanted something more discreet like a little play.
So I wanted to put a small image in front of each of these sentences, but I wanted it to be a simple process to put without having to deal with shortcode since the authors of the posts will not understand how to do this, besides taking a long time to stay placing shortcode by shortcode.
Can I do this with your plugin?
Thanks
]]>This would not play in the current version of Chrome. This is version specific. Apparently, Chrome is working on this policy, but at the moment it will not autoplay videos that have sound. I updated the shortcode to add the parameter muted=”true” and that fixed the problem (I actually wanted it to play muted anyway so this might not be the right solution for you but it’s still good to have that option)
Here is the updated main mediaelement-js-wp.php file:
<?php
/**
* @package MediaElementJS
* @version 4.2.8
*/
/*
Plugin Name: MediaElement.js - HTML5 Audio and Video
Plugin URI: https://mediaelementjs.com/
Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media in your post or page using HTML5 with Flash or Silverlight fallback support for non-HTML5 browsers. Video support: MP4, Ogg, WebM, WMV. Audio support: MP3, WMA, WAV
Author: John Dyer
Version: 4.2.8
Author URI: https://j.hn/
License: MIT
*/
/*
Adapted from: https://videojs.com/ plugin
*/
$mediaElementPlayerIndex = 1;
/* Runs when plugin is activated */
register_activation_hook(__FILE__,'mejs_install');
function mejs_install() {
add_option('mep_video_skin', '');
add_option('mep_default_video_height', 270);
add_option('mep_default_video_width', 480);
add_option('mep_default_video_type', '');
add_option('mep_default_audio_height', 30);
add_option('mep_default_audio_width', 400);
add_option('mep_default_audio_type', '');
}
/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'mejs_remove' );
function mejs_remove() {
delete_option('mep_video_skin');
delete_option('mep_default_video_height');
delete_option('mep_default_video_width');
delete_option('mep_default_video_type');
delete_option('mep_default_audio_height');
delete_option('mep_default_audio_width');
delete_option('mep_default_audio_type');
}
// create custom plugin settings menu
add_action('admin_menu', 'mejs_create_menu');
function mejs_create_menu() {
//create new top-level menu
add_options_page('MediaElement.js', 'MediaElement.js', 'administrator', __FILE__, 'mejs_settings_page');
//call register settings function
add_action( 'admin_init', 'mejs_register_settings' );
}
function mejs_register_settings() {
//register our settings
register_setting( 'mep_settings', 'mep_default_video_height' );
register_setting( 'mep_settings', 'mep_default_video_width' );
register_setting( 'mep_settings', 'mep_default_video_type' );
register_setting( 'mep_settings', 'mep_default_audio_height' );
register_setting( 'mep_settings', 'mep_default_audio_width' );
register_setting( 'mep_settings', 'mep_default_audio_type' );
}
function mejs_settings_page() {
?>
<div class="wrap">
<h2>MediaElement.js HTML5 Player Options</h2>
<p>See <a href="https://mediaelementjs.com/">MediaElementjs.com</a> for more details on how the HTML5 player and Flash fallbacks work.</p>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<h3 class="title"><span>Video Settings</span></h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<label for="mep_default_video_width">Default Width</label>
</th>
<td >
<input name="mep_default_video_width" type="text" id="mep_default_video_width" value="<?php echo get_option('mep_default_video_width'); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="mep_default_video_height">Default Height</label>
</th>
<td >
<input name="mep_default_video_height" type="text" id="mep_default_video_height" value="<?php echo get_option('mep_default_video_height'); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="mep_default_video_type">Default Type</label>
</th>
<td >
<input name="mep_default_video_type" type="text" id="mep_default_video_type" value="<?php echo get_option('mep_default_video_type'); ?>" /> <span class="description">such as "video/mp4"</span>
</td>
</tr>
</table>
<h3 class="title"><span>Audio Settings</span></h3>
<table class="form-table">
<tr valign="top">
<tr valign="top">
<th scope="row">
<label for="mep_default_audio_width">Default Width</label>
</th>
<td >
<input name="mep_default_audio_width" type="text" id="mep_default_audio_width" value="<?php echo get_option('mep_default_audio_width'); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="mep_default_audio_height">Default Height</label>
</th>
<td >
<input name="mep_default_audio_height" type="text" id="mep_default_audio_height" value="<?php echo get_option('mep_default_audio_height'); ?>" />
</td>
</tr>
<th scope="row">
<label for="mep_default_audio_type">Default Type</label>
</th>
<td >
<input name="mep_default_audio_type" type="text" id="mep_default_audio_type" value="<?php echo get_option('mep_default_audio_type'); ?>" /> <span class="description">such as "audio/mp3"</span>
</td>
</tr>
</table>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type,mep_default_audio_width,mep_default_audio_height,mep_video_skin" />
<p>
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</div>
</form>
</div>
<?php
}
define('MEDIAELEMENTJS_DIR', WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/');
// Javascript
function mejs_add_scripts(){
if (!is_admin()){
// the scripts
wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."v4/mediaelement-and-player.min.js", array(), "4.2.8", false);
}
}
add_action('wp_print_scripts', 'mejs_add_scripts');
// css
function mejs_add_styles(){
if (!is_admin()){
// the style
wp_enqueue_style("mediaelementjs-styles", MEDIAELEMENTJS_DIR ."v4/mediaelementplayer.min.css");
wp_enqueue_style("mediaelementjs-styles-legacy", MEDIAELEMENTJS_DIR ."v4/mediaelementplayer-legacy.min.css");
}
}
add_action('wp_print_styles', 'mejs_add_styles');
function mejs_add_header(){
/*
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
echo <<<_end_
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
_end_;
*/
}
// If this happens in the <head> tag it fails in iOS. Boo.
function mejs_add_footer(){
/*
$defaultVideoWidth = get_option('mep_default_video_width');
$defaultVideoHeight = get_option('mep_default_video_height');
echo <<<_end_
<script type="text/javascript">
jQuery(document).ready(function($) {
$('video[class=mep],audio[class=mep]').mediaelementplayer({defaultVideoWidth:{$defaultVideoWidth},defaultVideoHeight:{$defaultVideoHeight}});
});
</script>
_end_;
*/
}
add_action('wp_head','mejs_add_header');
add_action('wp_footer','mejs_add_footer');
function mejs_media_shortcode($tagName, $atts){
global $mediaElementPlayerIndex;
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
extract(shortcode_atts(array(
'src' => '',
'mp4' => '',
'mp3' => '',
'wmv' => '',
'webm' => '',
'flv' => '',
'ogg' => '',
'poster' => '',
'width' => get_option('mep_default_'.$tagName.'_width'),
'height' => get_option('mep_default_'.$tagName.'_height'),
'type' => get_option('mep_default_'.$tagName.'_type'),
'preload' => 'none',
'autoplay' => '',
'muted' => '',
'loop' => '',
// old ones
'duration' => 'true',
'progress' => 'true',
'fullscreen' => 'true',
'volume' => 'true',
// captions
'captions' => '',
'captionslang' => 'en'
), $atts));
if ($type) {
$type_attribute = 'type="'.$type.'"';
}
/*
if ($src) {
$src_attribute = 'src="'.htmlspecialchars($src).'"';
$flash_src = htmlspecialchars($src);
}
*/
if ($src) {
// does it have an extension?
if (substr($src, strlen($src)-4, 1)=='.') {
$src_attribute = 'src="'.htmlspecialchars($src).'"';
$flash_src = htmlspecialchars($src);
} else {
// for missing extension, we try to find all possible files in the system
if (substr($src, 0, 4)!='http')
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_DIR)-strrpos(WP_CONTENT_DIR, '/'));
else
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_URL));
if ($tagName == 'video') {
// MP4
if (file_exists($filename.'.mp4')) {
$mp4=$src.'.mp4';
} elseif (file_exists($filename.'.m4v')) {
$mp4=$src.'.m4v';
}
// WEBM
if (file_exists($filename.'.webm')) {
$webm=$src.'.webm';
}
// OGG
if (file_exists($filename.'.ogg')) {
$ogg=$src.'.ogg';
} elseif (file_exists($filename.'.ogv')) {
$ogg=$src.'.ogv';
}
// FLV
if (file_exists($filename.'.flv')) {
$flv=$src.'.flv';
}
// WMV
if (file_exists($filename.'.wmv')) {
$wmv=$src.'.wmv';
}
// POSTER
if (file_exists($filename.'.jpg')) {
$poster=$src.'.jpg';
}
} elseif ($tagName == 'audio') {
// MP3
if (file_exists($filename.'.mp3')) {
$mp3=$src.'.mp3';
}
// OGG
if (file_exists($filename.'.ogg')) {
$ogg=$src.'.ogg';
} elseif (file_exists($filename.'.oga')) {
$ogg=$src.'.oga';
}
}
}
}
if ($mp4) {
$mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
$flash_src = htmlspecialchars($mp4);
}
if ($mp3) {
$mp3_source = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
$flash_src = htmlspecialchars($mp3);
}
if ($webm) {
$webm_source = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
}
if ($ogg) {
$ogg_source = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
}
if ($flv) {
$flv_source = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
}
if ($wmv) {
$wmv_source = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
}
if ($captions) {
$captions_source = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
}
if ($width && $tagName == 'video') {
$width_attribute = 'width="'.$width.'"';
}
if ($height && $tagName == 'video') {
$height_attribute = 'height="'.$height.'"';
}
if ($poster) {
$poster_attribute = 'poster="'.htmlspecialchars($poster).'"';
}
if ($preload) {
$preload_attribute = 'preload="'.$preload.'"';
}
if ($autoplay) {
$autoplay_attribute = 'autoplay="'.$autoplay.'"';
}
if ($muted) {
$muted_attribute = 'muted="'.$muted.'"';
}
if ($loop) {
$loop_option = ', loop: ' . $loop;
}
// CONTROLS
$controls_option = ",features: ['playpause'";
if ($progress == 'true')
$controls_option .= ",'current','progress'";
if ($duration == 'true')
$controls_option .= ",'duration'";
if ($volume == 'true')
$controls_option .= ",'volume'";
$controls_option .= ",'tracks'";
if ($fullscreen == 'true')
$controls_option .= ",'fullscreen'";
$controls_option .= "]";
// AUDIO SIZE
$audio_size = '';
if ($tagName == 'audio') {
$audio_size = ',audioWidth:'.$width.',audioHeight:'.$height;
}
// VIDEO class (skin)
$video_skin_attribute = '';
if ($skin != '' && $tagName == 'video') {
$video_skin_attribute = 'class="mejs-'.$skin.'"';
}
$mediahtml .= <<<_end_
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute} {$muted_attribute} $video_skin_attribute>
{$mp4_source}
{$mp3_source}
{$webm_source}
{$flv_source}
{$wmv_source}
{$ogg_source}
{$captions_source}
</{$tagName}>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#wp_mep_$mediaElementPlayerIndex').mediaelementplayer({
m:1
{$loop_option}
{$controls_option}
{$audio_size}
});
});
</script>
_end_;
$mediaElementPlayerIndex++;
return $mediahtml;
}
function mejs_audio_shortcode($atts){
return mejs_media_shortcode('audio',$atts);
}
function mejs_video_shortcode($atts){
return mejs_media_shortcode('video',$atts);
}
add_shortcode('audio', 'mejs_audio_shortcode');
add_shortcode('mejsaudio', 'mejs_audio_shortcode');
add_shortcode('video', 'mejs_video_shortcode');
add_shortcode('mejsvideo', 'mejs_video_shortcode');
function mejs_init() {
}
add_action('init', 'mejs_init');
?>
]]>
Hi, any suggestions for custom CSS to force .mejs to automatically play video fullscreen on mobile? It’s an Android thing, video seems to auto play fullscreen on iOS Safari mobile.
I need a very clean, minimal design for this site. I’ve found how to hide the progress bar and the video will still pause/play when tapping screen:
/* hide progrss bar under video on android */
.mejs-container .mejs-controls { visibility:hidden !important;
}
This is a self-hosted video using the Inspiro theme by WPZOOM.
Thanks!
]]>Upon updating the plugin to v4.2.8 yesterday the video on the home page is skewed to the right. Disabling the plugin removing the issue, and the video, I reverted the plugin back to 2.23.5 on the live site and all works well.
Ideas?
]]>Hello,
the errors occurs in Safari after SSL installed:
Media error: Format(s) not supported or source(s) not found
But the videos play well in Chrome and firefox, anyway to resolve?
Alex
]]>thanks for this great plugin!
how do i center the video on the page? I added the following to the shortcode but it didn’t help: style=”display: block; margin: 0 auto;”
also, how do i get the video to resize according to the browser/ be mobile-friendly?
thank you!
]]>Hi there,
When visiting your site, I notice that there is a demo of the player – using a translucent or clear skin. Is there a way to move away from the dark mode and use this clear version when using the plugin?
]]>Since updating to Version: 2.23.5 the Video Poster does not show anymore. It just flashes the poster image and disappears and only the player control is left.
[video webm="XXXX" width="100%" height="100%" video poster="https://images.fastcompany.net/image/upload/w_1280,f_auto,q_auto,fl_lossy/wp-cms/uploads/2017/06/p-1-what-happens-to-your-brain-when-you-work-on-vacation.jpg"]
I tried other image links and video links. Everything worked fine before, only this time after updating that this started happening. Hoping someone could provide me an insight on what may have gone wrong. Thank you
]]>In the WordPress plugin WP_PLUGIN_URL is used to load the CSS etc. Because it is a constant it can not follow a change from http to https. The browser rejects it as cross-protocol.
Fix is easy. Replace all occurrences of “WP_PLUGIN_URL” with the function “plugins_url()’
https://www.ads-software.com/ideas/topic/wp_plugin_url-doesnt-take-ssl-into-account
]]>Hello,
I use multiple MediaElement audio players on this page:
https://www.digitpaul.se/pa-svenska/radio-swingtime/
On page opening the width of .mejs-time-rail of all the players doesn’t expend more than 200px.
.mejs-time-rail expends well while listening to the first tune,
but then just disappears when listening to the next tunes.
How to fix this?
Thank you in advance for your help.
I seem to be getting parse errors on this plugin.
Does wordpress core still load this script?
]]>Anyone managed to add a VAST tag as preroll?
]]>