用于创建MediaSource的MP3内容类型

问题描述

使用MediaSource.CreateFromStream(流,内容类型),“ audio-16khz-64kbitrate-mono-mp3”流的内容类型是什么?我尝试了很多值,导致无法创建mediasource。

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

解决方法

应该是其中之一

  • audio/mpeg
  • audio/x-mpeg
  • audio/mp3
  • audio/x-mp3
,

提供的流的MediaSource.CreateFromStream所需的当前“ contentType”参数值不是“ audio / xxx”类型规范之一(在我的代码中多年来一直为“ audio / wav”),而是“ { Name =“ MemoryStream” FullName =“ System.IO.MemoryStream”}“ [带有大括号]。这是“ stream.GetType()”返回的值

知道接收到的流分配给变量后,将其属性“ .position”设置为流的长度,并且需要将其重置为零才能读取。