The goog.ui.media.YoutubeModel Class

goog.ui.media.YoutubeModel
> goog.ui.media.MediaModel

goog.ui.media.YoutubeModel(videoId, opt_caption, opt_description)

The {@code goog.ui.media.Youtube} media data model. It stores a required {@code videoId} field, sets the youtube URL, and allows a few optional parameters.

videoId {string}
The youtube video id.
opt_caption {string=}
An optional caption of the youtube video.
opt_description {string=}
An optional description of the youtube video.

.buildUrl(videoId)

The opposite of {@code goog.ui.media.Youtube.newInstance}: it takes a videoId and returns a youtube URL.

videoId {string}
The youtube video ID.
returns {string}
The youtube URL.

.findCategoryWithScheme(scheme)

Inherited from goog.ui.media.MediaModel .

Finds the first category with the given scheme.

scheme {string}
The scheme to search for.
returns {goog.ui.media.MediaModel.Category}
The category that has the given scheme. May be null.

.findCreditsWithRole(role)

Inherited from goog.ui.media.MediaModel .

Finds all credits with the given role.

role {string}
The role to search for.
returns {!Array.<!goog.ui.media.MediaModel.Credit>}
An array of credits with the given role. May be empty.

.getCaption()

Inherited from goog.ui.media.MediaModel .

Gets the caption of this media.

returns {string|undefined}
The caption of the media.

.getCategories()

Inherited from goog.ui.media.MediaModel .

Gets the categories of the media.

returns {Array.<goog.ui.media.MediaModel.Category>}
The categories of the media.

.getCredits()

Inherited from goog.ui.media.MediaModel .

Gets the credits of the media.

returns {!Array.<goog.ui.media.MediaModel.Credit>}
The credits of the media.

.getDescription()

Inherited from goog.ui.media.MediaModel .

Gets the description of this media.

returns {string|undefined}
The description of the media.

.getDuration()

Inherited from goog.ui.media.MediaModel .

Gets the duration of the media.

returns {number|undefined}
The duration in seconds.

.getFlashUrl(videoId, opt_autoplay)

An auxiliary method that builds URL of the flash movie to be embedded, out of the youtube video id.

videoId {string}
The youtube video ID.
opt_autoplay {boolean=}
Whether the flash movie should start playing as soon as it is shown, or if it should show a 'play' button.
returns {string}
The flash URL to be embedded on the page.

.getHeight()

Inherited from goog.ui.media.MediaModel .

Gets the height of the media in pixels.

returns {number|undefined}
The height in pixels.

.getMedium()

Inherited from goog.ui.media.MediaModel .

Gets the media medium.

returns {goog.ui.media.MediaModel.Medium|undefined}
The media medium.

.getPlayer()

Inherited from goog.ui.media.MediaModel .

Gets the player data.

returns {goog.ui.media.MediaModel.Player|undefined}
The media player data.

.getSubTitles()

Inherited from goog.ui.media.MediaModel .

Gets the subtitles for the media.

returns {Array.<goog.ui.media.MediaModel.SubTitle>}
The subtitles.

.getThumbnailUrl(youtubeId)

A static auxiliary method that builds a static image URL with a preview of the youtube video. NOTE(user): patterned after Gmail's gadgets/youtube, TODO(user): how do I specify the width/height of the resulting image on the url ? is there an official API for http://ytimg.com ?

youtubeId {string}
The youtube video ID.
returns {string}
An URL that contains an image with a preview of the youtube movie.

.getThumbnails()

Inherited from goog.ui.media.MediaModel .

Gets the thumbnail urls.

returns {Array.<goog.ui.media.MediaModel.Thumbnail>}
The list of thumbnails.

.getType()

Inherited from goog.ui.media.MediaModel .

Gets the media mime type.

returns {goog.ui.media.MediaModel.MimeType|undefined}
The media mime type.

.getUrl()

Inherited from goog.ui.media.MediaModel .

Gets the URL of this media.

returns {string|undefined}
The URL of the media.

.getVideoId()

Gets the Youtube video id.

returns {string}
The Youtube video id.

.getWidth()

Inherited from goog.ui.media.MediaModel .

Gets the width of the media in pixels.

returns {number|undefined}
The width in pixels.

.newInstance(youtubeUrl, opt_caption, opt_description)

A auxiliary static method that parses a youtube URL, extracting the ID of the video, and builds a YoutubeModel.

youtubeUrl {string}
A youtube URL.
opt_caption {string=}
An optional caption of the youtube video.
opt_description {string=}
An optional description of the youtube video.
returns {goog.ui.media.YoutubeModel}
The data model that represents the youtube URL.
@see
goog.ui.media.YoutubeModel.getVideoId()
@throws
Error in case the parsing fails.

.setCaption(caption)

Inherited from goog.ui.media.MediaModel .

Sets the caption of this media.

caption {string}
The caption of the media.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setCategories(categories)

Inherited from goog.ui.media.MediaModel .

Sets the categories of the media

categories {Array.<goog.ui.media.MediaModel.Category>}
The categories of the media.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setCredits(credits)

Inherited from goog.ui.media.MediaModel .

Sets the credits of the media

credits {!Array.<goog.ui.media.MediaModel.Credit>}
The credits of the media.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setDescription(description)

Inherited from goog.ui.media.MediaModel .

Sets the description of this media.

description {string}
The description of the media.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setDuration(duration)

Inherited from goog.ui.media.MediaModel .

Sets duration of the media.

duration {number}
The duration of the media, in seconds.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setHeight(height)

Inherited from goog.ui.media.MediaModel .

Sets the height of the media.

height {number}
The height of the media, in pixels.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setMedium(medium)

Inherited from goog.ui.media.MediaModel .

Sets the media medium.

medium {goog.ui.media.MediaModel.Medium}
The media medium.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setPlayer(player)

Inherited from goog.ui.media.MediaModel .

Sets the player data.

player {goog.ui.media.MediaModel.Player}
The media player data.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setSubTitles(subtitles)

Inherited from goog.ui.media.MediaModel .

Sets the subtitles for the media

subtitles {Array.<goog.ui.media.MediaModel.SubTitle>}
The subtitles.
returns {!goog.ui.media.MediaModel}
The object itself.

.setThumbnails(thumbnails)

Inherited from goog.ui.media.MediaModel .

Sets the thumbnail list.

thumbnails {Array.<goog.ui.media.MediaModel.Thumbnail>}
The list of thumbnail.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setType(type)

Inherited from goog.ui.media.MediaModel .

Sets the media mime type.

type {goog.ui.media.MediaModel.MimeType}
The media mime type.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setUrl(url)

Inherited from goog.ui.media.MediaModel .

Sets the URL of this media.

url {string}
The URL of the media.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.

.setWidth(width)

Inherited from goog.ui.media.MediaModel .

Sets the width of the media.

width {number}
The width of the media, in pixels.
returns {!goog.ui.media.MediaModel}
The object itself, used for chaining.