Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 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.

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

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

return: int
param: string $timestr

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.

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

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.