Home

# Class goog.ui.media.Youtube

Subclasses a goog.ui.media.MediaRenderer to provide a Youtube specific media renderer. This class knows how to parse youtube urls, and render the DOM structure of youtube video players and previews. This class is meant to be used as a singleton static stateless class, that takes {@code goog.ui.media.Media} instances and renders it. It expects {@code goog.ui.media.Media.getModel} to return a well formed, previously constructed, youtube video id, which is the data model this renderer will use to construct the DOM structure. {@see goog.ui.media.Youtube.newControl} for a example of constructing a control with this renderer. goog.ui.media.Youtube currently supports all {@link goog.ui.Component.State}. It will change its DOM structure between SELECTED and !SELECTED, and rely on CSS definitions on the others. On !SELECTED, the renderer will render a youtube static , with a thumbnail of the video. On SELECTED, the renderer will append to the DOM a flash object, that contains the youtube video. This design is patterned after http://go/closure_control_subclassing It uses {@link goog.ui.media.FlashObject} to embed the flash object.

extends goog.ui.media.MediaRenderer

Instance Method Summary
| `getCssClass() ⇒ string` Returns the CSS class to be applied to the root element of components rendered using this renderer.
| `setState(?goog.ui.media.Media control, ?goog.ui.Component.State state, boolean enable)` Changes the state of a {@code control}. Currently only changes the DOM structure when the youtube movie is SELECTED (by default fired by a MOUSEUP on the thumbnail), which means we have to embed the youtube flash video and play it.

Static Method Summary

`newControl(?goog.ui.media.YoutubeModel youtubeModel, ?goog.dom.DomHelper= opt_domHelper) ⇒ ?goog.ui.media.Media`

A static convenient method to construct a goog.ui.media.Media control out of a youtube model. It sets it as the data model goog.ui.media.Youtube renderer uses, sets the states supported by the renderer, and returns a Control that binds everything together. This is what you should be using for constructing Youtube videos, except if you need finer control over the configuration.