Commit 4681451f authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon
Browse files

Bug 1838483: support .wav and .m4a for embedded media



added the .wav and .m4a files to the plugin administration list of file types for internal media
added new string for m4a audio file
clean up artefact_file_mime_types to change m4a, m4b, m4p and m4r files to be audio/mp4
perform upgrade to update existing files to have the new mimetype

Change-Id: I6940c249cd715cfc373c1e0881a86da9c86a2e1b
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 04fc0678
......@@ -263,6 +263,8 @@ class PluginBlocktypeInternalmedia extends MaharaCoreBlocktype {
'ogv' => 'html5video',
'webm' => 'html5video',
'3gp' => 'html5video',
'wav' => 'html5audio',
'm4a' => 'html5audio',
);
}
......
......@@ -510,5 +510,27 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
clear_resized_images_cache();
}
if ($oldversion < 2019081900) {
log_debug("Update m4a, m4b, m4p and m4r file types to be audio/mp4 mimetype");
// For existing video/mp4 that need to have their mimetype updated to audio/mp4
execute_sql("UPDATE {artefact}
SET artefacttype = 'audio'
WHERE id IN (SELECT artefact FROM {artefact_file_files}
WHERE oldextension IN ('m4a', 'm4b', 'm4p', 'm4r'));
");
execute_sql("UPDATE {artefact_file_files} SET filetype = 'audio/mp4'
WHERE (oldextension in ('m4a', 'm4b', 'm4p', 'm4r')
AND filetype = 'video/mp4');");
// Make the m4a type enabled so existing blocks display correctly
$options = array();
if ($data = get_config_plugin('blocktype', 'internalmedia', 'enabledtypes')) {
$options = unserialize($data);
}
$options[] = 'm4a';
set_config_plugin('blocktype', 'internalmedia', 'enabledtypes', serialize($options));
}
return $status;
}
......@@ -165,25 +165,25 @@
<filetype>
<description>m4a</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
<mimetype>audio/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4p</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
<mimetype>audio/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4b</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
<mimetype>audio/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4r</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
<mimetype>audio/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
......
......@@ -253,6 +253,7 @@ $string['bz2'] = 'Bzip2 compressed file';
$string['txt'] = 'Plain text file';
$string['video'] = 'Video file';
$string['wav'] = 'WAV audio file';
$string['m4a'] = 'M4A audio file';
$string['wmv'] = 'WMV video file';
$string['xml'] = 'XML file';
$string['zip'] = 'ZIP archive';
......
......@@ -12,6 +12,5 @@
defined('INTERNAL') || die();
$config = new stdClass();
$config->version = 2017101300;
$config->release = '1.3.0';
$config->version = 2019081900;
$config->release = '1.3.1';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment