Where is a comprehensive list of supported media types when recording with the Media * API?

安稳与你 提交于 2019-12-12 10:57:51

问题


I am trying to learn how to record media in the browser and I may be over-complicating things. There is an abundant supply of straight-forward examples but I got bogged down at the part when the recordings are pushed to a Blob object with an arbitrarily selected media type without checking whether that format is supported. Therefore I assume there is a list or people just keep building on past experiences.

For example, from Mido22/MediaRecorder-sample:

      mediaOptions = {
        video: {
          tag: 'video',
          type: 'video/webm',
          ext: '.mp4',
          gUM: {video: true, audio: true}
        },
        audio: {
          tag: 'audio',
          type: 'audio/ogg',
          ext: '.ogg',
          gUM: {audio: true}
        }
      };
  media = mv.checked ? mediaOptions.video : mediaOptions.audio;
//...
function makeLink(){
  let blob = new Blob(chunks, {type: media.type })
//...

or from MDN's Using the Media Stream Recording API:

 var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });

The specs and their various documentations are mostly generic descriptions which is completely understandable as user agents need to implement them.

The first answer to this question is pretty much what I had in mind but I was wondering whether there is an easier accessible and up-to-date list somewhere?


UPDATE: I pretty much feel like as if I just crawled out from under a rock because as soon as I posted this I realized the 2 most obvious ways...

  1. Query the media format on http://caniuse.com/
  2. MDN's Supported Media Formats

After @Kaiido's pointers:

  1. Media Recorder API's isTypeSupported
  2. getSupportedTypes()

来源:https://stackoverflow.com/questions/42048368/where-is-a-comprehensive-list-of-supported-media-types-when-recording-with-the-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!