无法再现Ogg音频在Chrome接受范围:字节

本文关键字:范围 字节 Chrome Ogg 音频 | 更新日期: 2023-09-27 18:19:04

我试图用HTML5重现音频,但我有问题,在时间重现Ogg文件,这是我的服务器(BasicHandler.ashx)的配置:

        string oggFileName = @"C:'Users'gustav'Desktop'Player'Files'TestAudio.ogg";
        byte[] bytes = File.ReadAllBytes(oggFileName);
        httpContext.Response.ContentType = "audio/ogg";
        httpContext.Response.AddHeader("pragma", "Public");
        httpContext.Response.AddHeader("Accept-Ranges", "bytes");
        httpContext.Response.Cache.SetCacheability(HttpCacheability.Public);
        httpContext.Response.Cache.SetLastModified(new DateTime(2000, 01, 01));
        httpContext.Response.Cache.SetExpires(new DateTime(2020, 01, 01));
        httpContext.Response.BinaryWrite(bytes);

我的播放器有这样的代码:

<div id="Player">
<audio id="audioPlayer" preload="auto" controls onplay="ReloadPlayer()">
    <source src="http://localhost:4677/Services/BasicHandler.ashx" type="audio/ogg">
        Your browser does not support the audio element.frff
</audio>

播放器工作完美的音频MP3或MP4 (AAC),但当我尝试使用Ogg,是不可能播放音频(在Firefox工作,但在Chrome是问题)。知道是什么问题吗?

无法再现Ogg音频在Chrome接受范围:字节

查看维基百科支持的格式表