Any way to hide the controlbar if the file is youtube? Currently it doesn't make sense the control bar display while viewing as youtube since it provide its own control bar - any way better to do this? Adding setting?

Comments

nathanjo’s picture

function yourtheme_preprocess_jw_player(&$vars) {
  if ($vars['file_mime'] == 'video/youtube') {
    $vars['config']['controlbar'] = 'none';
    drupal_add_js(array('jw_player' => array($vars['html_id'] => $vars['config'])), 'setting'); // Player settings
  }
}

For now I hide it when the file_mime is video/youtube.

rickvug’s picture

Status: Active » Postponed (maintainer needs more info)

@nathanjo How are you specifically passing a YouTube video to JW Player at the moment? I'm assuming media_youtube. At the moment I'm only implementing the HTML5 version of JW Player, wich I don't believe supports playing YouTube videos through the player. What I would do in your case is use File Entity to handle how video files should be displayed. Have YouTube first, with a fallback to JW Player for local files.

Hope this helps. With some more information I may be able to get a bit further.

sgdev’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (duplicate)
Related issues: +#2713725: Refactor theming, +#2719995: Add not empty checks and Repeat option, +#2719977: Add js file to build player

In 7.x-2.x, it is possible to add a YouTube URL to a link or text field, format the field as JW Player, and have it play YouTube videos.

To enable/disable the controls, it can be done within the presets, or programmatically through the available hook. Please download 7.x-2.x-dev, apply the following patches, and let us know your feedback. Thanks.

* Refactor theming: https://www.drupal.org/node/2713725
* Add not empty checks and Repeat option: https://www.drupal.org/node/2719995
* Add js file to build player: https://www.drupal.org/node/2719977