如何将相机连接到

如何将相机连接到

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

问题描述

限时删除!!

我正在使用 Flash Builder 并创建了一个 spark-application Flex 项目,该项目将从本地摄像头流式传输视频.如果我使用 mx.controls.VideoDisplay;没有问题,因为它有 attachCamera(camera) 方法.但是 Spark 的 VideoDisplay 组件没有这个方法.我知道我可以在 Spark 应用程序中使用 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.VideoDisplaymx.controls.VideoDisplay 之间的真正区别是什么?
  • 如何将摄像头连接到 spark.components.VideoDisplay?
  • 如果我使用 spark 有什么优势吗(因为它对 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.control.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:38