Which MIME Types are supported by MediaRecorder on Safari? - safari

I'm mainly interested in audio MIME types but it would be helpful if someone can provide a list of all MIME types supported by Safari's MediaRecorder.
I've been unable to find any documentation on the matter. So far I've ran MediaRecorder.isTypeSupported(...) with all audio MIME types that are supported by Chrome and Firefox but none of them seem supported.

Currently, it seems only audio/mp4 and video/mp4 containers are supported, at least they're the only values that MediaRecorder.isTypeSupported() would return as valid: [source code]
if (!equalLettersIgnoringASCIICase(containerType, "audio/mp4") && !equalLettersIgnoringASCIICase(containerType, "video/mp4"))
return false;
And then the only codecs that are accepted by this same method are AVC1 for the video and MP4A for the audio.
if (!startsWithLettersIgnoringASCIICase(codec, "avc1") && !startsWithLettersIgnoringASCIICase(codec, "mp4a"))
return false;
Now, there seems to be some "Experimental Features" flags we can switch in the "Develop" menu regarding adding support for webm decoders or adding VP9 support for WebRTC but there doesn't seem to be anything for the MediaRecorder...

Related

How to send audio file using telethon so that the audio can be played in in-app media player for mobile?

I've tried to use both function, the audio still cannot be played in-app media player
await client.send_file(chat, '/my/songs/song.mp3', voice_note=True)
await client.send_file(chat, '/my/songs/song.mp3', attributes=[DocumentAttributeFilename(file_name=fileName + '.mp3'), DocumentAttributeAudio(duration=100, voice=True)])
I'm looking to send an audio which can be played using in-app audio
player.
Ok, you just need to use send_file, reference on the library docs here.
import asyncio
from telethon import TelegramClient
client = TelegramClient('SESSION_NAME', 'YOUR_API_ID', 'YOUR_API_HASH')
client.start(phone=+xxxxxxxxxxxx)
async def main():
await client.send_file('me', 'test.mp3')
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
client.send_file(chat, '/my/songs/song.mp3', voice_note=True)
test this, its send audio as user record, without "voice_note=True", media sended as main file
I don't know if you're still having this problem, but I solved it by installing the hachoir module with pip install hachoir. Basically the problem is that the client doesn't have the necessary metadata
I had the same situation as the author cause of my mp3-file had no extension (I used temporary file).
The reasons of your situation you can find in send_file method code. In my case, I discovered that if I set mime-type audio/mpeg for my media inside send_file/self._file_to_media in a debug mode, it sends file as in-app audio. So I found out that that method can't guess my file mime-type. I searched ahead and found my solution.
And... I tried voice_note=True - in my case it did not help, because my file was not a voice, but an mp3. And, actually, when I downloaded it it has voice_note=False set. So setting voice_note to True has no meaning if you are handling audio-files which are not voices.

WebRTC : attachMediaStream

Suppose for an incoming remote stream in WebRTC, I do not attach it to a video element using attachMediaStream(<videoElement>, <remoteStream>);.
I want to understand what happens now?
Is the stream still being sent by remote peer and I am not just displaying it as I have not attached to a video element
Remote has stopped streaming to me as I have not accepted the stream
attachMediaStream is a part of the adapter.js library. That library is a shim which contains "glue" code to abstract away differences between the browsers (Chrome/Firefox often have experimental API's prefixed with moz or webkit).
attachMediaStream was (deprecated now) responsible for attaching a MediaStream to a HTML video element. Nothing more.
You can have a look at the source for Firefox here:
attachMediaStream: function(element, stream) {
logging('DEPRECATED, attachMediaStream will soon be removed.');
element.srcObject = stream;
},
So 1. yes 2. no. Since attachMediaStream is purely a "local" helper to display the stream.
*attachMediaStream is not exclusive to adapter.js, that is just the most common adapter/helper library used.

How to enable the experimental AAC encoder for VLC and record AAC sound from the microphone?

I managed to record mp3 with VLC 2.1.5 on MacOSX 10.9.2 by using this command:
./VLC -vvv qtsound://AppleHDAEngineInput:1B,0,1,0:1 --sout "#transcode{acodec=mp3,ab=128}:standard{access=file,mux=mp3,dst=~/Desktop/Recording.mp3}"
However I need to record AAC audio and every time I use the AAC settings, the file is 203 bytes and broken, probably only the header gets written. Some mux/filetype combinations produce 0 bytes files or don't produce any file at all.
I used this command:
./VLC -vvv qtsound://AppleHDAEngineInput:1B,0,1,0:1 --sout "#transcode{acodec=mp4a,ab=128}:standard{access=file,mux=ts,dst=~/Desktop/Recording.mp4}"
Any command that works and records AAC audio with VLC from the Terminal would be greatly appreciated. Thanks!
Update:
I managed to get it started with this command:
./VLC -vvv qtsound://Internal\ microphone --sout "#transcode{acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst=~/Desktop/Recording.mp4}"
But when it tries to encode it tells this:
[aac # 0x10309e000] The encoder 'aac' is experimental but experimental
codecs are not enabled, add '-strict -2' if you want to use it.
[0x100469c30] avcodec encoder error: cannot open encoder
So it looks like I should add this
-strict -2
parameter to the command to fix it. Unfortunately this parameter is for ffmpeg and VLC does not recognize it. Do you have any idea how to enable the experimental AAC encoder for VLC?
Had something similar - Have no idea if this is doing anything, but it did make the error go away. Basically tried to pass params to ffmpeg
#transcode{aenc=ffmpeg{strict=-2},vcodec=mp4v,vb=1024,acodec=mp4a}
Hope this gives you some ideas
Another way this seems to work is with the --sout-avcodec-strict switch to the vlc command itself. To modify the original example:
./VLC -vvv qtsound://Internal\ microphone --sout-avcodec-strict -2 --sout "#transcode{acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst=~/Desktop/Recording.mp4}"
FYI, on Windows systems, one needs to use an equals sign for option values (not a space), so it would be --sout-avcodec-strict=-2 instead there.
I don't know what the difference is between these two forms, or indeed, if there is one. I suspect the sout-avcodec-strict form might be more robust in the face of future changes to the codec library interface, but given that it's a library-specific option in the first place, I'm not sure that matters.
My info was from:
https://forum.videolan.org/viewtopic.php?t=111801
Hope this helps.
Yes, huge thanks all the tech dudes here! Would just add that getting VLCs mp4 transcode working is also a great solution when Windows Movie Maker rejects (="is not indexed and cannot be imported") all your perfectly functional .asf / .wmv / .avi files. Install the K-Lite free codec pack to fundamentally broaden Movie Maker's import abilities; access these by switching to "All files" in the import dialogue; then stare in amazement as an (mp4) video actually loads!
For the graphically oriented, I've compiled screenshots of the various boxes, including that all-important strictness = -2. To use, Control R (=Convert...); browse to input file; [build, save &] load profile; browse to output location & supply name; finally hit Start (green ringed).
My setup is Windows 8.1, Movie Maker 6, K-Lite Codec Pack 12.0.5 (Full), VLC 2.2.1
Peace+love, AK
VLC makes mp4, now with sound!

Preloading audio formats for SoundJS

I am setting up a manifest to load a number of images and an audio file that will be played back using SoundJS.
I understand the concept of using createjs.Sound.alternateExtensions to play the supported audio format, but I can't tell if I need to preload both file formats as part of the load manifest. Obviously, this would be undesirable since only one file will be used for playback.
Is it necessary to load both?
manifest = [
{
src: "./assets/voiceover.mp3",
id: "vo"
}, {
src: "./assets/voiceover.ogg",
id: "vo"
}];
Just specify it once in the list. The "alternateExtensions" list is what SoundJS will try, depending on the current browser support.
For example, if you specify a "file.mp3", and the current browser (eg, Opera) doesn't support mp3, then it will swap out the extension for one it does support. You do not have to specify "file.ogg", it will do that for you.
This approach assumes you have a .ogg file in the same folder as the mp3. If you do not, consider using a complex "src" object, which has full paths to each file.
One note: If you are relying on alternateExtensions, it is recommended to define the file as ".ogg", and put the "mp3" and other extensions as alternates. This is because certain versions of Firefox report that it supports MP3, but will fail. Starting with ogg will get around this.

Detecting support for "application/pdf" in Microsoft Edge

Our site tries to detect support for the application/pdf mimetype via a check like this:
function isPdfMimeTypeSupported() {
if (navigator.mimeTypes != null && navigator.mimeTypes.length > 0)
for (i = 0; i < navigator.mimeTypes.length; i++) {
var mtype = navigator.mimeTypes[i];
if (mtype.type == "application/pdf" && mtype.enabledPlugin)
return true;
}
return false;
}
This works as expected in Chrome however in Microsoft Edge the mimeTypes collection only has two entries:
"application/x-shockwave-flash"
"application/futuresplash"
The check fails and we are incorrectly warning the user that their browser doesn't support PDF.
If there a way to check for PDF support in JavaScript that works in Edge?
Important: The following answer is relevant only for a specific period of time
Microsoft Edge, as suggested above, ships with native PDF viewing support built-in. I don't believe there are any versions of Edge that lack this functionality, but if there are, they would be very rare.
We are currently planning to update navigator.mimeType in the near future, which will cause your present approach (as presented above) to begin working. Until that time, I would encourage you to (I feel terrible for suggesting this) sniff the user-agent string.
This issue will be resolved in a future update to Microsoft Edge.
Check which version of Windows 10 you are using.
If you are using an N edition, then PDF support is not available out-of-the-box, and you'll need to install the Windows 10 Media Feature Pack or Acrobat.
For more information see Windows N editions explained