You are here

function media_youtube_video_url in Media: YouTube 6

Return the direct URL to this video.

Parameters

string $id: The YouTube video id.

Return value

string The direct URL to the video in question.

5 calls to media_youtube_video_url()
emvideo_youtube_embedded_link in providers/emvideo/youtube.inc
hook emvideo_PROVIDER_embedded_link($video_code) returns a link to view the video at the provider's site
media_youtube_check_status in ./media_youtube.module
Check the availability of a video.
media_youtube_upload_video in includes/media_youtube.media_mover.inc
Upload a video to YouTube through Media Mover.
template_preprocess_media_youtube_default_external in themes/media_youtube.theme.inc
template_preprocess_media_youtube_flash in themes/media_youtube.theme.inc
The embedded flash displaying the youtube video.

File

./media_youtube.module, line 251
Embedded Video Field provider file for YouTube.com.

Code

function media_youtube_video_url($id) {
  $proto = _media_youtube_protocol();
  if (strpos($id, 'PLAYLIST_') === 0) {

    // This is a youtube playlist.
    return $proto . 'youtube.com/p/' . substr($id, 9);
  }
  return url($proto . 'www.youtube.com/watch', array(
    'query' => 'v=' . $id,
  ));
}