From 06bc1308950b2fd37c2e33df4abf65ba7c47b10e Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 14 Dec 2012 16:47:30 +0000 Subject: [PATCH] - implement view webcam standalone --- .../resources/prod/lib/bbb_api_cam_view.js | 4 ++-- .../src/WebcamPreviewStandalone.mxml | 2 +- .../src/WebcamViewStandalone.mxml | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/bigbluebutton-client/resources/prod/lib/bbb_api_cam_view.js b/bigbluebutton-client/resources/prod/lib/bbb_api_cam_view.js index b0943c312b..5c6357e8c1 100755 --- a/bigbluebutton-client/resources/prod/lib/bbb_api_cam_view.js +++ b/bigbluebutton-client/resources/prod/lib/bbb_api_cam_view.js @@ -16,7 +16,7 @@ /** * View user's webcam. */ - CAM_VIEW.viewCamera = function(url, streamName) { + CAM_VIEW.viewWebcamStream = function(url, streamName) { var swfObj = getSwfObj(); if (swfObj) { swfObj.viewCamera(url, streamName); @@ -26,7 +26,7 @@ /** * Stop viewing user's webcam. */ - CAM_VIEW.stopViewCamera = function() { + CAM_VIEW.stopViewWebcamStream = function() { var swfObj = getSwfObj(); if (swfObj) { swfObj.stopViewCamera(); diff --git a/bigbluebutton-client/src/WebcamPreviewStandalone.mxml b/bigbluebutton-client/src/WebcamPreviewStandalone.mxml index 54e06e8aa4..396b5b8ba6 100755 --- a/bigbluebutton-client/src/WebcamPreviewStandalone.mxml +++ b/bigbluebutton-client/src/WebcamPreviewStandalone.mxml @@ -54,7 +54,7 @@ trace('WebcamSA::onCreationComplete'); initExternalInterface(); - displayCamera("0", 30, 10, 0, 90); +// displayCamera("0", 30, 10, 0, 90); } private function initExternalInterface():void { diff --git a/bigbluebutton-client/src/WebcamViewStandalone.mxml b/bigbluebutton-client/src/WebcamViewStandalone.mxml index 30dab23018..b2119e790b 100755 --- a/bigbluebutton-client/src/WebcamViewStandalone.mxml +++ b/bigbluebutton-client/src/WebcamViewStandalone.mxml @@ -53,12 +53,21 @@ $Id: $ private function onCreationComplete():void{ _videoHolder = new UIComponent(); - _videoHolder.addChild(_video); this.addChild(_videoHolder); + this.minWidth = _minWidth; this.minHeight = _minHeight; - + + initExternalInterface(); + } + + private function initExternalInterface():void { + trace('WebcamSA::initExternalInterface'); + if (ExternalInterface.available) { + ExternalInterface.addCallback("startViewCameraStream", handleStartViewCameraRequest); + ExternalInterface.addCallback("stopViewCameraStream", handleStopViewCamera); + } } private function connect(url:String):void { @@ -102,13 +111,17 @@ $Id: $ private function onSecurityError(event:NetStatusEvent):void{ } - public function viewWebcam(url:String, stream:String):void { + private function handleStartViewCameraRequest(url:String, stream:String):void { _url = url; _stream = stream; connect(url); } - public function playWebcamStream():void { + public function handleStopViewCamera():void { + ns.close(); + } + + private function playWebcamStream():void { ns = new NetStream(nc); ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus ); ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError); @@ -138,6 +151,7 @@ $Id: $ _video.filters = [filter]; } + _videoHolder.addChild(_video); ns.play(_stream); }