首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >视频直播网站

视频直播网站
EN

Stack Overflow用户
提问于 2010-03-04 21:00:41
回答 1查看 2.9K关注 0票数 3

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

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

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

到目前为止,我发现Flash8/ Flex确实提供了一些从users cam获取流的输入。

我想知道你们中是否有人以前做过这方面的工作/可以提供一些关于我的方法的确切程度的信息。

提前谢谢。dev-drupal

EN

回答 1

Stack Overflow用户

发布于 2010-03-05 05:22:32

最简单的方法是在Red5 http://osflash.org/red5中使用闪存/Flex

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

我建议设置Red5并使用它。它能做你需要的一切。只需查看API并开始编写测试应用程序即可。

如何从用户摄像头获取视频:

代码语言:javascript
复制
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,只要读一下就行了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2379389

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档