Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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.