我如何附上相机Spark.components.VideoDisplay [英] How do I attach camera to Spark.components.VideoDisplay

查看:182
本文介绍了我如何附上相机Spark.components.VideoDisplay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Flash Builder和创建Spark应用的Flex项目,将视频流从本地摄像头。如果我使用 mx.controls.VideoDisplay当;是没有问题的,因为它有的attachCamera(摄像头)方法。但是,星火的的VideoDisplay 组件没有该方法。我知道我可以使用内部的火花应用程序MX控制,但我想知道的:

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:

  • 是什么 spark.components.VideoDisplay mx.controls.VideoDisplay当
  • 如何连接相机 spark.components.VideoDisplay
  • 有什么好处,如果我去火花(因为它是新的,以MX库)?
  • What is the real difference between spark.components.VideoDisplay and mx.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)?

感谢。

修改:在这个文件中提到:的 Flex 4.0开始,Adobe建议您使用spark.components.VideoPlayer类来替代此类(MX。 controls.VideoDisplay)

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:

import mx.events.FlexEvent;

import org.osmf.net.StreamType;

import spark.components.mediaClasses.DynamicStreamingVideoItem;
import spark.components.mediaClasses.DynamicStreamingVideoSource;

private var _cam:DynamicStreamingVideoSource =  new DynamicStreamingVideoSource();
private var _dynVideoSource:DynamicStreamingVideoSource;

protected function application1_creationCompleteHandler(event:FlexEvent):void
{

    _dynVideoSource=new DynamicStreamingVideoSource();

    var videoItems:Vector.<DynamicStreamingVideoItem>;
    videoItems=new Vector.<DynamicStreamingVideoItem>();
    videoItems[0]=new DynamicStreamingVideoItem();

    _dynVideoSource.host= "";
    _dynVideoSource.streamType=StreamType.LIVE;
    _dynVideoSource.streamItems=videoItems;

    mycam.source=_dynVideoSource;

    var cam:Camera = Camera.getCamera(); //Camera.names[0]);
    cam.setMode(640, 480, 15);
    cam.setQuality(0, 80);
    mycam.videoObject.attachCamera(cam); 
}

这篇关于我如何附上相机Spark.components.VideoDisplay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆