我正在尝试使用流方法播放 .m4a 文件。但它不起作用
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是您的 .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.
我刚刚遇到了类似的 NetStream.Play.FileStructureInvalid 错误问题,经过几个小时的研究发现,如果服务器在交付之前对内容进行 gzip 压缩,则 Firefox (PC/Mac) 中似乎会发生这种情况。在 Safari (Mac) 和其他少数浏览器中,它运行良好。
在 Firefox 中使用 Live HTTP Headers 插件显示内容长度没有与响应一起发送,并且提醒我它也被 gzip 压缩——我认为这不是一个可能的问题。
对本地 .htaccess 文件的快速破解证明 gzip 是罪魁祸首。禁用它后,一切都运行良好:
我们返回到 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:
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!