Summary of the invention
Object of the present invention is intended at least solve one of described technological deficiency.
For this reason, one object of the present invention is to propose a kind of Play Control policy control method of Web player, the method can be monitored various broadcasting fillings in real time in player plays process, and process for various states, and without multiple tactful code is coupled in service logic, can realize Dynamic Thermal plug strategy.
Another object of the present invention is to propose a kind of Play Control policy control device of Web player.
For reaching described object, the embodiment of first aspect present invention discloses a kind of Play Control policy control method of Web player, comprises the following steps: Web player carries out the broadcasting of audio frequency and/or video file according to user instruction; Monitor in the broadcasting of described Web player, check player method call to generate player method recalls information, monitor the broadcast state of described audio frequency and/or video file to generate broadcast state information simultaneously; Mate with default multiple Play Control strategies according to described player method recalls information and described broadcast state information; And if when a Play Control strategy matching in described player method recalls information and described broadcast state information and described multiple Play Control strategy, controlled according to the described Play Control strategy matching.
According to the Play Control policy control method of the Web player of the embodiment of the present invention, utilize action listener mechanism, the change of playing the method call of kernel in playing process and broadcast state by monitoring realizes monitors different broadcast states and various states is processed, without multiple tactful code is coupled in service logic, can realize Dynamic Thermal plug strategy.And, can expand various dissimilar broadcast strategy assemblies by the present invention, and owing to utilizing action listener mechanism, can realize the policy components that dynamic load is different and put logic without revising main broadcaster, autgmentability is strong.
For reaching described object, the embodiment of second aspect present invention discloses a kind of Play Control policy control device of Web player, comprising: Web player, for carry out the broadcasting of audio frequency and/or video file according to user instruction; Monitoring module, for monitor in the broadcasting of described Web player, check player method call to generate player method recalls information, monitor the broadcast state of described audio frequency and/or video file to generate broadcast state information simultaneously; Matching module, for mating with default multiple Play Control strategies according to described player method recalls information and described broadcast state information; And control module, for when the Play Control strategy matching of described player method recalls information and described broadcast state information and described multiple Play Control strategies, control according to the described Play Control strategy matching.
According to the Play Control policy control method of the Web player of the embodiment of the present invention, utilize action listener mechanism, the change of playing the method call of kernel in playing process and broadcast state by monitoring realizes monitors different broadcast states and various states is processed, without multiple tactful code is coupled in service logic, can realize Dynamic Thermal plug strategy.
The aspect that the present invention is additional and advantage in the following description part provide, and part will become obviously from the following description, or recognize by practice of the present invention.
Embodiment
Describe embodiments of the invention below in detail, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has the element of identical or similar functions from start to finish.Be exemplary below by the embodiment being described with reference to the drawings, only for explaining the present invention, and can not be interpreted as limitation of the present invention.
In description of the invention, it will be appreciated that, term " longitudinally ", " laterally ", " on ", orientation or the position relationship of the indication such as D score, 'fornt', 'back', " left side ", " right side ", " vertically ", " level ", " top ", " end " " interior ", " outward " be based on orientation shown in the drawings or position relationship, only the present invention for convenience of description and simplified characterization, rather than indicate or imply that the device of indication or element must have specific orientation, construct and operation with specific orientation, therefore can not be interpreted as limitation of the present invention.
In description of the invention, it should be noted that, unless otherwise prescribed and limit, term " installation ", " being connected ", " connection " should be interpreted broadly, for example, can be mechanical connection or electrical connection, also can be the connection of two element internals, can be to be directly connected, and also can indirectly be connected by intermediary, for the ordinary skill in the art, can understand as the case may be the concrete meaning of described term.
Describe according to the Play Control policy control method of the Web player of the embodiment of the present invention below with reference to accompanying drawing.
A Play Control policy control method for Web player, comprises the following steps: Web player carries out the broadcasting of audio frequency and/or video file according to user instruction; That in the broadcasting of monitoring Web player, checks player method calls to generate player method recalls information, monitors the broadcast state of audio frequency and/or video file to generate broadcast state information simultaneously; Mate with default multiple Play Control strategies according to player method recalls information and broadcast state information; And if when a Play Control strategy matching in player method recalls information and described broadcast state information and multiple Play Control strategy, controlled according to the Play Control strategy matching.
Fig. 1 is the flow chart of the Play Control policy control method of Web player according to an embodiment of the invention.
As shown in Figure 1, comprise the steps according to the Play Control policy control method of the Web player of the embodiment of the present invention.
Step S101, Web player carries out the broadcasting of audio frequency and/or video file according to user instruction.
Step S102, that in the broadcasting of monitoring Web player, checks player method calls to generate player method recalls information, monitors the broadcast state of audio frequency and/or video file to generate broadcast state information simultaneously.
In the present invention, utilize action listener mechanism, play the method call of kernel in playing process and the change of broadcast state by monitoring, realize the object of monitoring different broadcast states.
In one embodiment of the invention, player method recalls information includes but not limited to load resource, starts to play, suspends and play, stop playing and arranging playing progress rate.
In another embodiment of the present invention, broadcast state information include but not limited in connection resource, in play buffering, play in, suspend in, play abnormal and play and finish.
Step S 103, mates with default multiple Play Control strategies according to player method recalls information and broadcast state information.
In one embodiment of the invention, play Play Control strategy and comprise at least one player method recalls information and at least one broadcast state information.For example, Play Control strategy can be for when player method recalls information is for loading resource, and broadcast state information is to exceed time in connection resource predetermined time when threshold value, triggers predetermined processing logic.
In one embodiment of the invention, Play Control strategy can be write by developer or user.Thus, can expand various dissimilar broadcast strategy assemblies by the present invention, and owing to utilizing action listener mechanism, can realize the policy components that dynamic load is different and put logic without revising main broadcaster, be the facilitating property of expansion of broadcast strategy.
Step S104, if when a Play Control strategy matching in player method recalls information and broadcast state information and multiple Play Control strategy, controls according to the Play Control strategy matching.
For example, when loading after resource, occur in connecting that the time of state do not enter broadcast state after exceeding 30 seconds, can regard as and connect overtimely, control and be switched to next song and play.
According to the Play Control policy control method of the Web player of the embodiment of the present invention, utilize action listener mechanism, the change of playing the method call of kernel in playing process and broadcast state by monitoring realizes monitors different broadcast states and various states is processed, without multiple tactful code is coupled in service logic, can realize Dynamic Thermal plug strategy.And, can expand various dissimilar broadcast strategy assemblies by the present invention, and owing to utilizing action listener mechanism, can realize the policy components that dynamic load is different and put logic without revising main broadcaster, autgmentability is strong.
Describe according to the Play Control policy control device of the Web browser of the embodiment of the present invention below with reference to accompanying drawing.
A Play Control policy control device for Web browser, comprising: Web player, for carry out the broadcasting of audio frequency and/or video file according to user instruction; Monitoring module, for monitor in the broadcasting of Web player, check player method call to generate player method recalls information, monitor the broadcast state of audio frequency and/or video file to generate broadcast state information simultaneously; Matching module, for mating with default multiple Play Control strategies according to player method recalls information and broadcast state information; And control module, for when the Play Control strategy matching of player method recalls information and broadcast state information and multiple Play Control strategies, control according to the Play Control strategy matching.
Fig. 2 is the structured flowchart of the Play Control policy control device of Web player according to an embodiment of the invention.As shown in Figure 2, comprise according to the Play Control policy control device of the Web player of the embodiment of the present invention: Web player 10, monitoring module 20, matching module 30 and control module 40.
Web player 10 is for carrying out the broadcasting of video and/or video file according to user instruction.
Monitoring module 20 for monitor in the broadcasting of Web player 10, check player method call to generate player method recalls information, monitor the broadcast state of audio frequency and/or video file to generate broadcast state information simultaneously.
Particularly, in an embodiment of the present invention, utilize action listener mechanism, play the method call of kernel in playing process and the change of broadcast state by monitoring, realize the object of monitoring different broadcast states.Wherein, player method recalls information can include but not limited to load resource, starts to play, suspend and play, stop playing and arranging playing progress rate.During broadcast state information can include but not limited in connection resource, in play buffering, play, suspend in, play abnormal and play and finish.
Matching module 130 is for mating with default multiple Play Control strategies according to player method recalls information and broadcast state information.
Particularly, in one embodiment of the invention, play Play Control strategy and comprise at least one player method recalls information and at least one broadcast state information.For example, Play Control strategy can be for when player method recalls information is for loading resource, and broadcast state information is to exceed time in connection resource predetermined time when threshold value, triggers predetermined processing logic.
Control module 140 is for when the Play Control strategy matching of player method recalls information and broadcast state information and multiple Play Control strategies, according to the broadcasting of the Play Control policy control Web player matching.
For example, when loading after resource, occur in connecting that the time of state do not enter broadcast state after exceeding 30 seconds, can regard as and connect overtimely, control and be switched to next song and play.
According to the Play Control policy control device of the Web player of the embodiment of the present invention, utilize action listener mechanism, the change of playing the method call of kernel in playing process and broadcast state by monitoring realizes monitors different broadcast states and various states is processed, without multiple tactful code is coupled in service logic, can realize Dynamic Thermal plug strategy.
In addition, in an embodiment of the present invention, Play Control strategy can be write by developer or user.Can expand thus various dissimilar broadcast strategy assemblies.Fig. 3 is the structured flowchart of the Play Control policy control device of Web player in accordance with another embodiment of the present invention.As shown in Figure 3, on the basis of the embodiment shown in Fig. 2, also comprise module 50 is set according to the Play Control policy control device of the Web player of the embodiment of the present invention.
The Play Control strategy that module 50 is write for receiving developer or user is set.
Can expand various dissimilar broadcast strategy assemblies according to the Play Control policy control device of the Web player of the embodiment of the present invention, and owing to utilizing action listener mechanism, can realize the policy components that dynamic load is different and put logic without revising main broadcaster, autgmentability is strong.
In the description of this specification, the description of reference term " embodiment ", " some embodiment ", " example ", " concrete example " or " some examples " etc. means to be contained at least one embodiment of the present invention or example in conjunction with specific features, structure, material or the feature of this embodiment or example description.In this manual, the schematic statement of described term is not necessarily referred to identical embodiment or example.And specific features, structure, material or the feature of description can be with suitable mode combination in any one or more embodiment or example.
Although illustrated and described embodiments of the invention, for the ordinary skill in the art, be appreciated that without departing from the principles and spirit of the present invention and can carry out multiple variation, modification, replacement and modification to these embodiment, scope of the present invention is by claims and be equal to and limit.