diff --git a/lib/editor/tiny/plugins/media/templates/embed/body/media_details_body.mustache b/lib/editor/tiny/plugins/media/templates/embed/body/media_details_body.mustache
new file mode 100644
index 00000000000..8c95e0f8c52
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/body/media_details_body.mustache
@@ -0,0 +1,232 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/body/media_details_body
+
+ Media preview body template.
+
+ Example context (json):
+ {
+ "isVideo": true,
+ "isAudio": true,
+ "isLink": true,
+ "canHaveThumbnail": true,
+ "isAudioTag": true,
+ "isVideoTag": true,
+ "elementid": "id",
+ "media" : {
+ "poster": "link/to/poster",
+ "title": "media name/title",
+ "isUpdating": true,
+ "controls": true,
+ "autoplay": false,
+ "muted": false,
+ "loop": false,
+ "width": "1200",
+ "height": "800"
+ }
+ }
+
+}}
+
diff --git a/lib/editor/tiny/plugins/media/templates/embed/body/media_thumbnail_body.mustache b/lib/editor/tiny/plugins/media/templates/embed/body/media_thumbnail_body.mustache
new file mode 100644
index 00000000000..7a8b7a077ff
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/body/media_thumbnail_body.mustache
@@ -0,0 +1,39 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/body/media_thumbnail_body
+
+ Insert thumbnail preview body template.
+
+ Example context (json):
+ {
+
+ }
+
+}}
+
diff --git a/lib/editor/tiny/plugins/media/templates/embed/footer/media_details_footer.mustache b/lib/editor/tiny/plugins/media/templates/embed/footer/media_details_footer.mustache
new file mode 100644
index 00000000000..406b31e740b
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/footer/media_details_footer.mustache
@@ -0,0 +1,40 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/footer/media_details_footer
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "isLink": true,
+ "isUpdating": true,
+ "canHaveThumbnail": true
+ }
+
+}}
+
diff --git a/lib/editor/tiny/plugins/media/templates/embed/footer/media_thumbnail_footer.mustache b/lib/editor/tiny/plugins/media/templates/embed/footer/media_thumbnail_footer.mustache
new file mode 100644
index 00000000000..d2e759bd4a0
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/footer/media_thumbnail_footer.mustache
@@ -0,0 +1,36 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/footer/media_thumbnail_footer
+
+ Media thumbnail preview footer template.
+
+ Example context (json):
+ {
+
+ }
+
+}}
+
+
+
+
+
+
+
+
+
diff --git a/lib/editor/tiny/plugins/media/templates/embed/insert_media_subtitle_caption.mustache b/lib/editor/tiny/plugins/media/templates/embed/insert_media_subtitle_caption.mustache
new file mode 100644
index 00000000000..efd33972654
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/insert_media_subtitle_caption.mustache
@@ -0,0 +1,107 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/insert_media_subtitle_caption
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "elementid": "id",
+ "subtitleshelpicon": "subtitle help icon",
+ "captionshelpicon": "caption help icon",
+ "descriptionshelpicon": "description help icon",
+ "chaptershelpicon": "chapter help icon",
+ "metadatahelpicon": "metadata help icon",
+ "helpStrings": {
+ "metadata": "metadata"
+ }
+ }
+
+}}
+
diff --git a/lib/editor/tiny/plugins/media/templates/embed/link_media_type_selector.mustache b/lib/editor/tiny/plugins/media/templates/embed/link_media_type_selector.mustache
new file mode 100644
index 00000000000..7ea52a430c0
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/link_media_type_selector.mustache
@@ -0,0 +1,37 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/link_media_type_selector
+
+ Show media type options.
+
+ Example context (json):
+ {
+ }
+
+}}
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/editor/tiny/plugins/media/templates/embed/metadata/captions.mustache b/lib/editor/tiny/plugins/media/templates/embed/metadata/captions.mustache
new file mode 100644
index 00000000000..0ab305a43ca
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/metadata/captions.mustache
@@ -0,0 +1,145 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/metadata/captions
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "media": {
+ "tracks": {
+ "captions": "captions"
+ }
+ },
+ "showFilePickerTrack": true,
+ "langsInstalled": "installed langs",
+ "src": "http://moodle.com/link/to/source",
+ "srclang": "selected lang",
+ "default": true,
+ "langsAvailable": "avalialbe langs",
+ "defaultTrack": true,
+ "label": "selected track",
+ "code": "lang code",
+ "lang": "lang name"
+ }
+
+}}
+{{#media.tracks.captions}}
+
+{{/media.tracks.captions}}
diff --git a/lib/editor/tiny/plugins/media/templates/embed/metadata/chapters.mustache b/lib/editor/tiny/plugins/media/templates/embed/metadata/chapters.mustache
new file mode 100644
index 00000000000..e6381763fa2
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/metadata/chapters.mustache
@@ -0,0 +1,145 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/metadata/chapters
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "media": {
+ "tracks": {
+ "chapters": "chapters"
+ }
+ },
+ "showFilePickerTrack": true,
+ "langsInstalled": "installed langs",
+ "src": "http://moodle.com/link/to/source",
+ "srclang": "selected lang",
+ "default": true,
+ "langsAvailable": "avalialbe langs",
+ "defaultTrack": true,
+ "label": "selected track",
+ "code": "lang code",
+ "lang": "lang name"
+ }
+
+}}
+{{#media.tracks.chapters}}
+
+{{/media.tracks.chapters}}
diff --git a/lib/editor/tiny/plugins/media/templates/embed/metadata/descriptions.mustache b/lib/editor/tiny/plugins/media/templates/embed/metadata/descriptions.mustache
new file mode 100644
index 00000000000..c81c0fc38a5
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/metadata/descriptions.mustache
@@ -0,0 +1,145 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/metadata/descriptions
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "media": {
+ "tracks": {
+ "descriptions": "descriptions"
+ }
+ },
+ "showFilePickerTrack": true,
+ "langsInstalled": "installed langs",
+ "src": "http://moodle.com/link/to/source",
+ "srclang": "selected lang",
+ "default": true,
+ "langsAvailable": "avalialbe langs",
+ "defaultTrack": true,
+ "label": "selected track",
+ "code": "lang code",
+ "lang": "lang name"
+ }
+
+}}
+{{#media.tracks.descriptions}}
+
+{{/media.tracks.descriptions}}
diff --git a/lib/editor/tiny/plugins/media/templates/embed/metadata/metadata.mustache b/lib/editor/tiny/plugins/media/templates/embed/metadata/metadata.mustache
new file mode 100644
index 00000000000..83e97c8a61c
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/metadata/metadata.mustache
@@ -0,0 +1,145 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/metadata/metadata
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "media": {
+ "tracks": {
+ "metadata": "metadata"
+ }
+ },
+ "showFilePickerTrack": true,
+ "langsInstalled": "installed langs",
+ "src": "http://moodle.com/link/to/source",
+ "srclang": "selected lang",
+ "default": true,
+ "langsAvailable": "avalialbe langs",
+ "defaultTrack": true,
+ "label": "selected track",
+ "code": "lang code",
+ "lang": "lang name"
+ }
+
+}}
+{{#media.tracks.metadata}}
+
+{{/media.tracks.metadata}}
diff --git a/lib/editor/tiny/plugins/media/templates/embed/metadata/subtitles.mustache b/lib/editor/tiny/plugins/media/templates/embed/metadata/subtitles.mustache
new file mode 100644
index 00000000000..6a461a16163
--- /dev/null
+++ b/lib/editor/tiny/plugins/media/templates/embed/metadata/subtitles.mustache
@@ -0,0 +1,145 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template tiny_media/embed/metadata/subtitles
+
+ Media preview footer template.
+
+ Example context (json):
+ {
+ "media": {
+ "tracks": {
+ "subtitles": "subtitles"
+ }
+ },
+ "showFilePickerTrack": true,
+ "langsInstalled": "installed langs",
+ "src": "http://moodle.com/link/to/source",
+ "srclang": "selected lang",
+ "default": true,
+ "langsAvailable": "avalialbe langs",
+ "defaultTrack": true,
+ "label": "selected track",
+ "code": "lang code",
+ "lang": "lang name"
+ }
+
+}}
+{{#media.tracks.subtitles}}
+
+{{/media.tracks.subtitles}}
diff --git a/lib/editor/tiny/plugins/media/templates/embed_media_modal.mustache b/lib/editor/tiny/plugins/media/templates/embed_media_modal.mustache
deleted file mode 100644
index 0f36ea159bb..00000000000
--- a/lib/editor/tiny/plugins/media/templates/embed_media_modal.mustache
+++ /dev/null
@@ -1,78 +0,0 @@
-{{!
- This file is part of Moodle - http://moodle.org/
-
- Moodle is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Moodle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Moodle. If not, see .
-}}
-{{!
- @template tiny_media/embed_media_modal
-
- Embed media modal template.
-
- Example context (json):
- {
-
- }
-}}
-{{< core/modal }}
-
- {{$title}}
- {{#str}} modaltitle, tiny_h5p {{/str}}
- {{/title}}
-
- {{$body}}
-
- {{/body}}
-
- {{$footer}}
-
-
- {{/footer}}
-
-{{/ core/modal }}
diff --git a/lib/editor/tiny/plugins/media/templates/embed_media_modal_audio.mustache b/lib/editor/tiny/plugins/media/templates/embed_media_modal_audio.mustache
deleted file mode 100644
index 844880df0f5..00000000000
--- a/lib/editor/tiny/plugins/media/templates/embed_media_modal_audio.mustache
+++ /dev/null
@@ -1,778 +0,0 @@
-{{!
- This file is part of Moodle - http://moodle.org/
-
- Moodle is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Moodle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Moodle. If not, see .
-}}
-{{!
- @template tiny_media/embed_media_modal_audio
-
- Embed media audio modal template.
-
- Example context (json):
- {
-
- }
-}}
-{{#audio.sources}}
-
-{{/audio}}
-
-
-
diff --git a/lib/editor/tiny/plugins/media/templates/embed_media_modal_link.mustache b/lib/editor/tiny/plugins/media/templates/embed_media_modal_link.mustache
deleted file mode 100644
index 4dc4d7ce8cd..00000000000
--- a/lib/editor/tiny/plugins/media/templates/embed_media_modal_link.mustache
+++ /dev/null
@@ -1,41 +0,0 @@
-{{!
- This file is part of Moodle - http://moodle.org/
-
- Moodle is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Moodle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Moodle. If not, see .
-}}
-{{!
- @template tiny_media/embed_media_modal_link
-
- Embed media link modal template.
-
- Example context (json):
- {
-
- }
-}}
-
-
-
-
-
- {{#showfilepicker}}
-
- {{/showfilepicker}}
-
-
-
-
-
diff --git a/lib/editor/tiny/plugins/media/templates/embed_media_modal_video.mustache b/lib/editor/tiny/plugins/media/templates/embed_media_modal_video.mustache
deleted file mode 100644
index fdfae281824..00000000000
--- a/lib/editor/tiny/plugins/media/templates/embed_media_modal_video.mustache
+++ /dev/null
@@ -1,806 +0,0 @@
-{{!
- This file is part of Moodle - http://moodle.org/
-
- Moodle is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Moodle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Moodle. If not, see .
-}}
-{{!
- @template tiny_media/embed_media_modal_video
-
- Embed media video modal template.
-
- Example context (json):
- {
-
- }
-}}
-{{#video.sources}}
-