Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

Main class for plugin 'media_videojs'

Copyright: 2016 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 437 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

media_videojs_plugin:: (12 methods):
  embed()
  pick_video_size()
  get_start_time()
  get_supported_extensions()
  list_supported_urls()
  get_rank()
  find_language()
  get_language_content()
  supports()
  get_embeddable_markers()
  get_regex_youtube()
  setup()


Class: media_videojs_plugin  - X-Ref

Player that creates HTML5 <video> tag.

embed($urls, $name, $width, $height, $options)   X-Ref
Generates code required to embed the player.

param: moodle_url[] $urls
param: string $name
param: int $width
param: int $height
param: array $options
return: string

pick_video_size(&$width, &$height)   X-Ref
Utility function that sets width and height to defaults if not specified
as a parameter to the function (will be specified either if, (a) the calling
code passed it, or (b) the URL included it).

param: int $width Width passed to function (updated with final value)
param: int $height Height passed to function (updated with final value)

get_start_time(string $timestr)   X-Ref
Method to convert Youtube time parameter string, which can contain human readable time
intervals such as '1h5m', '1m10s', etc or a numeric seconds value

param: string $timestr
return: int

get_supported_extensions()   X-Ref
No description

list_supported_urls(array $urls, array $options = array()   X-Ref
No description

get_rank()   X-Ref
Default rank

return: int

find_language()   X-Ref
Tries to match the current language to existing language files

Matched language is stored in $this->language

return: string JS code with a setting

get_language_content(string $lang)   X-Ref
Returns the requested language pack in the json format.

param: string $lang The language code
return: false|string The read data or false on failure

supports($usedextensions = [])   X-Ref
No description

get_embeddable_markers()   X-Ref
No description

get_regex_youtube()   X-Ref
Returns regular expression used to match URLs for single youtube video

return: string PHP regular expression e.g. '~^https?://example.org/~'

setup($page)   X-Ref
Setup page requirements.

param: moodle_page $page The page we are going to add requirements to.