class MediaBrightcoveVideoStreamWrapper in Brightcove Video Connect 7.4
Same name and namespace in other branches
- 7.7 brightcove_media/includes/MediaBrightcoveVideoStreamWrapper.inc \MediaBrightcoveVideoStreamWrapper
- 7.6 brightcove_media/includes/MediaBrightcoveVideoStreamWrapper.inc \MediaBrightcoveVideoStreamWrapper
@file Stream wrapper for Brightcove videos.
Hierarchy
- class \MediaBrightcoveVideoStreamWrapper extends \MediaReadOnlyStreamWrapper
Expanded class hierarchy of MediaBrightcoveVideoStreamWrapper
1 string reference to 'MediaBrightcoveVideoStreamWrapper'
- brightcove_media_stream_wrappers in brightcove_media/
brightcove_media.module - Implements hook_stream_wrappers().
File
- brightcove_media/
includes/ MediaBrightcoveVideoStreamWrapper.inc, line 8 - Stream wrapper for Brightcove videos.
View source
class MediaBrightcoveVideoStreamWrapper extends MediaReadOnlyStreamWrapper {
/**
* Get target.
*
* @return bool
*/
public function getTarget() {
return FALSE;
}
/**
* Get MIME type.
*
* @static
* @param $uri
* @param null $mapping
* @return string
*/
public static function getMimeType($uri, $mapping = NULL) {
return 'video/brightcove';
}
/**
* Interpolate an url.
*
* @return null|string
*/
public function interpolateUrl() {
// Load the default brightcove player.
$player = brightcove_default_player();
// Parse the video id.
$video_id = $this
->getVideoID();
if (!is_null($video_id) && !is_null($player)) {
return url('http://c.brightcove.com/services/viewer/federated_f9', array(
'query' => array(
'playerID' => $player->player_id,
'playerKey' => $player->player_key,
'isVid' => 'true',
'isUI' => 'true',
'@videoPlayer' => $video_id,
),
));
}
return NULL;
}
/**
* Get a video id.
*
* @return null
*/
public function getVideoID() {
if ($url = parse_url($this->uri)) {
if ($url['scheme'] == 'brightcove' && is_numeric($url['host'])) {
return $url['host'];
}
}
return NULL;
}
/**
* Set uri.
*
* @param $uri
*/
public function setUri($uri) {
$this->uri = $uri;
}
/**
* Get the thumbnail path.
*
* @return null
*/
function getOriginalThumbnailPath() {
if ($video_id = $this
->getVideoID()) {
if ($video = brightcove_video_load($video_id)) {
return isset($video['thumbnailURL']) ? $video['thumbnailURL'] : NULL;
}
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaBrightcoveVideoStreamWrapper:: |
public static | function | Get MIME type. | |
MediaBrightcoveVideoStreamWrapper:: |
function | Get the thumbnail path. | ||
MediaBrightcoveVideoStreamWrapper:: |
public | function | Get target. | |
MediaBrightcoveVideoStreamWrapper:: |
public | function | Get a video id. | |
MediaBrightcoveVideoStreamWrapper:: |
public | function | Interpolate an url. | |
MediaBrightcoveVideoStreamWrapper:: |
public | function | Set uri. |