如何将相机附加到 Spark.components.VideoDisplay
我正在使用 Flash Builder 并创建了一个 Spark 应用程序 Flex 项目,该项目将从本地摄像机流式传输视频。如果我使用 mx.controls.VideoDisplay ;没有问题,因为它有 attachCamera(camera)
方法。但 Spark 的 VideoDisplay 组件没有该方法。我知道我可以在 Spark 应用程序中使用 mx 控件,但我想知道:
spark.components.VideoDisplay
和mx.controls.VideoDisplay
之间的真正区别是什么?- 如何将摄像头连接到
spark.components.VideoDisplay
? - 如果我使用 Spark 有什么优势(因为它比 mx 库更新)?
谢谢。
编辑:在文档中提到:“从 Flex 4.0 开始,Adobe 建议您使用 Spark.components.VideoPlayer 类作为此类的替代品。(mx.controls.VideoDisplay )”
I'm using Flash Builder and created a spark-application Flex project that will stream video from the local camera. If I use mx.controls.VideoDisplay
; there is no problem since it has attachCamera(camera)
method. But Spark's VideoDisplay
component does not have that method. I know I can use mx controls inside a Spark app but I want to know:
- What is the real difference between
spark.components.VideoDisplay
andmx.controls.VideoDisplay
? - How do I attach camera to
spark.components.VideoDisplay
? - Is there any advantages if I go with spark (since it's newer to mx library)?
thanks.
EDIT: In the documentation this is mentioned: "Starting with Flex 4.0, Adobe recommends that you use the spark.components.VideoPlayer class as an alternative to this class. (mx.controls.VideoDisplay)"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以下是使其发挥作用的具体细节:
Here are the specifics to get this working:
直接地说,答案是您无法将摄像头连接到 Spark
VideoDisplay
。对不起。我也试图实现这一点,但我必须默认使用 mxVideoDisplay
并且使用它没有任何问题:)Spark 较新,我也更喜欢尽可能使用它,但在这个情况下,您只需要使用 MX 控件即可。它发生了。
Straight up, the answer is that you can't attach a camera to the Spark
VideoDisplay
. Sorry. I was trying to make this happen too, but I had to default to the mxVideoDisplay
and there's nothing wrong with using it :)Spark is newer and I prefer to use it whenever possible too, but in this case, you just need to use the MX control. It happens.
我尝试将相机附加到
videoDisplay.videoObject
- 但 videoObject 始终为 null,这会引发错误。为了解决这个问题,我创建了一个虚拟 DynamicStreamingVideoObject 并将其作为源传递
,然后在应用程序的creationComplete 处理程序中我这样做了,
这解决了问题。
I tried to attach the camera to
videoDisplay.videoObject
- but the videoObject was always null, which throws an error.To resolve that I created a dummy DynamicStreamingVideoObject and passed it as the source
then, in the creationComplete handler of the application i did this
this resolved the issue.
一直在寻找解决方案,并找到了以下内容,
谢谢
Been looking for a solution to this and found the below
thanks
更短的解决方法:
在这种情况下,可以将 Video 对象引用为 camVideoDisplay.videoObject,例如:
Shorter workaround:
In this case, the Video object can be then referenced as
camVideoDisplay.videoObject
, e.g.: