我正在尝试使用流方法播放 .m4a 文件。但它不起作用

发布于 2024-11-26 07:36:26 字数 992 浏览 1 评论 0原文

var video:Video = new Video();
addChild(video);
var netCon:NetConnection = new NetConnection();
netCon.connect(null);
var streamNS:NetStream = new NetStream(netCon);
//streamNS.client = this;
//video.attachNetStream(streamNS);
streamNS.play("AfricanElengwen.m4a");
streamNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

function netStatusHandler(e:NetStatusEvent):void
{
    if (e.info.code == "NetStream.Play.FileStructureInvalid")
    {
        trace("The MP4's file structure is invalid.");
    } else if (e.info.code == "NetStream.Play.NoSupportedTrackFound")
    {
        trace("The MP4 doesn't contain any supported tracks");
    }
}

我从下面的链接获取此代码, http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player .html#articlecontentAdobe_numberedheader_0

我没有收到任何错误。 谁能说出什么是错误吗?

var video:Video = new Video();
addChild(video);
var netCon:NetConnection = new NetConnection();
netCon.connect(null);
var streamNS:NetStream = new NetStream(netCon);
//streamNS.client = this;
//video.attachNetStream(streamNS);
streamNS.play("AfricanElengwen.m4a");
streamNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

function netStatusHandler(e:NetStatusEvent):void
{
    if (e.info.code == "NetStream.Play.FileStructureInvalid")
    {
        trace("The MP4's file structure is invalid.");
    } else if (e.info.code == "NetStream.Play.NoSupportedTrackFound")
    {
        trace("The MP4 doesn't contain any supported tracks");
    }
}

I get this code from the below link,
http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player.html#articlecontentAdobe_numberedheader_0

I didn't get any error.
Can anyone say what is the bug?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

街道布景 2024-12-03 07:36:26

可能是您的 .m4a 文件比特率或 Flash 播放器不支持的内容。更好的方法是你可以将其转换为 mp3 文件然后使用它。

May be your .m4a file bit rate or something unsupportable to the flash player. Better way is u can convert it into a mp3 file and then use it.

我喜欢麦丽素 2024-12-03 07:36:26

我刚刚遇到了类似的 NetStream.Play.FileStructureInvalid 错误问题,经过几个小时的研究发现,如果服务器在交付之前对内容进行 gzip 压缩,则 Firefox (PC/Mac) 中似乎会发生这种情况。在 Safari (Mac) 和其他少数浏览器中,它运行良好。

在 Firefox 中使用 Live HTTP Headers 插件显示内容长度没有与响应一起发送,并且提醒我它也被 gzip 压缩——我认为这不是一个可能的问题。

对本地 .htaccess 文件的快速破解证明 gzip 是罪魁祸首。禁用它后,一切都运行良好:

SetEnv no-gzip dont-vary

我们返回到 Apache 配置并删除了 .mp4 文件的压缩,以正确的方式进行操作(删除了我之前对 .htaccess 的黑客攻击),一切都运行良好!

I just went through similar issues with the NetStream.Play.FileStructureInvalid error, and after a couple hours of digging around it turns out that this seems to happen in Firefox (PC/Mac) if the server is gzipping the content prior to delivery. In Safari (Mac) and few other browsers, it worked fine.

Using the Live HTTP Headers add-on in Firefox showed that the content-length wasn't being sent along with the response, and I was reminded that it was also being gzipped -- something I didn't consider to be a possible issue.

A quick hack to a local .htaccess file proved gzip to be the culprit. After disabling it, it all worked fine:

SetEnv no-gzip dont-vary

We went back to the Apache config and removed the compression from .mp4 files to do it the right way (removing my earlier hack to the .htaccess), and all works well!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文