You are here

function _brightcove_media_get_wrapper in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove_media/brightcove_media.module \_brightcove_media_get_wrapper()

Createsa stream wrapper class for a brightcove:// or brightcove-playlist:// uri.

Parameters

string $uri:

Return value

MediaBrightcoveVideoStreamWrapper|null

4 calls to _brightcove_media_get_wrapper()
brightcove_media_file_formatter_playlist_view in brightcove_media/brightcove_media.module
The brightcove_media_playlist_file_formatter view callback.
brightcove_media_file_formatter_video_html_tag_view in brightcove_media/brightcove_media.module
The brightcove_media_video_file_formatter view callback.
brightcove_media_file_formatter_video_view in brightcove_media/brightcove_media.module
The brightcove_media_video_file_formatter view callback.
brightcove_media_parse_uri in brightcove_media/brightcove_media.module
Parses components from a brightcove:// or brightcove-playlist:// uri.

File

brightcove_media/brightcove_media.module, line 860
This module provide the hook implementations for the integration with Media module.

Code

function _brightcove_media_get_wrapper($uri) {
  static $wrapper_classes = [
    BRIGHTCOVE_EMBED_TYPE_VIDEO => MediaBrightcoveVideoStreamWrapper::class,
    BRIGHTCOVE_EMBED_TYPE_PLAYLIST => MediaBrightcovePlaylistStreamWrapper::class,
  ];
  $scheme = parse_url($uri, PHP_URL_SCHEME);
  if (isset($wrapper_classes[$scheme])) {
    $class = $wrapper_classes[$scheme];

    /** @var MediaBrightcoveVideoStreamWrapper $wrapper */
    $wrapper = new $class();
    $wrapper
      ->setUri($uri);
    return $wrapper;
  }
  return NULL;
}