Home > Net >  Firefox and Internet explorer audio playback
Firefox and Internet explorer audio playback

Time:10-22

A program used to broadcast audio resources, using the HTML 5 audio components, according to the needs of online information query. This component according to the different browsers use different audio format file,
Such as:
 & lt; Audio controls="controls" id="audioControl & gt;" 


Himself by JS as components in all kinds of audio assignment of the corresponding file stream address:
 $(' # audioControl. Mp3). Attr (' SRC 'baseApiUrl +'/ArticleInfo/DownloadArticle? Id='+ id + & amp; IdSign='+ downSign); 
$(' # audioControl. Ogg) attr (' SRC 'baseApiUrl +'/ArticleInfo/DownloadArticle? Id='+ id + & amp; FileType=ogg& IdSign='+ downSign);
$(' # audioControl. Wav) attr (' SRC 'baseApiUrl +'/ArticleInfo/DownloadArticle? Id='+ id + & amp; FileType=wav& IdSign='+ downSign);
Document. The getElementById (' audioControl '). The load ();

The back-end code is as follows (. Netcore)
 var filePath.=UploadConfig DataTypePDFPath + model. Pdfpath; 
If (fileType=="ogg")//get ogg vorbis audio
FilePath=filePath. ToLower (). The Replace (", ". Ogg "mp3");
If (fileType=="wav")//get OGG vorbis audio
FilePath=filePath. ToLower (). The Replace (", ". Wav "mp3");
The FileInfo the FileInfo=new the FileInfo (filePath);
if (! The fileInfo. The Exists)
{
Return ErrorInfo (" file does not exist!" );
}
Var ext=the fileInfo. The Extension;
New FileExtensionContentTypeProvider (). The Mappings. TryGetValue (ext, out var contenttype);
Return the File (System. IO. File. ReadAllBytes (filePath), contenttype?? "Application/octet stream", the fileInfo. Name);


In the Google browser play is normal, but in my IE (IE11) and firefox (81.0.2 [new]) are playing failure
Firefox browser play hints when decoding failure

Prompt type in IE browser does not support or file path is invalid


In the firefox browser decoding problem on the Internet to find one solution is to restart the Windows audio service, using CMD command restart restart firefox browser still doesn't work, (https://stackoom.com/question/31tXs/Firefox-HTML-%E9%9F%B3%E9%A2%91-%E5%AA%92%E4%BD%93%E8%B5%84%E6%BA%90%E6%97%A0%E6%B3%95%E8%A7%A3%E7%A0%81-OnMediaSinkAudioError)

Jquery also spoke to audio plug-in, plug-in official sample but it is also the same problem, (https://www.jq22.com/yanshi419)
Firefox is prompt:
https://www.jq22.com/demo/bofq/audio.mp3 could not be decoded media resources,
https://www.jq22.com/demo/bofq/audio.ogg could not be decoded media resources,
https://www.jq22.com/demo/bofq/audio.wav could not be decoded media resources,

For a solution,

  • Related