使用 Adobe Cirrus 的 netStream 状态事件问题
基本上我会尝试总结一下。我有一堆潜在的随机字符串用于 recvStream.play("randomstring");
然后我有一个计时器每 5 秒检查一次运行事件侦听器的函数:
recvStream.addEventListener(NetStatusEvent.NET_STATUS,
netConnectionHandler);
然后我在 switch 语句中思考我可以使用它来检查它是否是活动流,或者让它搜索另一个应该活动的流或停止计时器并让它播放。
// i was thinking this would verify it's playing and then that's it
case "NetStream.Play.Start" :
trace("ITS PLAYING YOU SHOULD SEE SOMETHING");
timer.stop();
break;
// i was thinking i could use this to see if the string is nothing then the timer would run again
case "NetStream.Buffer.Empty" :
trace("THE BUFFER IS EMPTY KEEP LOOKING");
//code to look again
break;
//I also tried NetStream.Play.StreamNotFound instead of NetStream.Buffer.Empty didn't work either
但事实并非如此。我应该使用其他东西来代替 NetStream.Buffer.Empty 吗?还是其他什么东西都在一起?
我在 Flash CS5 中使用 Actionscript 3,并且使用 Cirrus RTMFP http://labs.adobe.com/technologies/cirrus/
Basically i'll try and sum this up. I have a bunch of potential random strings for recvStream.play("randomstring");
then i have a timer checking every 5 seconds on a function that runs an event listener:
recvStream.addEventListener(NetStatusEvent.NET_STATUS,
netConnectionHandler);
then im thinking in a switch statement i can use it to check if it's an active stream or not to either have it search for another stream that should be active or stop the timer and let it play.
// i was thinking this would verify it's playing and then that's it
case "NetStream.Play.Start" :
trace("ITS PLAYING YOU SHOULD SEE SOMETHING");
timer.stop();
break;
// i was thinking i could use this to see if the string is nothing then the timer would run again
case "NetStream.Buffer.Empty" :
trace("THE BUFFER IS EMPTY KEEP LOOKING");
//code to look again
break;
//I also tried NetStream.Play.StreamNotFound instead of NetStream.Buffer.Empty didn't work either
But it really doesn't work like that. Is there something else I should be using instead of NetStream.Buffer.Empty ? Or something else all together?
I'm using Actionscript 3 in Flash CS5 and I'm using Cirrus RTMFP
http://labs.adobe.com/technologies/cirrus/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不明白为什么当您附加了一个侦听器来告诉您流的状态时,您为什么要让计时器检查流:
显然,您还应该考虑在您之前验证随机字符串的正确性调用recvStream.play() - 这比故意让NetStream失败更干净,并且不会造成网络压力。
I don't get why you'd have a timer check the stream, when you have a listener attached to tell you about its status:
Obviously, you should also consider validating your random string's correctness before you even call
recvStream.play()
- which would be cleaner than deliberately letting your NetStream fail, and not strain the network.