The content of the invention
In order to solve at least one problem as above, the present invention proposes a kind of video playback side of new broadcasting mechanismCase.Specifically, the present invention replaces multiple broadcasting containers in playlist by a self-built broadcasting container, and preferablyThe broadcasting content of self-built container is covered into original broadcasting content and follows rolling event to roll, thus in lifting page response efficiencyWhile keep the page naturally smoothly to show.This rolling follows scheme to be combined with fixed small window scheme, withMore perfect list of videos is provided and plays experience.
According to an aspect of the invention, there is provided a kind of video broadcasting method, including:Obtain video to be played on the pageBroadcasting content and play position information;The broadcasting content of acquisition is played in self-built window, wherein according to play position informationSelf-built window is set to cover at least a portion of play position;Monitor the rolling event on the page;And cause described self-builtWindow follows the rolling event to be rolled.
Thus, by creating the self-built window for being used for playing video single broadcasting container can be realized to each video in the pagePlayed without ANR, and the naturalness that shows of lifting window is rolled by following for self-built window.The above-mentioned page is preferably at leastThe list of videos page including two or more video items, so as to be benefited from technical scheme.
Self-built window preferably completely covers the play position of video to be played, so that result of broadcast is more natural.
Preferably, above-mentioned rolling, which is followed, only to be carried out when play position is shown in screen completely or partially.And when above-mentioned play position frames out completely, the fixed bit that the self-built window that covering is shown can be caused to jump in screenPut and completely shown to playing content.Thus, obtained well between the integrity degree and natural smooth degree of video playbackBalance.
Preferably, the rolling event monitored on the page can include:Obtain the page in advance rolls type information;According toThe rolling event for rolling type information and listening to obtained calculates rolling distance;And cause self-built window to follow rollingRolling distance.Thus, in video display process, when user in the page to performing rolling operation, the normal of video is not interfered withViewing.
Preferably, rolling type information and can including for the page is obtained in advance:Video to be played on the searching loop pageThe higher level ViewGroup in region, and obtain rotatable ViewGroup, rotatable ViewGroup include ListView,RecyclerView and ViewPager.
Preferably, the video broadcasting method can also include:Self-built window is pre-established, wherein self-built window is disposed inThe superiors are laid out.Self-built window can be hidden, and cancel above-mentioned hiding when needing and playing video.It is right when needed to therefore ensure thatThe appropriate display of self-built window.
Preferably, pre-establishing self-built window can also include:The video control parameters of acquiescence are provided for self-built window;And/or the video control parameters option for being available for editor is provided for self-built window.Thus, it is possible to further improve regarding for self-built windowFrequency playing function.
Preferably, pre-establishing self-built window can also include:Self-built window is pre-established in sub-line journey.Thus, lead toCross perform self-built window opening in sub-line journey set up event, it is ensured that the responding ability of main thread, it is to avoid by main threadBlock and cause ANR generation.
Preferably, sub-line journey monitors the good working condition in self-built window playing process, and each state is sent out from sub-line journeyCloth is into main thread.Thus, can further it be avoided to main thread by the video broadcasting condition Post that listens to sub-line journeyANR generation.Above-mentioned self-built window can be set up different at the time of, to meet the specific requirement in practical application.
According to another aspect of the present invention, a kind of video play device is additionally provided, including:Broadcast information obtains singleMember, broadcasting content and play position information for obtaining video to be played on the page;Content broadcast unit, in self-built windowThe broadcasting content of acquisition is played in mouthful, wherein making at least one of self-built window covering play position according to play position informationPoint;Page events monitoring unit, for monitoring the rolling event on the page;And window follows unit, for so that describedSelf-built window follows the rolling event to be rolled.The above-mentioned page is preferably rotatable to include the video of at least two videosThe playlist page.
Preferably, the content broadcast unit can cause the self-built window play position to be completely covered and in instituteState the broadcasting content that acquisition is played in self-built window.
Preferably, the window follow unit can the play position is at least part of shown in screen when,So that the self-built window follows the rolling event to be rolled.
Preferably, said apparatus can also include:Window fixing unit, for complete or partial not in the play positionWhen being shown in screen so that the self-built window is fixed in the screen and completely shown.
Preferably, page events monitoring unit can be used for:Obtain the page in advance rolls type information;According to acquisitionThe rolling event that rolls type information and listen to calculate rolling distance;And cause self-built window to follow rolling to rollDistance.
Preferably, rolling type information and can including for the page is obtained in advance:Video to be played on the searching loop pageThe higher level ViewGroup in region, and obtain rotatable ViewGroup, rotatable ViewGroup include ListView,RecyclerView and ViewPager.
Preferably, the video play device can also include:Window built in advance unit, for pre-establishing self-built window, itsIn self-built window be disposed in the superiors layout in.Preferably, the window built in advance unit can hide what oneself was pre-establishedThe self-built window, and the content broadcast unit cancel to the self-built window that pre-establishes hide and it is described fromBuild in window and play the broadcasting content of acquisition.
Preferably, window built in advance unit provides the video control parameters of acquiescence for self-built window;And/or carried for self-built windowVideo control parameters option for being available for editor.
Preferably, window built in advance unit sets up self-built window in sub-line journey.The self-built window can be at the following momentSet up:When the application for playing video is activated;When entering the page for including playable video;Or described including that can broadcastWhen putting in the page of video video and being clicked broadcasting for the first time.
Preferably, sub-line journey monitors the good working condition in self-built window playing process, and each state is sent out from sub-line journeyCloth is into main thread.
According to a further aspect of the invention, a kind of computing device is additionally provided, including:Processor;And memory, itsOn be stored with executable code, when executable code is executed by processor, the method for making computing device address above.
According to a further aspect of the invention, a kind of non-transitory machinable medium is additionally provided, is stored thereonThere is executable code, when computing device of the executable code by electronic equipment, the method for making computing device address above.
Video broadcasting method, device, computing device and the storage medium of the present invention, is used to play video by creatingSelf-built window can realize that single broadcasting container is played to each video in the page without ANR, and following by self-built windowRoll the naturalness that lifting window is shown.It is above-mentioned to follow broadcasting scheme to be combined with small window broadcasting scheme, to be given atThere is the overall broadcasting scheme of good balance between the integrity degree of video playback and natural smooth degree.
Embodiment
The preferred embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawingPreferred embodiment, however, it is to be appreciated that may be realized in various forms the disclosure without the embodiment party that should be illustrated hereFormula is limited.On the contrary, these embodiments are provided so that the disclosure is more thorough and complete, and can be by the disclosureScope intactly conveys to those skilled in the art.
As shown in figure 1, for convenience the video-see of user with browsing, in existing video play lists generally on toUnder arrange multiple videos, for example, the n-th in the list of videos shown in figure and the N+1 video thereafter.UserList of videos can be rolled, for example, interested by clicking on selection by being slided up and down to touch screen, and for exampleVideo is watched.Although above-mentioned arrangement contributes to conveniently browsing and watching for user, but from operating system (for example, AndroidSystem) function realize from the point of view of, due to need for each video item in list of videos provides play container (that is, contain and broadcastPut the view control of device), it is easy to the obstruction of UI threads (for example, main thread herein) is caused, so as to cause extremely to influenceThe ANR of Consumer's Experience.
Be directed to this, proposed after inventor's further investigation, can by set up a self-built window and by the page originallyThe multiple broadcasting containers needed are reduced to one, and its whole life cycle is preferably realized in sub-line journey, so as to mitigate significantlyOperating system tackles the burden of list of videos.In addition, above-mentioned self-built window can cover original play area and follow userRolling operation roll so that user experience not go out the sight not in original video window but in the self-built window on upper strata in factSee video.It is above-mentioned to follow rolling scheme to be combined with small window broadcasting scheme, for example, will be complete in original video windowSmall window is jumped to during screen display at once to play, a more complete and comprehensive list of videos playing body is thus provided the userTest.
So far by taking video play lists as an example, just the general principle of the video playback scheme of the present invention is briefly explained.It should be noted that the video playback scheme of the present invention can apply to the page of polytype offer video playing resource.Wherein, the page that the present invention is addressed can be webpage or the embedded page in the application, for example, it may be Tengxun regardsThe information class webpages such as webpage or Sina weibo, Baidu's mhkc that the video websites such as frequency are provided, can also be suitable for installingThe page in the APP such as today's tops on mobile terminals.Also, the page can according to shown in Fig. 1, with list of videos form toThe playable video resource of user's displaying, can also show playable video resource to user in other forms.
Describe the video playback scheme of the present invention in detail below in conjunction with Fig. 2 to Fig. 5.What the embodiment of the present invention was provided regardsFrequency broadcasting scheme can be applied in environment as shown in Figure 2.Fig. 2 is the schematic diagram for realizing the environment of the embodiment of the present invention.In one embodiment, the mobile terminal 10 in environment can realize the information transmit-receive with server 20 via network 40.ServiceDevice 20 can obtain the content needed for mobile terminal 10 by accessing database 30.Between mobile terminal (for example, 10_1 withBetween 10_2 or 10_N) it can also be communicated with one another via network 40.Network 40 can be sensu lato net for information transmissionNetwork, can include one or more communication networks, such as cordless communication network, internet, private domain net, LAN, Metropolitan Area Network (MAN), wideDomain net or cellular data network etc..In one embodiment, network 40 can also include satellite network, thus by mobile terminal10 gps signal sends server 20 to.If it should be noted that into Fig. 2 add or add-on module is removed from Fig. 2, will notChange the underlying concept of the example embodiment of the present invention.In addition, though showing for convenience of explanation and in figure from database30 arrive the four-headed arrow of server 20, it will be appreciated by those skilled in the art that the transmitting-receiving of above-mentioned data is also to lead toCross the realization of network 40.
Mobile terminal 10 is any suitable portable electric appts that can be utilized for network access, is included but is not limited toSmart phone, tablet personal computer or other athe portable clients.Server 20 is then that can be interacted by the offer of network accessService any server of information needed.Though it is shown that multiple mobile terminal 1 0-1 ... N and the He of individual server 20 in figureDatabase 30, and one of those or part mobile terminal can be selected to be been described by (for example, mobile whole in the description that followsHold 10-1), it should be understood by those skilled in the art that above-mentioned 1 ..., N number of mobile terminal, which is intended to indicate that in live network, depositsMultiple mobile terminals, the individual server 20 and database 30 shown be intended to indicate that technical scheme is related to serviceThe operation of device and database.Mobile terminal and individual server and database to particular number are described in detail least for explanationIt is convenient, rather than imply that there is limitation to type or position of mobile terminal and server etc..
Fig. 3 is the indicative flowchart of video broadcasting method according to an embodiment of the invention.This method can be by Fig. 2 institutesThe mobile terminal 10 shown is performed.
Referring to Fig. 3, method starts from step S310, obtains the broadcasting content of video to be played and play position letter on the pageBreath.
The page described herein refer to show on mobile terminals with video playing resource can scroll through pages, it canTo be mobile terminal by the webpage of browser access or install the page in APP on mobile terminals.The page canTo provide one or more video resources, preferably comprise at least two videos rolls the video play lists page, for example,The page shown in Fig. 1.Video to be played can be the video of user's expectation broadcasting in the page, the page can be performed according to userThe operations such as dragging, click determine the video to be played on the page, for example, user wants the video N clicked in Fig. 1.For waiting to broadcastVideo is put, positional information of the video to be played in the page can be considered as to the play position information of video to be played, and canTo determine its play position information according to attribute configuration information of the video to be played in the page.Herein, play position is phaseFor the page rather than screen display, the rolling of the page can influence the position of screen display but not change play position.Wait to broadcastPutting the broadcasting content of video can online be obtained according to the address of the video to be played indicated in the page by network.
In step S320, the broadcasting content of acquisition is played in self-built window.
Herein, self-built window can be regarded as to the window for being different from the above-mentioned page and voluntarily setting up.Self-built window canIn the page, can also be located on the page, and for providing to the visible video playback area of user.Self-built windowThe play right (for example, by sub-line journey belonging to it, described below) of each video in the page can be obtained so that in the pageVideo can be played out in the self-built window.It is preferred that self-built window can be arranged in the superiors' layout, so thatIt will not be blocked derived from window is built.As the alternative embodiment of the present invention, self-built window can be pre-established, and it is self-builtThe original state of window could be arranged to hidden state, then in response to step S320 execution, can cancel to pre-establishingSelf-built window hide.Thus, in user's only browsing pages in the case of non-order video, self-built window is hidden, noThe normal viewing experience of user can be influenceed, and can then ensure broadcasting for video by the way that self-built window is arranged in the superiors' layoutPut visible to user all the time.
During self-built window is set up, the video control parameters of acquiescence can be provided for self-built window, and/orPerson, can also provide the video control parameters option for being available for editor for self-built window.Video control parameters described herein can be withIt is the parameters related to video playback such as volume control, progress monitoring, sound control.
The initial position of self-built window can be an arbitrary value, obtain the play position information of video to be playedAfterwards, the position of self-built window can according to the play position information of video to be played, be reset.For example can be by self-built windowThe play position of video to be played is moved to, to cover video to be played, self-built window can also be moved to part covering and broadcastPut the position of position.Preferably so that the play position is completely covered in the self-built window so that user is completely imperceptibleIt is to watch video in the parent window different from original video window.
In step S330, the rolling event on the page is monitored, and in step S340 so that self-built window described in self-built windowMouth follows the rolling event to be rolled.
Here the rolling event on the page addressed refers to that user for example rolls by sliding up and down caused by touch-screenDynamic event.Herein, rolling event is primarily referred to as the rolling based on the content of pages in the page caused by the input of user.It is logicalCrossing monitoring rolling event (real-time) can obtain the displacement rolled in the page.Application according to the present invention scene is different, prisonThe implementing for rolling event on the page is listened also to be not quite similar.For example, the page in the present invention is based on browser accessWebpage when, rolling distance can be determined according to the rolling parameters of scroll bar in webpage.For another example the page in the present inventionTo be embedded under Android system during the page (such as the page shown in Fig. 1) in the application, due to there may be multiple types in the pageThe rotatable View (view) of type, such as ListView (List View), RecyclerView (multiplexing view),ViewPager (slip view), now the rolling event on the page is the rolling for View mostly, therefore can monitor ViewRolling, determine specific rolling distance according to View rolling parameters.Implement, rolling for the page can be obtained in advanceDynamic type information, here can by the higher level ViewGroup (sets of views) of video area to be played on the searching loop page, withObtain rotatable ViewGroup, rotatable ViewGroup can include ListView, RecyclerView,The polytypes such as ViewPager.After obtaining and can roll type information, can according to it is acquired roll type information withAnd the rolling event listened to calculates rolling distance, and self-built window (real-time) is set to follow the calculated rolling distance of rolling.
During in order that obtaining the generation rolling event on the page, the normal viewing of video is not influenceed.Step can performedDuring S330, step S340 is performed so that self-built window follows rolling event to roll and preserves complete display.In other wordsSay, monitor step and follow step generally can alternately, to ensure self-built window following in real time to rolling operation.
In one embodiment, to be above-mentioned operation can be followed to limit specific scope, and can be mutually tied with the broadcasting of small windowClose to realize a more natural and complete broadcasting scheme.For example, self-built window only can exist completely in original play positionIn screen show in the case of keeps following, and its show it is imperfect when redirect for fixed position small window play.For example, self-builtAs long as window can also keep following in the case where original play position has part to show also in screen, and its display is endlessThe small window broadcasting for fixed position is redirected when whole.
Figure 4 and 5 respectively illustrate self-built window and keep redirecting as the example of small window with amiable.User can for example click on figureThe broadcast button on video N front covers shown in 1 so that video N is commenced play out.The self-built window of the present invention can obtain video NSpecific broadcasting content and completely cover the acquiescence play position of the video so that in user, the video is like to be write from memory by itRecognize as video playback container plays out.Subsequent user can enter row-column list rolling operation to the page so that play positionOnly part shows that at this moment remain in that the self-built page follows display, as shown in Figure 4 in screen.And when video N broadcastingWhen position is not shown in screen completely, self-built window follows broadcasting to switch to small window to play, as shown in Figure 5.Here" broadcasting container " can be understood as containing the view control of player.And it can be then that fixed position is played that small window, which is played, andAnd its size can be adjusted accordingly, such as the lower right corner shown in Fig. 5 reduces display.
Although here it is shown that following the embodiment played and be combined with small window play operation, those skilled in the art canWith understanding, of the invention follows broadcasting can not be combined with the broadcasting of small window.For example, position can put completely not in screenKeep merely when being shown in curtain or stop display of self-built window etc..
The video playback scheme of the present invention can be preferably applied in Android system, for example, can apply to Android systemUnder application and development, such as today's tops, Tengxun video provide the APP exploitations of video playing resource.By the present invention videoWhen player method is applied in this kind of scene, in order to avoid the appearance of the ANR dialog boxes that can have a strong impact on Consumer's Experience, Ke YiSelf-built window is set up by sub-line journey, and the complete lifecycle of self-built window is all placed on the sub-line journey and is performed.In addition, may be used alsoTo perform step S330 snoop-operations by sub-line journey, you can to monitor the complete shape in self-built window playing process by sub-line journeyState, and each state listened to is published to main thread.
According to specific application scenarios, the self-built window of the present invention can be set up appropriate at the time of, for example, is regarded in broadcastingWhen the application of frequency is activated;When entering the page for including playable video;Regarded in the page including can play videoWhen frequency is clicked broadcasting for the first time;Or other it is suitable at the time of.When self-built window is created by sub-line journey, the sub-line journey is in itselfCan also suitable time point or in the case of create.
So far, the video broadcasting method of the present invention is elaborated with reference to Fig. 3-5, in addition, the video of the present invention is broadcastThe method of putting is also implemented as a kind of video play device.Fig. 6 is to show video playback dress according to an embodiment of the inventionThe schematic block diagram for the structure put.Wherein, the functional module of video play device 600 can be by realizing the hard of the principle of the inventionThe combination of part, software or hardware and software is realized.It will be appreciated by persons skilled in the art that the function mould described by Fig. 6Block can combine or be divided into submodule, so as to realize the principle of foregoing invention.Therefore, description herein can be supportedTo functions described herein module it is any it is possible combination or divide or further limit.
The operation that the functional module and each functional module that can only have with regard to video play device 600 below can be performedIt is described briefly, may refer to be described above for the detail section being directed to, repeat no more here.
Referring to Fig. 6, video play device 600 includes broadcast information acquiring unit 610, content broadcast unit 620, page thingPart monitoring unit 630 and window follow unit 640.
Broadcast information acquiring unit 610 is used for the broadcasting content and play position information for obtaining video to be played on the page,Content broadcast unit 620 is used for the broadcasting content that acquisition is played in self-built window, wherein being made according to play position information self-builtWindow covers at least a portion of the play position.Page events monitoring unit 630 is used to monitor to follow event on the page.Window follows unit 640 to follow the rolling event to roll for the self-built window.
In one embodiment, content broadcast unit 620 can cause the self-built window that the broadcasting position is completely coveredPut, so that user will not experience the self-built window on original broadcasting container so that above-mentioned broadcasting is more naturally smooth.
In one embodiment, to be above-mentioned operation can be followed to limit specific scope.For example, window follows unit 640 canWith play position is at least part of shown in screen when so that the self-built window follows the rolling event to be rolledIt is dynamic.Follow operation to play with small window to be combined to realize a more natural and complete broadcasting scheme.For example, videoPlaying device 600 can also include window fixing unit, for being shown completely or partially not in screen in the play positionWhen so that the self-built window is fixed in the screen and completely shown.
As the alternative embodiment of the present invention, page events monitoring unit 430 can obtain rolling for the page in advanceDynamic type information, calculates rolling distance so that self-built according to the rolling event for rolling type information and listening to of acquisitionWindow follows rolling rolling distance.Wherein, can roll type information can include video area to be played on the searching loop pageHigher level ViewGroup, and obtain rotatable ViewGroup, rotatable ViewGroup include ListView,RecyclerView and ViewPager.
As shown in fig. 6, as the alternative embodiment of the present invention, video play device 600 can also include empty in figureWindow built in advance unit 650 shown in wire frame.
Window built in advance unit 650 can be used for pre-establishing self-built window, wherein self-built window is disposed in the superiors' clothOffice.Window built in advance unit 650 can hide self-built window, and content broadcast unit 620 then can the cancellation pair when needing to play videoThe self-built window pre-established hide.
Alternatively, window built in advance unit 650 can also provide the video control parameters of acquiescence for self-built window, and may be used alsoTo provide the video control parameters option for being available for editor for self-built window.
Window built in advance unit 650 can pre-establish self-built window in the sub-line journey pre-established, and sub-line journey can be supervisedThe good working condition in self-built window playing process is listened, and by each state from sub-line journey is published to main thread.
Fig. 7 is the schematic block diagram for the structure for showing computing device according to an embodiment of the invention.
Referring to Fig. 7, computing device 700 can be desktop computer, portable computer, tablet personal computer, smart mobile phone, individual numberAccording to assistant (PDA), or other kinds of computer installation, but it is not limited to any particular form.Computing device 700 can be wrappedInclude but be not limited to processor 710 and memory 720.
Processor 710 can be the processor of a multinuclear, can also include multiple sub-processors.In some embodimentsIn, processor 710 can be included at a general primary processor and one or more special coprocessors, such as figureManage device (GPU), digital signal processor (DSP) etc..
In any kind of storage device for the content that memory 720 can include storage file form or other formsIt is one or more, including magnetic hard disk drives, solid-state hard disk driver, semiconductor memory apparatus, flash memory, or being capable of storage program instructionOr any other computer-readable writable storage media of digital information.Can be stored with executable code on memory 720,In the present invention, when the executable code on memory 720 is performed by processor 710, processor 710 can be made to perform Fig. 3 institutesThe video broadcasting method shown.
Concrete application
In current internet arena, either net cast or video request program is all focus and business opportunity place.RespectivelyBig Internet firm falls over each other to put into ample resources in net cast, video request program, it would be desirable to occupy one seat.But it is due toThe essence of increasing income of Android system causes the fragmentation of Android mobile phone, and user is ever-changing to the demand of Related product, thereforeAn especially needed general playing frame carrys out the exploitation of the short video capability of fast integration, quickly to keep up with the iteration of demand.ByVideo playback capability, is quickly integrated into product (APP) by this for the ease of developer, can the video playback based on the present inventionScheme is pre-designed a generic video playing frame (framework), you can so that the video broadcasting method of the present invention to be encapsulatedInto the framework, the framework is the reusing design of system, and it can be employed developer and use.In this way, based on being pre-designedVideo playback framework, developer only need to according to Product Requirement Design video UI, you can realize customized video playback capability,Such as list video playback, so as to which quickly customized video playback capability is integrated into product, in design process notNeed to consider compatibility issue, it is not required that consider the life cycle of video during page scroll, can just realize in a short timeGood video playback experience effect.
In addition, in order to further be easy to developer to design, the video control parameters that can also be given tacit consent in framework for offer, exampleSuch as progress monitoring, volume control, sound control.Also, the video control parameters for being available for developer to edit can also be providedOption.Preferably, in order to improve the scalability of framework, the interface towards developer can also be provided, the interface can allowDeveloper adds the self-defined control logic for self-built window, and such as developer can add the root layout of video controlling interfaceIt is added in self-built window, developer can increase different according to UI come the self-defined interface for playing control such as horizontal/vertical screenControl layout etc..For another example developer can also be allowed to choose whether down the rolling event transparent transmission on the page, if by rollingRolling event on the dynamic list processing page etc..
Thus, the support Android that the video playback framework energy of the video playback scheme realization based on the present invention is good is put downThe main flow control of platform, developer can be integrated into a short time in specific product function, and autgmentability is strong, maintenance costIt is small, meet the changeable gene in internet.Developer only need to provide a video playback area ViewGroup (sets of views)/View (view), the framework can find all View that can be rolled, example in its all father's layout according to this ViewGroup/ViewSuch as ListView (List View), RecyclerView (multiplexing view), ViewPager (slip view).Then View is monitoredRolling event, the play area (position of i.e. self-built window) of dynamic mobile video reaches that self-built window follows rolling effect.
The present invention video broadcasting method be applied to Android system in application and development when video playback flow it is as follows.
The first step:Increase video playback ViewGroup (can be understood as the realization of self-built window addressed above)
The ViewGroup (for example, can be referred to as VideoPlayLayout) for accommodating video playback is added toActivity the superiors' layout, is then hidden.
Second step:Transmit the ViewGroup of final play area
The ViewGroup (for example, CoverLayout can be referred to as) in the region of video playback displaying is obtained, this is foundCoverLayout positions in screen, dispaly state is set to by VideoPlayLayout, mobile VideoPlayLayout'sPosition is on CoverLayout.The video to be played that CoverLayout is as addressed above.
3rd step:Obtain rotatable ViewGroup, dynamic adjustment VideoPlayLayout positions
Here rotatable ViewGroup (examples can be obtained by searching loop CoverLayout father ViewGroupSuch as ListView), then corresponding rolling distance can be obtained according to the different views that rolls using strategy pattern, dynamically setPositions of the VideoPlayLayout in screen is put, allows it to follow rolling.Wherein, it can be sealed in strategy pattern described hereinFill for intercept View Touch events, calculated according to the Touch events that are intercepted View rolling distance implementation method.
Behind the position that VideoPlayLayout is dynamically arranged in screen, it can be existed according to VideoPlayLayoutCorresponding interface is adjusted in position in screen back and forth, sets correspondence broadcast state.Wherein, it can be packaged with interface described hereinBroadcasting logic between video broadcasting condition and position, the corresponding relation between position and broadcast state can be preset, for example can be after the distance that VideoPlayLayout is rolled exceedes preset distance, to stop its broadcasting.
4th step:The root layout for adding video controlling interface arrives VideoPlayLayout
In order to improve the scalability of framework, the root layout of video controlling interface can be added toIn VideoPlayLayout, developer can be according to UI come the self-defined interface for playing control.In addition, framework can also be designedA set of acquiescence realizes the UI for playing control, such as progress monitoring, volume control, sound control etc..
5th step:The global control of broadcast state readjustment
The good working condition in video display process can be monitored by sub-line journey, by each state from sub-line journey post to main lineCheng Zhong, and being distributed in the snoop logic of each setting, can so facilitate during developer handles some broadcast statesLogic.Implement, the life cycle methodology related to self-built window can be placed in sub-line journey and performed, it is unified with unidirectionalQueue management, is then published to main thread execution in Android platform successively.Specifically, can be in the sub-line pre-establishedSelf-built window is pre-established in journey, and sub-line journey can be used to monitor the good working condition in self-built window playing process, thenCan be by the state Post listened into main thread.It can so ensure that developer oneself can control the broadcasting life of whole videoIn the life cycle, ANR is prevented, and video is played for list providing possibility.
Above it is described in detail and is set according to the video broadcasting method of the present invention, device and calculating by reference to accompanying drawingIt is standby.The present invention replaces multiple broadcasting containers in playlist by a self-built broadcasting container, and preferably will be self-builtThe original broadcasting content of broadcasting content covering of container simultaneously follows rolling event to roll, thus while page response efficiency is liftedKeep smoothly showing naturally for the page.This rolling follows scheme to be combined with fixed small window scheme, to provide moreExperience is played for perfect list of videos.
In addition, the method according to the invention is also implemented as a kind of computer program or computer program product, the meterCalculation machine program or computer program product include the calculating for being used to perform the above steps limited in the above method of the inventionMachine code instructions.
Or, the present invention can also be embodied as a kind of (or the computer-readable storage of non-transitory machinable mediumMedium or machinable medium), executable code (or computer program or computer instruction code) is stored thereon with,When the executable code (or computer program or computer instruction code) is by electronic equipment (or computing device, serverDeng) computing device when, make the computing device according to the present invention the above method each step.Above-mentioned code is especiallyA kind of reusable broadcasting " framework " is can be implemented as, to facilitate the function to this programme move to and specifically set accordinglyIt is fixed.
Those skilled in the art will also understand is that, the various illustrative logical blocks with reference to described by disclosure herein, mouldBlock, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.
Flow chart and block diagram in accompanying drawing show that the possibility of the system and method for multiple embodiments according to the present invention is realExisting architectural framework, function and operation.At this point, each square frame in flow chart or block diagram can represent module, a journeyA part for sequence section or code, a part for the module, program segment or code is comprising one or more defined for realizingThe executable instruction of logic function.It should also be noted that in some realizations as replacement, the function of being marked in square frame also may be usedWith with different from the order marked in accompanying drawing generation.For example, two continuous square frames can essentially be performed substantially in parallel,They can also be performed in the opposite order sometimes, and this is depending on involved function.It is also noted that block diagram and/or streamThe combination of each square frame in journey figure and the square frame in block diagram and/or flow chart, can use function or operation as defined in executionSpecial hardware based system realize, or can be realized with the combination of specialized hardware and computer instruction.
It is described above various embodiments of the present invention, described above is exemplary, and non-exclusive, andIt is not limited to disclosed each embodiment.In the case of without departing from the scope and spirit of illustrated each embodiment, for this skillMany modifications and changes will be apparent from for the those of ordinary skill in art field.The selection of term used herein, purportThe principle, practical application or the improvement to the technology in market of each embodiment are best being explained, or is making the artOther those of ordinary skill are understood that each embodiment disclosed herein.