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)"
Here are the specifics to get this working:
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.
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.
Shorter workaround:
In this case, the Video object can be then referenced as
camVideoDisplay.videoObject
, e.g.:Been looking for a solution to this and found the below
thanks