Support » Plugin: MediaElement.js - HTML5 Video & Audio Player » Here’s help! MediaElement.js on Volume button Mobile

  • 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' );
    
    • This topic was modified 3 years, 11 months ago by davestein1.
  • The topic ‘Here’s help! MediaElement.js on Volume button Mobile’ is closed to new replies.