class MediaYouTubeStreamWrapper in Media: YouTube 7
Same name and namespace in other branches
- 7.3 includes/MediaYouTubeStreamWrapper.inc \MediaYouTubeStreamWrapper
- 7.2 includes/MediaYouTubeStreamWrapper.inc \MediaYouTubeStreamWrapper
Create an instance like this: $youtube = new ResourceYouTubeStreamWrapper('youtube://?v=[video-code]');
Hierarchy
- class \MediaYouTubeStreamWrapper extends \MediaReadOnlyStreamWrapper
Expanded class hierarchy of MediaYouTubeStreamWrapper
1 string reference to 'MediaYouTubeStreamWrapper'
- media_youtube_stream_wrappers in ./
media_youtube.module - Implements hook_stream_wrappers().
File
- includes/
MediaYouTubeStreamWrapper.inc, line 12 - Create a YouTube Stream Wrapper class for the Media/Resource module.
View source
class MediaYouTubeStreamWrapper extends MediaReadOnlyStreamWrapper {
protected $base_url = 'http://youtube.com/watch';
function getTarget($f) {
return FALSE;
}
static function getMimeType($uri, $mapping = NULL) {
return 'video/youtube';
}
function getOriginalThumbnailPath() {
$parts = $this
->get_parameters();
return 'http://img.youtube.com/vi/' . check_plain($parts['v']) . '/0.jpg';
}
function getLocalThumbnailPath() {
$parts = $this
->get_parameters();
$local_path = 'public://media-youtube/' . check_plain($parts['v']) . '.jpg';
if (!file_exists($local_path)) {
$dirname = drupal_dirname($local_path);
file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
@copy($this
->getOriginalThumbnailPath(), $local_path);
}
return $local_path;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaYouTubeStreamWrapper:: |
protected | property | ||
MediaYouTubeStreamWrapper:: |
function | |||
MediaYouTubeStreamWrapper:: |
static | function | ||
MediaYouTubeStreamWrapper:: |
function | |||
MediaYouTubeStreamWrapper:: |
function |