3

我们期待开发一个非常有趣的社区门户,帮助用户在整个社区中播放他们的实时视频。我一直在查看 ustream.tv、justin.tv 等网站,并想知道他们使用什么/如何技术来做到这一点。

在过去的几天里,我做了很多研究,检查媒体以有效地做到这一点,并找出该领域的一些领先公司,如 Ooyala.com、brightcove.com,提供服务器/技术以在全球范围内无缝播放视频. 我将很快与这些提供商中的任何一个签约。

所以我的问题是,我的网站究竟如何捕捉来自用户 cam 的实时提要,将流发送到 ooyala/brightcove 并进一步将其广播给其他社区用户。

到目前为止,我发现 Flash 8/Flex 确实提供了一些关于从用户 cam 获取流的输入。

我想知道你们中是否有人以前做过这方面的工作/可以说明我的方法应该是怎样的。

提前致谢。开发-drupal

4

1 回答 1

0

简单的方法是使用带有 Red5 的 Flash/Flex 客户端http://osflash.org/red5

Flash Player 有一种使用摄像机的方法,而 Red5 服务器是一个开源 Flash 服务器,它将记录客户端流。

我建议设置 Red5 并使用它。它可以满足您的一切需求。只需查看 API 并开始编写测试应用程序。

如何从用户相机获取视频:

package {
    import flash.display.Sprite;
    import flash.media.Camera;
    import flash.media.Video;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.StatusEvent;
    import flash.events.MouseEvent;
    import flash.system.SecurityPanel;
    import flash.system.Security;

    public class Camera_getCameraExample extends Sprite {
        private var myTextField:TextField;
        private var cam:Camera;
        private var t:Timer = new Timer(1000);

        public function Camera_getCameraExample() {
            myTextField = new TextField();
            myTextField.x = 10;
            myTextField.y = 10;
            myTextField.background = true;
            myTextField.selectable = false;
            myTextField.autoSize = TextFieldAutoSize.LEFT;    

            cam = Camera.getCamera();

            if (!cam) {
                myTextField.text = "No camera is installed.";

            } else if (cam.muted) {
                myTextField.text = "To enable the use of the camera,\n"
                                 + "please click on this text field.\n" 
                                 + "When the Flash Player Settings dialog appears,\n"
                                 + "make sure to select the Allow radio button\n" 
                                 + "to grant access to your camera.";

                myTextField.addEventListener(MouseEvent.CLICK, clickHandler);

            }else {
                myTextField.text = "Connecting";
                connectCamera(); 
            }

            addChild(myTextField);

            t.addEventListener(TimerEvent.TIMER, timerHandler);
        }

        private function clickHandler(e:MouseEvent):void {
            Security.showSettings(SecurityPanel.PRIVACY);

            cam.addEventListener(StatusEvent.STATUS, statusHandler);

            myTextField.removeEventListener(MouseEvent.CLICK, clickHandler);
        }

        private function statusHandler(event:StatusEvent):void {

            if (event.code == "Camera.Unmuted") {
                connectCamera(); 
                cam.removeEventListener(StatusEvent.STATUS, statusHandler);
            }
        }

        private function connectCamera():void {
                var vid:Video = new Video(cam.width, cam.height);
                vid.x = 10;
                vid.y = 10;
                vid.attachCamera(cam);
                addChild(vid);    

                t.start();
        }

        private function timerHandler(event:TimerEvent):void {
            myTextField.y = cam.height + 20;
            myTextField.text = "";
            myTextField.appendText("bandwidth: " + cam.bandwidth + "\n");
            myTextField.appendText("currentFPS: " + Math.round(cam.currentFPS) + "\n");
            myTextField.appendText("fps: " + cam.fps + "\n");
            myTextField.appendText("keyFrameInterval: " + cam.keyFrameInterval + "\n");
        }
    }
}

如何将视频发送到 BRIGHT COVE

他们有一个刚刚阅读过的 API。

于 2010-03-04T21:22:32.007 回答