There is some interesting discussion going on MDL-38158 at the moment and I would like to bring more participants/opinions into it.
Initially this issue was about introducing Flowplayer HTML5 (see another forum discussion) but since nobody can actually agree on the choice of player, the issue was renamed into "Introduce pluggable media players in Moodle".
Moodle will ship one of the nice JS players with standard package and individual users will be able to substitute it with a different one.
First of all, let me outline the necessary work to be done that I hope everybody agrees with:
- Allow including <video> and <audio> tags in the content even for non-trusted users (students): see MDL-54847 and MDL-55581
- Create atto plugin (most likely update existing atto_media) to use <video> and <audio> tags for including media: see MDL-55324 - we should be able to add more than one source, subtitles tracks, specify dimensions, etc.
- .... more small issues, see the new component Media in tracker (feel free to add it to other existing issues if you find appropriate).
Now the contradictory part - how to "plug" the media players?
Several years ago media settings were separated from filter_mediaplugin and formed their own core_media API. It can be customised by themes. This is not the best solution because we often want to have one player that can be used by many themes.
By the way, I have not found any themes in Plugins directory that overwrite core_media_renderer, if you know any - please let me know and ask the developers to join this discussion because we are most likely going to break this functionality for them.
The reason for separating was that media players can be used for displaying video/audio files when these files are not part of the text. Examples of current usage: mod_resource ("File"), mod_url ("Url") and mod_lesson ("Lesson" - see well hidden media file in the module settings). However it is not difficult to use something like format_text(html_writer::link($fileurl, 'file name')) to display the media file in these modules and i have written POC. But there still can be use cases where it is beneficial to use media players without calling format_text().
So currently we have the following options:
1. leave core_media API that is used by both filter_mediaplugin and mod_xyz
(resource, url, lesson, etc) and add a new plugin type for media
2. remove core_media API (convert to several filter plugins), force mod_xyz to create text fragments for their embedded content and pass it through format_text()
3. [a bit of both] create new plugin type for media players, refactor filter_mediaplugin to embed players using Media API (process <video>, <audio>, old <a> media) and force mod_xyz to create text fragments for their embedded content and pass it through format_text().
Advantage of using filters is that we already have API and UI to configure filters in each context and it allows better customization. Advantage of using new plugin type for media is that media players can be used without calling format_text().
All opinions are welcome. Please think first from student/teacher point of view, then from administrator and only in the end as a developer. Let's aim for user friendliness.