- implement view webcam standalone
This commit is contained in:
parent
30911ef181
commit
06bc130895
@ -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();
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
trace('WebcamSA::onCreationComplete');
|
||||
initExternalInterface();
|
||||
displayCamera("0", 30, 10, 0, 90);
|
||||
// displayCamera("0", 30, 10, 0, 90);
|
||||
}
|
||||
|
||||
private function initExternalInterface():void {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user