视频元素错误:MEDIA_ERR_SRC_NOT_SUPPORTED [英] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED

查看:350
本文介绍了视频元素错误:MEDIA_ERR_SRC_NOT_SUPPORTED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用dash.js播放dash mpd文件.我使用了

I'm trying to play a dash mpd file with dash.js.I used axinom tutorial for guidance which suggested the command below for generating the mpd file.

mkdir dash_unprotected
MP4Box -dash 4000 -rap -frag-rap -sample-groups-traf -profile dashavc264:live
-bs-switching no -segment-name dash_$RepresentationID$_$Number$ -url-template
video-700k.mp4 video-1000k.mp4 video-1500k.mp4 video-2000k.mp4 audio.mp4 -out
"dash_unprotected/manifest.mpd"

生成的mpd文件

 <?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5619  on 2017-06-29T06:08:26Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H1M55.01S" profiles="urn:mpeg:dash:profile:isoff-live:2011, http://dashif.org/guildelines/dash264">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>dash_unprotected/manifest.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT0H1M55.01S">
  <AdaptationSet segmentAlignment="true" maxWidth="316" maxHeight="576" maxFrameRate="30" par="316:576" lang="und">
   <SegmentTemplate timescale="15360" media="dash_dash_unprotected$$Number$.m4s" startNumber="1" duration="49009" initialization="dash_dash_unprotected$init.mp4"/>
   <Representation id="1" mimeType="video/mp4" codecs="avc1.64002a" width="158" height="288" frameRate="30" sar="396:395" startWithSAP="1" bandwidth="699969">
   </Representation>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.64002a" width="198" height="360" frameRate="30" sar="1:1" startWithSAP="1" bandwidth="996926">
   </Representation>
   <Representation id="3" mimeType="video/mp4" codecs="avc1.64002a" width="264" height="480" frameRate="30" sar="1:1" startWithSAP="1" bandwidth="1496279">
   </Representation>
   <Representation id="4" mimeType="video/mp4" codecs="avc1.64002a" width="316" height="576" frameRate="30" sar="396:395" startWithSAP="1" bandwidth="1993448">
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" lang="und">
   <SegmentTemplate timescale="44100" media="dash_dash_unprotected$$Number$.m4s" startNumber="1" duration="174856" initialization="dash_dash_unprotected$init.mp4"/>
   <Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="44100" startWithSAP="1" bandwidth="97798">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

然后我尝试使用下面的JavaScript代码在dash.js中播放

I then try to play it in dash.js using the JavaScript code below

    var url = "drm/dash_unprotected/manifest.mpd";
    var player = dashjs.MediaPlayer().create();

$(function() {
    player.initialize(document.querySelector("#videoPlayer"),null, true);
    player.attachVideoContainer(document.getElementById("videoContainer"));

    $('#playButton').click(function() {
        player.attachSource(url);
    });
});

但是dash.js抛出错误

But dash.js throws an error

[42585] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED (CHUNK_DEMUXER_ERROR_APPEND_FAILED: audio object type 0x40 does not match what is specified in the mimetype.) 
dash.all.debug.js:14793 [42586] [object MediaError] 
dash.all.debug.js:14793 [42588] Schedule controller stopping for video 
dash.all.debug.js:14793 [42589] Schedule controller stopping for audio 
dash.all.debug.js:14793 [42591] Caught pending play exception - continuing (NotSupportedError: Failed to load because no supported source was found.)

我该如何解决此错误?我是dash.js和mpeg-dash员工的新手

How can i solve this error? I'm new to dash.js and mpeg-dash staff

推荐答案

我能够通过仅删除-segment-name选项及其值来解决该错误.因此,我的命令如下所示

I was able to solve the error by just removing the -segment-name option and it's value. So my command look like this

 mkdir dash_unprotected
MP4Box -dash 4000 -rap -frag-rap -sample-groups-traf -profile dashavc264:live
-bs-switching no -url-template
video-700k.mp4 video-1000k.mp4 video-1500k.mp4 video-2000k.mp4 audio.mp4 -out
"dash_unprotected/manifest.mpd"

-segment-name选项使我的段彼此覆盖.例如,视频片段将被音频片段覆盖. 之所以发生覆盖,是因为即使我在-segment-name选项中使用唯一值,视频和音频段都被赋予了相同的名称.

-segment-name option was making my segments to overwrite each other. e.g video segments to be overwritten by audio segments. Overwriting was happening because both video and audio segments were being given the same names even when i use unique values to the -segment-name option.

-segment-name $RepresentationID$$-segment-name $Time$$

取消此选项,使MP4Box对-segment-name使用默认值%s_dash.因此,音频片段的命名方式如下

Eliminating this option make MP4Box to use the default value %s_dash for -segment-name. So audio segments will be named like this

 audio_dash1.m4s

以及类似的视频片段

 `video_dash1.m4s`

这篇关于视频元素错误:MEDIA_ERR_SRC_NOT_SUPPORTED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆