A kind of method that realizes that camera is closed
Technical field
The invention belongs to networking technology area, relate in particular to a kind of method that realizes that camera is closed.
Background technology
The development of, hardware soft along with the internet, people use multimedia technology more and more in daily interchange, and such as mobile phone, phone, video conference etc., especially computer based video communication technology enjoys favor especially.At present, the video communication majority needs down loading mounting software, also has some products can on webpage, realize video communication certainly.But there is a serious weak point in prior art, promptly neither one safety, close the method for camera completely.For example, the user after using camera on the computing machine, close the camera operation after, the occupied situation of camera can appear when re-using.If the camera of warning light is arranged; After the user has finished video calling; The situation that the camera warning light still is in opening can occur, that is to say, as long as the user does not close all webpages relevant with opening the camera process fully; Camera is just still reading local image, and might local image be continued to send to other network-side.
This situation occurs and be because when calling local camera through webpage connector, webpage connector is in shared user mode when browser loads, and each webpage that promptly same process is opened is shared a control.At this moment, the user closes one of them webpage, and former webpage still is in opening, thereby causes camera thoroughly not closed.The user is in video call process, and the image stream that camera is issued outward is in issued state always, if camera can not effectively be closed, very easily reveals user's privacy.Especially in internet, applications such as long-distance education, video conference, this deficiency will seriously jeopardize user's personal information security, influence the enthusiasm of user experience and internet usage product.
Summary of the invention
The invention provides a kind of method that realizes that camera is closed, realized need not to download any control, in time, effectively close camera.
In order to achieve the above object, technical scheme of the present invention is:
Realize the method that camera is closed on a kind of webpage, may further comprise the steps:
1) source user is opened the our station webpage, and webpage loads the Flash plug-in unit, and the Flash plug-in unit calls local camera;
2) user clicks and to close camera or close the page etc. and close camera when handling operation, and the invoking web page function carries out delay process automatically, and camera is closed success status carries out cycle detection, webpage is in wait for camera success closed condition;
3) webpage calls the relevant API of Flash, and camera is closed processing, camera is thoroughly closed, and modification webpage camera closed condition is successfully;
4) the webpage delay function withdraws from the circular wait state after detecting camera success closed condition automatically, and carries out the follow-up handled of webpage such as page close, thereby realizes closing based on the webpage camera.
In the technique scheme, step 1) comprises following process:
1a) source user is opened the our station webpage, and webpage loads the Flash plug-in unit automatically, when the Flash plug-in unit is opened local camera through calling the Camera.getCamera method, at this moment the camera object of opening is put into the camera array variable;
After 1b) camera is opened; When Flash calls NetStream camera image stream such as is issued, receives, records at operation, operated NetStream and NetConnection object are put into NetStream and NetConnection array variable respectively.
In the technique scheme, step 2) comprise following process:
The user clicks and to close camera or to close the page etc. can close the operation of camera the time, and webpage calls JavaScript delay process function automatically, adds the state judgment mode through circulation or recurrence, lets the page wait for the change of camera success closed condition always.
In the technique scheme, step 3) comprises following process:
3a) webpage is through the camera method for closing of JavaScript function call Flash through the ExternalInterface.addCallback registration;
3b) Flash receive JavaScript close camera instruction after; At first the NetStream array that has existed is carried out traversing operation; Each NetStream object in the array carries out cleaning operation; The attachAudio method of mainly calling the NetStream object is imported null into, the attachAudioCamera method is imported null, key assignments, close method when key assignments, play method when the publish method is imported issue into are imported reception into into, and this NetStream method is changed to null;
3c) the NetConnection array is carried out traversing operation, each the NetConnection object in the array is carried out cleaning operation, mainly call the close method of NetConnection object, and this NetConnection method is changed to null;
3d) the camera object is changed to null; To call the Camera.getCamera method and import null into; The attachCamera method of calling camera demonstration control is imported null, clear method into; And the removeChild method of calling Flash removes camera and shows control from Flash, the ExternalInterface.call method change webpage camera closed condition state that calls Flash is true;
In the technique scheme, step 4) comprises following process:
When JavaScript delay process function detects webpage camera closed condition and is true; Jump out circulation or recurrence through the break key word; Thereby stop the webpage waiting status, let webpage proceed webpage and close and wait other to handle operation, this moment, camera was thoroughly closed.
The present invention compared with prior art has the following advantages:
1) realizes safety, quick, efficient fully based on webpage.
2) utilize the interaction mechanism of webpage and Flash self, call conveniently, the process feedback in time can be guaranteed the complete camera of closing.
3) adopt all vestiges to write down and scan process to camera; Each step operation of guaranteeing camera can both be by accurate monitoring; Situation about missing when thoroughly avoiding closing; To stop the occurring generation of privacy of user, guarantee personal secrets, and can prevent effectively that camera from being taken without reason through the camera leakage problem.
4) realize that principle is simple, fully based on webpage, need not download any plug-in unit, green, environmental protection can be widely used in the internet, applications such as Web conference, long-distance education.
Realize the method that camera is closed on a kind of webpage, be intended to solve after present stage calls local camera through webpage and use, the problem that camera can not be in time, effectively close; This technology need not to download any control, need not the support of third party's application framework and application system, and principle is simple, realizes based on the control of webpage own fully, and is safe, convenient, fast, is a kind of popular technology of truly can popularizing.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, and illustrative examples of the present invention and explanation thereof are used to explain the present invention, do not constitute improper qualification of the present invention.In the accompanying drawings:
Fig. 1 is a detail flowchart of the present invention.
Embodiment
Below will and combine embodiment to specify the present invention with reference to accompanying drawing.Need to prove that under the situation of not conflicting, embodiment and the characteristic among the embodiment among the application can make up each other.
Realize the method that camera is closed on a kind of webpage, may further comprise the steps:
1) source user is opened the our station webpage, and webpage loads the Flash plug-in unit, and the Flash plug-in unit calls local camera;
2) user clicks and to close camera or close the page etc. and close camera when handling operation, and the invoking web page function carries out delay process automatically, and camera is closed success status carries out cycle detection, webpage is in wait for camera success closed condition;
3) webpage calls the relevant API of Flash, and camera is closed processing, camera is thoroughly closed, and modification webpage camera closed condition is successfully;
4) the webpage delay function withdraws from the circular wait state after detecting camera success closed condition automatically, and carries out the follow-up handled of webpage such as page close, thereby realizes closing based on the webpage camera.
Following further explain method of the present invention:
Referring to Figure of description, source user is opened the our station webpage, and webpage loads the Flash plug-in unit automatically, when the Flash plug-in unit is opened local camera through calling the Camera.getCamera method, at this moment the camera object of opening is put into the camera array variable; After camera is opened, when Flash calls NetStream camera image stream such as is issued, receives, records at operation, operated NetStream and NetConnection object are put into NetStream and NetConnection array variable respectively; The user clicks and to close camera or to close the page etc. can close the operation of camera the time, and webpage calls JavaScript delay process function automatically, adds the state judgment mode through circulation or recurrence, lets the page wait for the change of camera success closed condition always; Webpage is through the camera method for closing of JavaScript function call Flash through the ExternalInterface.addCallback registration; Flash receive JavaScript close camera instruction after; At first the NetStream array that has existed is carried out traversing operation; Each NetStream object in the array carries out cleaning operation; The attachAudio method of mainly calling the NetStream object is imported null into, the attachAudioCamera method is imported null, key assignments, close method when key assignments, play method when the publish method is imported issue into are imported reception into into, and this NetStream method is changed to null; The NetConnection array is carried out traversing operation, each the NetConnection object in the array is carried out cleaning operation, mainly call the close method of NetConnection object, and this NetConnection method is changed to null; The camera object is changed to null; To call the Camera.getCamera method and import null into; The attachCamera method of calling camera demonstration control is imported null, clear method into; And the removeChild method of calling Flash removes camera and shows control from Flash, the ExternalInterface.call method change webpage camera closed condition state that calls Flash is true; When JavaScript delay process function detects webpage camera closed condition and is true; Jump out circulation or recurrence through the break key word; Thereby stop the webpage waiting status, let webpage proceed webpage and close and wait other to handle operation, this moment, camera was thoroughly closed.
Fig. 1 is a detail flowchart of the present invention, and detailed step is following:
Step 101: beginning;
Step 102: source user is opened the our station webpage, and webpage loads the Flash plug-in unit, and Flash calls API and opens local camera;
Step 103: the user clicks and to close webpage or other when closing the camera operation, and webpage adopts the circular wait mode to wait for that camera successfully closes;
Step 104: call the relevant API of Flash, camera closed processing, close successfully after, change the camera closed condition;
Step 105: when the camera closed condition was changed into true, webpage withdrawed from circular wait automatically, carried out the webpage subsequent treatment;
Step 106: finish.
Obviously, it is apparent to those skilled in the art that above-mentioned each step of the present invention can realize with the general calculation device; They can concentrate on the single calculation element, perhaps are distributed on the network that a plurality of calculation element forms, alternatively; They can realize with the executable program code of calculation element, thereby, can they be stored in the memory storage and carry out by calculation element; And in some cases; Can carry out step shown or that describe with the order that is different from here, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is merely the preferred embodiments of the present invention, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.