m4a audio files

I have been using m4a audio files and they've integrated fine, until today. I was creating a dictation ativity and was not able to upload my files. The error message indicated that those file types were not allowed. Is that a glitch or a permanent change? I use Dictation a lot, but if I can't upload m4a files (the default file type of Voice Memos) I don't know what I'll do.

otacke's picture

Hi Millerjs!

This has nothing to do with Dictation per se, but with the audio widget of H5P that it uses. However, I can't spot anything in its code that was changed that would break m4a support (and the error message is kind of a last resort and doesn't need to be correct). Are there any errors in the developer console?

Best,

Oliver

Nothing has changed that I can see. I tried draggig the audio file directly, and I tried uploading it from my folder, but nothing works. If I drag it to the upload space the error message is that the file type isn't allowed, and if I navigate to my file on my compter m4a files are greyed out.

otacke's picture

It does not matter how you try to upload a file. What's in the developer console? :-) 

I'm sorry, I don't know what you're asking. I'm just looking for help with my audio file upload. I'm a language teacher.

BV52's picture

Hi millerjs,

You can access the developer console by pressing Ctrl+Shift+J in the keyboard if you are using Chrome. Your screen should split in to 2 and by default you will see the console on the left siide. There you should see a red circle with an x, if you click on that it will give you a list of codes pointing to what is causing the issue. This usually gives developers like Oliver clues to where the problem is coming from.

-BV

otacke's picture

Try what BV suggested. And could you please check whether your file's suffix is written in uppercase letters or in lowercase letters? H5P seems to have trouble lately with uploading media files (at least PNG images) if the suffix uses uppercase letters.

It's written in lowercase letters. I tried to access the console, but couldn't see a red circle. Here's a screen cap of what I saw:

https://www.dropbox.com/s/p5u64erb58bfy6d/Capture%20d%27%C3%A9cran%20201...

BV52's picture

Hi Oliver,

You are right the issue seems to be the file extension is not recognized if it is in uppercase. Although I can't verify this with m4a files I can't find a sample file that H5P recognizes. I filed the report here.

-BV

Colin D's picture

I encountered this problem with uppercase file formats in my Drupal 7 site. I ended up commenting out line 206 in h5p.admin.inc: $form_state['values']['h5p_whitelist'] = mb_strtolower($form_state['values']['h5p_whitelist']); 

This allowed me to whitelist uppercase suffixes. Not the ideal solution but it got things moving.

otacke's picture

Hi Colin!

On Drupal, the H5P plugin allows to amend the list of allowed extensions in the settings, so at least on Drupal 7 there's no need to patch the core.

Best,
Oliver

Colin D's picture

Hi Oliver,

I had tried to ammend this list of extensions as you describe (within the Drupal 7 admin UI: Configuration > System >H5P > White list of accepted files) but the list would not save correctly, with any uppercase extensions being converted to lower case. The code edit above allowed me to store PNG JPEG JPG in the whitelist which then enabled users to upload files with these uppercase extensions. I don't think I could have achieved this without patching the core.  

Best wishes,

Colin

 

otacke's picture

Sorry, didn't know that that list was also converted to lowercase. Luckily, the bug has been fixed and just needs to be rolled out.

Colin D's picture

Great. Thanks.

It's in lowercase letters. I followed the suggestions and tried to access the developer's console. I took a screen shot of what I saw.

 

otacke's picture

This is quite weird. The console seems to show some kind of debug output. Line 83 of the file mentioned in the screenshot - in its official version - doesn't print that message and never has.

What site are you running this on? Could some admin have made changes to the core of H5P?

Best,

Oliver 

I'm just working from h5p.org and then integrating into my LMS (Canvas). The H5P content I created with m4a files still works. I just can't create new content with such audio files.

otacke's picture

If it's running on h5p.org, I fear someone of the H5P core team will have to take a look.

BV52's picture

Hi Oliver,

Thanks for the help. I filed a separate bug report here so that the core team can check.

-BV52

Thank you!

Colin D's picture

I was unable to use m4a files on my Drupal 7 site but I found a solution so this seems like an appropriate place to share it. After some investigation I found that whilst I could not use the file uploader to select a file from my computer (because m4a files were greyed out), I could drag m4a files onto the uploader icon and they would then upload successfully. 'm4a' was on the whitelists (both Drupal and H5P) so this wasn't the cause of the issue. I resorted to editing the H5P editor codebase to resolve the issue.

I edited h5peditor-file-uploader.js. At line 119 I added 'audio/x-m4a' so the whole line becomes:  return 'audio/mpeg,audio/x-wav,audio/ogg,audio/mp4,audio/x-m4a';

Perhaps this will help someone else.