diff --git a/youtube.install b/youtube.install index 578b783..456f35d 100644 --- a/youtube.install +++ b/youtube.install @@ -45,6 +45,7 @@ function youtube_uninstall() { variable_del('youtube_thumb_hires'); variable_del('youtube_thumb_token_image_style'); variable_del('youtube_wmode'); + variable_del('youtube_quality'); } /** diff --git a/youtube.module b/youtube.module index 4139fd2..4fa2523 100644 --- a/youtube.module +++ b/youtube.module @@ -90,6 +90,13 @@ function youtube_settings_form($form) { showing above elements with fixed or absolute positioning (including Drupal\'s Overlay and Toolbar).'), ); + $form['youtube_global']['youtube_quality'] = array( + '#type' => 'select', + '#title' => t('Video Quality'), + '#default_value' => variable_get('youtube_quality', 'auto'), + '#options' => array('' => 'Default', 'small' => '240p', 'medium' => '360p', 'large' => '480p', 'hd720' => '720p', 'hd1080' => '1080p'), + '#description' => t('Set the default quality of the embedded video.
Warning: We recommend that you set the parameter value to default, which instructs YouTube to select the most appropriate playback quality, which will vary for different users, videos, systems and other playback conditions.'), + ); $form['youtube_thumbs'] = array( '#type' => 'fieldset', '#title' => t('Thumbnails'), diff --git a/youtube.theme.inc b/youtube.theme.inc index e866b67..2c45184 100644 --- a/youtube.theme.inc +++ b/youtube.theme.inc @@ -32,6 +32,7 @@ function theme_youtube_video($variables) { $wmode = variable_get('youtube_wmode', TRUE); $privacy = variable_get('youtube_privacy', FALSE); $dimensions = youtube_get_dimensions($size, $width, $height); + $quality = variable_get('youtube_quality', ''); // Query string changes based on setings. $query = array(); @@ -74,6 +75,9 @@ function theme_youtube_video($variables) { if ($iv_load_policy) { $query['iv_load_policy'] = '3'; } + if ($quality) { + $query['vq'] = $quality; + } // Domain changes based on settings. $domain = ($privacy) ? 'youtube-nocookie.com' : 'youtube.com';