Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Media plugin filtering This filter will replace any links to a media file with a media plugin that plays that media inline

Copyright: 2004 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 235 lines (9 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

filter_mediaplugin:: (5 methods):
  setup()
  filter()
  callback()
  embed_alternatives()
  process_media_tag()


Class: filter_mediaplugin  - X-Ref

Automatic media embedding filter class.

It is highly recommended to configure servers to be compatible with our slasharguments,
otherwise the "?d=600x400" may not work.

setup($page, $context)   X-Ref
Setup page with filter requirements and other prepare stuff.

param: moodle_page $page The page we are going to add requirements to.
param: context $context The context which contents are going to be filtered.

filter($text, array $options = array()   X-Ref
No description

callback(array $matches)   X-Ref
Replace link with embedded content, if supported.

param: array $matches
return: string

embed_alternatives($urls, $name, $width, $height, $options)   X-Ref
Renders media files (audio or video) using suitable embedded player.

Wrapper for {@link core_media_manager::embed_alternatives()}

param: array $urls Array of moodle_url to media files
param: string $name Optional user-readable name to display in download link
param: int $width Width in pixels (optional)
param: int $height Height in pixels (optional)
param: array $options Array of key/value pairs
return: string HTML content of embed

process_media_tag($fulltext)   X-Ref
Replaces <video> or <audio> tag with processed contents

param: string $fulltext complete HTML snipped "<video ...>...</video>" or "<audio ...>....</audio>"
return: string