Realize the method that microphone detects on a kind of webpage
Technical field
The invention belongs to networking technology area, be specifically related to realize on a kind of webpage the method that microphone detects.
Background technology
The development of, hardware soft along with the internet, multimedia messagesization is popularized, people's interchange has in daily life also used multimedia technology more, such as mobile phone, phone, speech communication etc., especially more and more is subjected to people's favor especially based on the voice-over-net communication of computer.Present speech communication is to need down loading mounting software mostly, it is to realize voice on webpage that some products are also arranged certainly, but in use find, the good microphone of these product neither ones detects to be handled, the situation of voice often appears can't hear, looking into its reason, is that the other side does not have microphone or the incorrect microphone apparatus of opening, and brings very big inconvenience to communication.Even if these products can be implemented in the line microphone and detect, also need to download some controls, realize the detection of microphone then by these control invokes local resources.So just can not accomplish green test, and these webpage controls installations are many, will influence the travelling speed of user computer.
Realize the method that microphone detects on a kind of webpage, exactly in order to solve the existing problem of present stage microphone detection mode, and can be directly at the enterprising line operate of webpage, need not to download any control, can realize green test, be a kind of popular technology of truly can popularizing, and realize that principle is simple, can embed easily in the various internet, applications.
Summary of the invention
The objective of the invention is: provide and realize the method that microphone detects on a kind of webpage.
For achieving the above object, technical scheme of the present invention is: realize on a kind of webpage may further comprise the steps the method that microphone detects:
1) user capture webpage, webpage load automatically and are used to detect microphone Flash plug-in unit, and the Flash plug-in unit calls Flash plug-in unit microphone operation A PI and obtains microphone state after loading and finishing;
2) after the Flash plug-in unit is finished dealing with microphone state, state is kept at Flash array variable the inside;
3) the Flash plug-in unit imports the data variable of preserving microphone state into by the mutual API Calls webpage of webpage function;
4) the webpage function is by handling the array variable that the Flash plug-in unit passes over, to obtain the microphone current state.
In the technique scheme, wherein step 1) comprises following process:
The user capture webpage, and load the Flash plug-in unit, the Flash plug-in unit calls Flash plug-in unit microphone operation A PI automatically and obtains microphone state after loading and finishing.
In the technique scheme, step 2 wherein) comprise following process:
After the Flash plug-in unit gets access to microphone state, handle, result comprises that the state of camera has: normal, busy, disable access, occupied are kept at the array variable the inside to result then.
In the technique scheme, wherein step 3) comprises following process:
The Flash plug-in unit will be kept at the testing result of array variable the inside, use the mutual API Calls webpage of Flash plug-in unit webpage JavaScript function, and import testing result into to the JavaScript function.
In the technique scheme, wherein step 4) comprises following process:
When webpage JavaScript function receives the testing result that the Flash plug-in unit passes over, just can on webpage, carry out further logical process, can realize carrying out the detection of microphone state.
The present invention compared with prior art has following advantage:
1) user does not need unnecessary operation and setting, and whole testing process is full-automatic;
2) can on webpage, carry out on-line operation, not need to install any software;
3) testing process fast, does not in time consume any resource;
4) by carrying out being convenient to embed other application alternately with JavaScript well.
Description of drawings
Accompanying drawing 1 in the Figure of description, Fig. 2 are detail flowcharts of the present invention.
Embodiment
Realize the method that microphone detects on a kind of webpage, may further comprise the steps:
1) user capture webpage, and load the Flash plug-in unit, the Flash plug-in unit calls Flash plug-in unit microphone operation A PI automatically and obtains microphone state after loading and finishing;
2) after the Flash plug-in unit gets access to microphone state, handle, result comprises that the state of camera has: normal, busy, disable access, occupied are kept at the array variable the inside to result then;
3) the Flash plug-in unit will be kept at the testing result of array variable the inside, use the mutual API Calls webpage of Flash plug-in unit webpage JavaScript function, and import testing result into to the JavaScript function;
When 4) webpage JavaScript function receives the testing result that the Flash plug-in unit passes over, just can on webpage, carry out further logical process, can realize carrying out the detection of microphone state.
Further describe method of the present invention below:
Referring to the accompanying drawing in the Figure of description 1, accompanying drawing 2, the user capture webpage, and load the Flash plug-in unit, the Flash plug-in unit calls Flash plug-in unit microphone operation A PI automatically and obtains microphone state after loading and finishing; After the Flash plug-in unit gets access to microphone state, handle, result comprises that the state of camera has: normal, busy, disable access, occupied are kept at the array variable the inside to result then; The Flash plug-in unit will be kept at the testing result of array variable the inside, use the mutual API Calls webpage of Flash plug-in unit webpage JavaScript function, and import testing result into to the JavaScript function; When webpage JavaScript function receives the testing result that the Flash plug-in unit passes over, just can on webpage, carry out further logical process, can realize carrying out the detection of microphone state.