Summary of the invention
In order to overcome the deficiencies in the prior art, the object of the present invention is to provide the method and apparatus that in a kind of browser, video fenestella is play, realize the video elementary in more stable identification webpage and extracted and move on in new window, do not affect the broadcasting of video, do not need to reload, and the original size of the size adaptation video of window, and hide the unsteady element of other pages, experience preferably to user.
For addressing the above problem, the technical solution adopted in the present invention is as follows:
Technical scheme one:
The method that in browser, video fenestella is play, comprises the following steps:
Steps A: obtain video elementary selected in current web page window;
Step C: create one be independent of current web page window for holding and the independent vide window of displaying video;
Step D: other element except video elementary in the current web page window in steps A is hidden;
Step e: the current web page window in steps A is moved and is bound in independent vide window.
Before steps A, also comprise:
Steps A 1: determine whether video elementary according to user's mouse element type pointed in current web page window, be if so, labeled as selected video elementary and perform step A; If not, execution step A2;
Steps A 2: judge whether mouse element type pointed is iframe element, if so, performs step A3, and if not, the element that represents this mouse indication is not video elementary, process ends;
Steps A 3: repeat to judge in iframe element whether be nested with another iframe element, until determine non-iframe element, execution step A4;
Steps A 4: judge that whether this non-iframe element is video elementary, is if so, labeled as selected video elementary and performs step A; If not, the element that represents this mouse indication is not video elementary, process ends.
Between steps A and step C, also comprise:
Step B: the reply of initiating whether agree to the request that fenestella is play and receiving user, if agree to, performs step C; If refusal, flow process finishes.
In step C, also comprise: the video window size in obtaining step A in selected video elementary, and it is consistent with this video window size to adjust the size of independent vide window.
In step C, also comprise: the attribute that independent vide window is set for can drag and size adjustable.
After step e, also comprise,
Step F: add the instruction for the current web page window solution of steps A being tied up to recovery in independent vide window.
Technical scheme two:
The device that in browser, video fenestella is play, comprises with lower module:
Video elementary acquisition module: for obtaining the selected video elementary of current web page window;
Create independent window module: for create one be independent of current web page window for holding and the independent vide window of displaying video;
Hide element module: for other element except selected video elementary in the current web page window of video elementary acquisition module is hidden;
Webpage separation module: for the current web page window of video elementary acquisition module is moved and is bound in independent vide window.
Before creating independent window module, also comprise:
Element judge module A: for determining whether video elementary according to user's mouse at current web page window element type pointed, be if so, labeled as selected video elementary and carry out video elementary acquisition module; If not, carry out element judge module B;
Element judge module B: for judging whether mouse element type pointed is iframe element, if so, carries out element judge module C, and if not, the element that represents this mouse indication is not video elementary, process ends;
Element judge module C: judge for repeating whether iframe element is nested with another iframe element, until determine non-iframe element, carry out element judge module D;
Element judge module D: for judging that whether this non-iframe element is video elementary, is if so, labeled as selected video elementary and carries out video elementary acquisition module; If not, the element that represents this mouse indication is not video elementary, process ends.
Between video elementary acquisition module and establishment independent window module, also comprise:
Independent window request module: for the reply of initiating whether agree to the request that fenestella is play and receiving user, if agree to, carry out and create independent window module; If refusal, flow process finishes.
Also comprise creating in independent window module: the video window size in obtaining video elementary acquisition module in selected video elementary, and it is consistent with this video window size to adjust the size of independent vide window.Also comprise creating in independent window module: the attribute that independent vide window is set for can drag and size adjustable.
After video separation module, also comprise window restoration request module: for add the instruction for the current web page window solution of video elementary acquisition module being tied up to recovery at independent vide window.
Compared to existing technology, beneficial effect of the present invention is: after other element except video elementary in current web page window is hidden, be transferred in independent vide window, can not only make video protrude, user's the interface of watching video is purer with making, and do not affect the broadcasting of video, do not need to replay video.Whether in addition, can better more stably judge user's mouse element pointed is video elementary, and the video elementary of avoiding being nested in iframe is left in the basket.Moreover, the attribute of independent vide window for can drag and size adjustable, this setting gives the degree of freedom of user's maximum, meets the video tour demand of different crowd.
Embodiment
Below, by reference to the accompanying drawings and embodiment, the present invention is described further:
Embodiment 1:
Process flow diagram with reference to figure 1 for the method for video fenestella broadcasting in a kind of browser of the present invention, realize the method and comprise following content:
Steps A: obtain video elementary selected in current web page window.In this step, how to obtain video elementary selected in current web page window very important, therefore before this step, also have the step about video elementary selected in how obtaining web page windows.
User typically uses mouse and in webpage, browses or select interested content, therefore, setting steps A1: determine whether video elementary according to user's mouse element type pointed in current web page window, be if so, labeled as selected video elementary and perform step A; If not, execution step A2.In present webpage, video is normally play in webpage with flash form, and therefore in steps A 1, the video elementary of indication can be flash, certainly, can be also other video elementary.
In the page, having a lot of element types, as picture, word, video etc., wherein have a kind of element iframe, is a framework, also can be understood as subpage frame, can also comprise other iframe in iframe, in other words can multiple iframe nested.Therefore, if detect in steps A 1, element is not video elementary, and likely video elementary is to be nested in iframe element, therefore needs to perform step A2.
Steps A 2: judge that whether mouse element type pointed is iframe element, if so, performs step A3; If not, the element that represents this mouse indication is not video elementary, process ends.In this step, after the element that judges mouse indication is iframe, likely video elementary is to be nested in multilayer iframe, whether needs further judge lower one deck or is iframe element, therefore needs to perform step A3.If be not iframe element in judgement in steps A 2, represent that this element is not video elementary, whole flow process finishes, and waits for the element of other positions of mouse-pointing of user, then starts to carry out judgement from A1 step.
Steps A 3: repeat to judge in iframe element whether be nested with another iframe element, until determine non-iframe element, execution step A4.This judgement of recursive call is always until while determining non-iframe element, further judge that what element non-iframe is, execution step A4.
Steps A 4: judge that whether this non-iframe element is video elementary, is if so, labeled as selected video elementary and performs step A; If not, the element that represents this mouse indication is not video elementary, process ends.In this step, if judge, this non-iframe element is video elementary, represent that this video elementary is nested in iframe, if be judged as NO, represent that mouse element pointed is not video elementary, whole flow process finishes, and waits for the element of other positions of mouse-pointing of user, then starts to carry out judgement from A1 step.
Above-mentioned A1, A2, A3 and A4 step judge whether be video elementary, the video elementary of avoiding being nested in iframe is left in the basket if can better more stably judge user's mouse element pointed.
After the element of definite mouse indication is video elementary in above-mentioned steps A, enter step B.
Step B: the reply of initiating whether agree to the request that fenestella is play and receiving user, if agree to, performs step C; If refusal, flow process finishes.This step is initiated the request that whether needs fenestella to play to user, concrete mode can be to eject a choice menus in the edge of video.If user selects to refuse the request that fenestella is play, finish whole flow process.Further, select to refuse user after the request of fenestella broadcasting, in the session of this current web page window, will no longer initiate for this video elementary the request that fenestella is play.Be user while again mouse being moved in this video elementary, no longer eject choice menus, but only limit to this session, again open this webpage and still have choice menus.
Step C: create one be independent of current web page window for holding and the independent vide window of displaying video.Further, video window size in obtaining step A in selected video elementary, and the size of adjusting independent vide window is consistent with this video window size, be that the size that newly-built independent vide window initial size is original with video is consistent, can make video the most ideally move in newly-built independent vide window.
Further again, the attribute that independent vide window is set for can drag and size adjustable, this setting gives the degree of freedom of user's maximum, to the size of the unsatisfied user's capable of regulating of the original size of video independent vide window, meets the video tour demand of different crowd.
In order to give prominence to better independent vide window, and in order to make the user can be more absorbed when the video of watching in independent vide window, after step C, need to perform step D: other element except selected video elementary in the current web page window in steps A is hidden.This step can be hidden other element except selected video in current page, Information hiding such as floating on advertisement on webpage can also be fallen, and only leaves selected video elementary, makes user's the interface of watching video purer.
Step e: current web page window in steps A is moved and is bound in independent vide window.In this step, be only that the web page windows of having hidden other element except selected video elementary is moved in independent vide window, therefore can't affect the broadcasting of video.Because independent vide window can be adjusted size, therefore this video elementary also should be set and follow the change of window size and change, specifically can arrange as follows the attribute of video elementary: " position:fixed; Top:0px; Left:0px; Width:100%; Height:100%; Background-color:rgb (0,0,0); Z-index:2147483647; Margin-top:0px; Margin-left:0px; ".
Further, after execution step E, carry out again F: in independent vide window, add the instruction for the current web page window solution of steps A being tied up to recovery.In independent vide window, add a menu or button, for allowing customer selecting that other element of former web page windows is removed and to be hidden, and from independent vide window, reverting back the web page windows pattern in steps A, the process of this reduction is a reverse process.After reduction, video will continue to play in the web page windows after reduction, and independent vide window will be closed.
Embodiment 2:
The device that in browser, video fenestella is play, comprises with lower module:
Video elementary acquisition module: for obtaining the selected video elementary of current web page window;
Create independent window module: for create one be independent of current web page window for holding and the independent vide window of displaying video;
Hide element module: for other element except selected video elementary in the current web page window of video elementary acquisition module is hidden;
Webpage separation module: for the current web page window of video elementary acquisition module is moved and is bound in independent vide window.
Before creating independent window module, also comprise:
Element judge module A: for determining whether video elementary according to user's mouse at current web page window element type pointed, be if so, labeled as selected video elementary and carry out video elementary acquisition module; If not, carry out element judge module B;
Element judge module B: for judging whether mouse element type pointed is iframe element, if so, carries out element judge module C, and if not, the element that represents this mouse indication is not video elementary, process ends;
Element judge module C: judge for repeating whether iframe element is nested with another iframe element, until determine non-iframe element, carry out element judge module D;
Element judge module D: for judging that whether this non-iframe element is video elementary, is if so, labeled as selected video elementary and carries out video elementary acquisition module; If not, the element that represents this mouse indication is not video elementary, process ends.
Between video elementary acquisition module and establishment independent window module, also comprise:
Independent window request module: for the reply of initiating whether agree to the request that fenestella is play and receiving user, if agree to, carry out and create independent window module; If refusal, flow process finishes.
Also comprise creating in independent window module: the video window size in obtaining video elementary acquisition module in selected video elementary, and it is consistent with this video window size to adjust the size of independent vide window.Also comprise creating in independent window module: the attribute that independent vide window is set for can drag and size adjustable.
After video separation module, also comprise window restoration request module: for add the instruction for the current web page window solution of video elementary acquisition module being tied up to recovery at independent vide window.
To one skilled in the art, can be according to technical scheme described above and design, make other various corresponding changes and deformation, and within these all changes and deformation all should belong to the protection domain of the claims in the present invention.