WO2019007327A1 - 视频播放方法、装置、计算设备以及存储介质 - Google Patents

视频播放方法、装置、计算设备以及存储介质 Download PDF

Info

Publication number
WO2019007327A1
WO2019007327A1 PCT/CN2018/094273 CN2018094273W WO2019007327A1 WO 2019007327 A1 WO2019007327 A1 WO 2019007327A1 CN 2018094273 W CN2018094273 W CN 2018094273W WO 2019007327 A1 WO2019007327 A1 WO 2019007327A1
Authority
WO
WIPO (PCT)
Prior art keywords
self
window
built
video
page
Prior art date
Application number
PCT/CN2018/094273
Other languages
English (en)
French (fr)
Inventor
涂勇
Original Assignee
广州优视网络科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州优视网络科技有限公司 filed Critical 广州优视网络科技有限公司
Publication of WO2019007327A1 publication Critical patent/WO2019007327A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/482End-user interface for program selection
    • H04N21/4825End-user interface for program selection using a list of items to be played back in a given order, e.g. playlists
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • H04N21/4438Window management, e.g. event handling following interaction with the user interface
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4782Web browsing, e.g. WebTV

Definitions

  • the present application relates to the field of multimedia technologies, and in particular, to a video playing method, apparatus, computing device, and storage medium.
  • Video online broadcasting services are being used by more and more users.
  • Users can browse online video resources in a variety of ways using a variety of terminals, such as personal computers, mobile terminals, and smart TVs.
  • terminals such as personal computers, mobile terminals, and smart TVs.
  • users can use Tencent Video, Youku, Iqiyi and other video playback software to order video, browse the video information through the news headlines such as today's headlines, Sina Weibo, etc., browse through UC browser, QQ browser, Baidu browser, etc.
  • the APP can watch videos and watch live video through live broadcast platforms such as Betta TV and Tiger Tooth TV.
  • FIG. 1 shows an example of a video list.
  • each video in the video list is arranged one after the other, and the user can scroll up and down to scroll through the video list and click on the play button in the video cover (in other examples, click on the video title or anywhere on the video cover) Come watch the video.
  • This way of presenting video resources to a user through a video list allows the user to preview multiple video resources in an intuitive and clear manner.
  • each video item in the video list needs to be equipped with a play container, so that when the video items are clicked on the video list, it is easy to cause the UI thread to be suspended.
  • Lead to ANR application is not responding), greatly affecting the user browsing experience. Therefore, there is a need for a technical solution that avoids ANR as much as possible while ensuring smooth video display.
  • the present application proposes a video playback scheme of a new playback mechanism. Specifically, the present application replaces a plurality of play containers in a playlist by a self-built play container, and preferably covers the original play content by the play content of the self-built container and follows the scroll event scrolling, thereby improving the page response efficiency. At the same time keep the natural and smooth display of the page.
  • This scrolling follow-up solution can also be combined with a fixed small window scheme to provide a more complete video list playback experience.
  • a video playing method including: acquiring a playing content and a playing position information of a video to be played on a page; playing the obtained playing content in a self-built window, wherein the self-built self-built according to the playing position information The window covers at least a portion of the play position; listens for scroll events on the page; and causes the self-built window to scroll following the scroll event.
  • a single playback container can achieve ANR-free playback of each video in the page, and the naturalness of the window display is improved by following the scrolling of the self-built window.
  • the above page is preferably a video list page including at least two or more video items in order to be able to benefit from the technical solution of the present application.
  • the self-built window preferably completely covers the playback position of the video to be played, thereby making the playback effect more natural.
  • the scrolling described above may be performed only when the playback position is displayed completely or partially within the screen.
  • the self-built window covering the display can be jumped to a fixed position in the screen and the playing content is completely displayed.
  • a good balance is achieved between the integrity of the video playback and the natural smoothness.
  • the scrolling event on the listening page may include: pre-fetching scrollable type information of the page; calculating a scrolling distance according to the acquired scrollable type information and the monitored scrolling event; and causing the self-built window to follow the scrolling scrolling distance.
  • pre-fetching scrollable type information of the page may include: pre-fetching scrollable type information of the page; calculating a scrolling distance according to the acquired scrollable type information and the monitored scrolling event; and causing the self-built window to follow the scrolling scrolling distance.
  • pre-acquiring the scrollable type information of the page may include: looping through the upper-level ViewGroup of the video area to be played on the page, and acquiring a scrollable ViewGroup, wherein the scrollable ViewGroup includes a ListView, a RecyclerView, and a ViewPager.
  • the video playing method may further include: pre-establishing a self-built window, wherein the self-built window is arranged in an uppermost floor layout.
  • Self-built windows can be hidden and can be removed when the video needs to be played. This ensures proper display of the self-built window when needed.
  • pre-establishing the self-built window may further comprise: providing default video control parameters for the self-built window; and/or providing the editable video control parameter option for the self-built window.
  • the video playing function of the self-built window can be further improved.
  • pre-establishing the self-built window may further include: pre-establishing a self-built window in the sub-thread.
  • pre-establishing a self-built window in the sub-thread may further include: pre-establishing a self-built window in the sub-thread.
  • the child thread listens for the full state of the self-built window during playback and publishes each state from the child thread to the main thread.
  • the occurrence of ANR can be further avoided.
  • the above self-built windows can be built at different times to meet the specific requirements of the actual application.
  • a video playing device including: a playing information acquiring unit, configured to acquire playing content and playing position information of a video to be played on a page; and a content playing unit, configured to be in a self-built window Playing the obtained playing content, wherein the self-built window covers at least a part of the playing position according to the playing position information; the page event monitoring unit is configured to monitor a scrolling event on the page; and the window following unit is configured to enable the self-building The window follows the scrolling event to scroll.
  • the above page is preferably a scrollable video playlist page comprising at least two videos.
  • the content playing unit may cause the self-built window to completely cover the playing position and play the obtained playing content in the self-built window.
  • the window following unit may cause the self-built window to scroll following the scrolling event when at least a part of the playing position is displayed in the screen.
  • the above apparatus may further include: a window fixing unit, configured to fix the self-built window in the screen and display it completely when the playing position is completely or partially not displayed in the screen.
  • a window fixing unit configured to fix the self-built window in the screen and display it completely when the playing position is completely or partially not displayed in the screen.
  • the page event monitoring unit may be configured to: pre-fetch scrollable type information of the page; calculate a scroll distance according to the acquired scrollable type information and the monitored scroll event; and cause the self-built window to follow the scrolling scroll distance.
  • pre-acquiring the scrollable type information of the page may include: looping through the upper-level ViewGroup of the video area to be played on the page, and acquiring a scrollable ViewGroup, wherein the scrollable ViewGroup includes a ListView, a RecyclerView, and a ViewPager.
  • the video playing device may further include: a window pre-built unit, configured to pre-establish a self-built window, wherein the self-built window is arranged in the uppermost floor layout.
  • the window pre-built unit may hide the self-built window that is pre-established by itself, and the content playing unit cancels the hiding of the pre-established self-built window and plays the obtained in the self-built window. Play the content.
  • the window pre-built unit provides default video control parameters for the self-built window; and/or provides editable video control parameter options for the self-built window.
  • the window pre-built unit establishes a self-built window in the child thread.
  • the self-built window may be established at the time when the application for playing the video is activated; when entering the page including the playable video; or when the video is clicked for the first time in the page including the playable video.
  • the child thread listens for the full state of the self-built window during playback and publishes each state from the child thread to the main thread.
  • a computing device comprising: a processor; and a memory having stored thereon executable code that, when executed by the processor, causes the processor to perform the above Methods.
  • a non-transitory machine readable storage medium having stored thereon executable code that, when executed by a processor of an electronic device, causes the processor to perform the above And the method.
  • the video playing method, device, computing device and storage medium of the present application can realize the non-ANR playing of each video in the page by the single playing container by creating a self-built window for playing the video, and the window is raised by the follow-up scroll of the self-built window.
  • the naturalness of the display can be combined with a small window playback scheme to give an overall playback scheme with a good balance between the integrity of the video playback and the natural smoothness.
  • FIG. 1 is a diagram showing an example of a video playlist in the related art.
  • FIG. 2 is a schematic diagram of an environment for implementing an embodiment of the present application.
  • FIG. 3 is a schematic flowchart showing a video playing method according to an embodiment of the present application.
  • Figures 4 and 5 show examples of self-built windows keeping following and jumping to small windows, respectively.
  • FIG. 6 is a schematic block diagram showing the structure of a video playback apparatus according to an embodiment of the present application.
  • FIG. 7 is a schematic block diagram showing the structure of a computing device in accordance with an embodiment of the present application.
  • an existing video playlist usually has a plurality of videos arranged from top to bottom, for example, the Nth sum in the video list shown in the figure. The next N+1th video.
  • the user can scroll through the list of videos, for example, by sliding up and down the touch screen and viewing the video of interest, for example by clicking on it.
  • the view control can easily cause blocking of the UI thread (for example, the main thread in this article), resulting in an ANR that greatly affects the user experience.
  • the inventor has made in-depth research and proposes that the number of playback containers that are originally needed in the page can be reduced to one by creating a self-built window, and the entire life cycle is preferably implemented in the child thread, thereby greatly reducing the operating system.
  • the self-built window can cover the original playing area and follow the user's scrolling operation, so that the user can not feel the video in the upper self-built window instead of the original video window.
  • the following following scrolling scheme can also be combined with a small window playing scheme, for example, jumping to small window playing when the original video window is to be completely immediately displayed on the screen, thereby providing the user with a more complete and comprehensive video list playing experience.
  • the page mentioned in the present application may be a webpage or a page embedded in an application.
  • it may be a webpage provided by a video website such as a Tencent video, or may be a webpage such as Sina Weibo or Baidu Post Bar.
  • It may be a page in an APP such as today's headline that is suitable for installation on a mobile terminal.
  • the page can display the playable video resource to the user in the form of a video list as shown in FIG. 1, and can also display the playable video resource to the user in other forms.
  • FIG. 2 is a schematic diagram of an environment for implementing an embodiment of the present application.
  • the mobile terminal 10 in the environment can communicate with the server 20 via the network 40.
  • the server 20 can acquire the content required by the mobile terminal 10 by accessing the database 30.
  • Mobile terminals e.g., between 10_1 and 10_2 or 10_N may also communicate with each other via the network 40.
  • Network 40 may be a network for information transfer in a broad sense, and may include one or more communication networks, such as a wireless communication network, the Internet, a private area network, a local area network, a metropolitan area network, a wide area network, or a cellular data network. In one embodiment, network 40 may also include a satellite network, thereby transmitting GPS signals of mobile terminal 10 to server 20. It should be noted that if additional modules are added to or removed from FIG. 2, the underlying concepts of the example embodiments of the present application are not changed. In addition, although a two-way arrow from the database 30 to the server 20 is shown in the figure for convenience of explanation, those skilled in the art can understand that the above-mentioned data can also be transmitted and received through the network 40.
  • Mobile terminal 10 is any suitable portable electronic device that can be used for network access, including but not limited to a smart phone, tablet or other portable client.
  • Server 20 is any server that is accessible over the network to provide the information needed for the interactive service.
  • a plurality of mobile terminals 10-1...N and a single server 20 and database 30 are shown in the figure, one or a part of the mobile terminals will be described in the following description (for example, the mobile terminal 10-1), However, those skilled in the art should understand that the above 1...N mobile terminals are intended to represent a plurality of mobile terminals existing in a real network, and the illustrated single server 20 and database 30 are intended to indicate that the technical solution of the present application relates to a server and The operation of the database.
  • the specific numbered mobile end and the individual servers and databases are detailed for at least convenience of explanation, and do not imply restrictions on the type or location of the mobile end and the server.
  • FIG. 3 is a schematic flowchart of a video playing method according to an embodiment of the present application. The method can be performed by the mobile terminal 10 shown in FIG. 2.
  • the method starts at step S310, and acquires play content and play position information of a video to be played on the page.
  • the page mentioned here refers to a scrollable page with a video playing resource displayed on the mobile terminal, which may be a webpage accessed by the mobile terminal through a browser, or may be a page installed in an APP on the mobile terminal.
  • the page may provide one or more video assets, preferably a scrollable video playlist page including at least two videos, such as the page shown in FIG.
  • the video to be played may be a video that the user desires to play on the page, and the video to be played on the page may be determined according to a dragging, clicking, etc. performed by the user on the page, for example, the video N that the user wants to click in FIG.
  • the location information of the video to be played on the page can be regarded as the playback location information of the video to be played, and the playback location information can be determined according to the attribute setting information of the video to be played in the page.
  • the playback position is relative to the page rather than the screen display, and the scrolling of the page affects the position of the screen display but does not change the playback position.
  • the content of the to-be-played video can be obtained online through the network according to the address of the video to be played indicated on the page.
  • step S320 the acquired play content is played in the self-built window.
  • Self-built windows can be located on the page or on top of the page and are used to provide a video play area that is visible to the user.
  • the self-built window can obtain the play permission of each video in the page (for example, through the sub-thread to which it belongs, as will be detailed below), so that the video in the page can be played in the self-built window.
  • the self-built window can be arranged in the uppermost layout so that the self-built window is not occluded.
  • the self-built window may be pre-established, and the initial state of the self-built window may be set to a hidden state, and then, in response to the execution of step S320, the hiding of the pre-established self-built window may be canceled. Therefore, in the case that the user only browses the page and does not order the video, the self-built window is hidden, which does not affect the normal browsing experience of the user, and the video playback can be guaranteed by arranging the self-built window in the uppermost layout. Visible to the user.
  • video control parameters described herein may be parameters related to video playback such as volume control, progress control, sound control, and the like.
  • the initial position of the self-built window can be an arbitrary value.
  • the position of the self-built window can be reset according to the playback position information of the video to be played.
  • the self-built window can be moved to the playing position of the video to be played to cover the video to be played, or the self-built window can be moved to a position partially covering the playing position.
  • the self-built window is completely covered by the playback position such that the user does not feel that the video is viewed in an upper window different from the original video window.
  • step S330 the scroll event on the page is monitored, and in step S340, the self-built window of the self-built window is caused to scroll following the scroll event.
  • the scroll event on the page referred to herein refers to a scroll event caused by the user, for example, by sliding the touch screen up and down.
  • the scroll event mainly refers to the scrolling of the page content in the page caused by the user's input.
  • the specific implementation of the scroll event on the listening page is also different.
  • the page in the present application is a web page accessed by a browser
  • the scroll distance can be determined according to the scrolling parameters of the scroll bar in the web page.
  • the page in the present application is a page embedded in an application under the Android system (for example, the page shown in FIG.
  • scrollable Views such as ListView
  • List view there may be multiple types of scrollable Views (such as ListView) in the page.
  • List view RecyclerView (repeated view)
  • ViewPager sliding view
  • the scrollable type information of the page may be obtained in advance
  • the scrollable ViewGroup may be obtained by looping through the upper ViewGroup of the video area to be played on the page
  • the scrollable ViewGroup may include the ListView and the RecyclerView. ViewPager and other types.
  • the scroll distance can be calculated according to the acquired scrollable type information and the monitored scroll event, and the self-built window (real time) follows the scrolling distance calculated by the scroll.
  • step S340 may be performed such that the self-built window follows the scroll event to scroll and save the complete display.
  • the listening step and the following step can usually be alternated to ensure that the self-built window follows the scrolling operation in real time.
  • a specific range may be defined for the following following operations, and may be combined with small window playback to achieve a more natural and complete playback scheme.
  • a self-built window can be kept following only if the original playback position is completely displayed on the screen, and a small window that jumps to a fixed position when the display is incomplete.
  • the self-built window can also be played in the original playback position as long as some parts are still displayed in the screen, and when the display is incomplete, the small window is played in a fixed position.
  • Figures 4 and 5 show examples of self-built windows keeping following and jumping to small windows, respectively.
  • the user can, for example, click on the play button on the cover of the video N shown in FIG. 1 so that the video N starts playing.
  • the self-built window of the present application can obtain the specific playing content of the video N and completely cover the default playing position of the video, so that the video appears to the user to be played by its default video playing container. Then the user can perform a list scrolling operation on the page, so that only the part of the playback position is displayed on the screen, and the follow-up display of the self-built page is still maintained, as shown in FIG.
  • the "play container” here can be understood as a view control that contains the player.
  • the small window play can be played in a fixed position, and its size can be adjusted accordingly, for example, the lower right corner shown in FIG. 5 is reduced.
  • the video playback solution of the present application can be preferably applied to an Android system, for example, application development under the Android system, and now an APP development that provides video playback resources, such as a Japanese headline, a Tencent video, and the like.
  • an Android system for example, application development under the Android system, and now an APP development that provides video playback resources, such as a Japanese headline, a Tencent video, and the like.
  • a self-built window can be established by the child thread, and the complete life cycle of the self-built window can be placed. Executed in this child thread.
  • the listening operation of step S330 can also be performed by the sub-thread, that is, the sub-thread can monitor the complete state during the self-built window playing process, and publish each monitored state to the main thread.
  • the self-built window of the present application can be established at an appropriate moment, for example, when an application for playing a video is activated; when entering a page including a playable video; and within the page including the playable video When you are clicked for the first time; or other suitable moment.
  • the child thread itself can also be created at the appropriate point in time or under the circumstances.
  • FIG. 6 is a schematic block diagram showing the structure of a video playback apparatus according to an embodiment of the present application.
  • the functional modules of the video playback device 600 may be implemented by hardware, software, or a combination of hardware and software that implements the principles of the present application.
  • the functional modules described in FIG. 6 can be combined or divided into sub-modules to implement the principles of the above invention. Accordingly, the description herein may support any possible combination, or division, or further limitation of the functional modules described herein.
  • the video playback apparatus 600 includes a play information acquisition unit 610, a content playback unit 620, a page event listening unit 630, and a window following unit 640.
  • the play information obtaining unit 610 is configured to acquire the play content and the play position information of the video to be played on the page
  • the content playing unit 620 is configured to play the obtained play content in the self-built window, wherein the self-built window covers the self-built window according to the play position information. Play at least part of the location.
  • the page event listening unit 630 is configured to listen to the following events on the page.
  • the window following unit 640 is configured to scroll the self-built window following the scroll event.
  • the content playing unit 620 can cause the self-built window to completely cover the playing position, thereby making the user not feel the self-built window on the original playing container, so that the above playing is more natural and smooth.
  • a specific range may be defined for the following following operations.
  • the window following unit 640 may cause the self-built window to scroll following the scrolling event when at least a portion of the playback position is displayed within the screen.
  • follow-up operations can also be combined with small window playback to achieve a more natural and complete playback solution.
  • the video playback device 600 may further include a window fixing unit for fixing and displaying the self-built window within the screen when the playback position is completely or partially not displayed in the screen.
  • the page event monitoring unit 430 may acquire scrollable type information of the page in advance, calculate a scroll distance according to the acquired scrollable type information and the monitored scroll event, so that the self-built window follows the scrolling scroll distance.
  • the scrollable type information may include looping through the upper ViewGroup of the video area to be played on the page, and obtaining a scrollable ViewGroup, and the scrollable ViewGroup includes a ListView, a RecyclerView, and a ViewPager.
  • the video playback device 600 may further include a window pre-built unit 650 shown by a dashed box in the figure.
  • the window pre-built unit 650 can be used to pre-establish a self-built window, wherein the self-built window is arranged in the uppermost floor layout.
  • the window pre-built unit 650 can hide the self-built window, and the content playing unit 620 can cancel the hiding of the pre-established self-built window when the video needs to be played.
  • the window pre-built unit 650 can also provide default video control parameters for the self-built window, and can also provide editable video control parameter options for the self-built window.
  • the window pre-built unit 650 can pre-establish a self-built window in the pre-established sub-thread, and the sub-thread can monitor the complete state during the self-built window playing process, and publish each state from the sub-thread to the main thread.
  • FIG. 7 is a schematic block diagram showing the structure of a computing device in accordance with an embodiment of the present application.
  • computing device 700 can be a desktop, portable computer, tablet, smart phone, personal data assistant (PDA), or other type of computer device, but is not limited to any particular form.
  • Computing device 700 can include, but is not limited to, processor 710 and memory 720.
  • the processor 710 can be a multi-core processor or a plurality of sub-processors.
  • processor 710 can include a general purpose main processor and one or more special coprocessors, such as a graphics processing unit (GPU), a digital signal processor (DSP), and the like.
  • GPU graphics processing unit
  • DSP digital signal processor
  • Memory 720 can include one or more of any type of storage device that stores files or other forms of content, including magnetic hard drives, solid state hard drives, semiconductor storage devices, flash memory, or any device capable of storing program instructions or digital information. Other computer readable and writable storage media.
  • Executable code may be stored on the memory 720. In the present application, when the executable code on the memory 720 is executed by the processor 710, the processor 710 may be caused to perform the video playing method shown in FIG.
  • the framework can also provide default video control parameters, such as schedule control, volume control, sound control and so on.
  • video control parameter options are available for developers to edit.
  • a developer-oriented interface can also be provided, which allows the developer to add custom control logic for the self-built window, for example, the developer can add the root layout of the video control interface to In the self-built window, the developer can customize the interface of the playback control according to the UI, such as adding different control layouts for the horizontal and vertical screens. For another example, the developer can also choose whether to pass the scroll event on the page, whether the scrolling event on the page is processed by the scrolling list, and the like.
  • the video playing framework implemented by the video playing solution of the present application can well support the mainstream control of the Android platform, so that the developer can integrate into a specific product function in a short time, and has strong expandability and low maintenance cost. It is in line with the changing genes of the Internet.
  • the developer only needs to provide a ViewGroup/View of the video playback area.
  • the framework will find all the scrollable Views in all its parent layouts based on this ViewGroup/View, such as ListView (List View) and RecyclerView ( Reuse view), ViewPager (sliding view). Then monitor the scroll event of the View, dynamically move the playback area of the video (ie, the position of the self-built window), and achieve the self-built window to follow the scrolling effect.
  • the video playing method of the present application is applied to the video playing process when the application is developed in the Android system as follows.
  • the first step increase the video playback ViewGroup (can be understood as an implementation of the self-built window mentioned above)
  • Step 2 Pass the ViewGroup of the final playback area
  • CoverLayout Get the ViewGroup of the area where the video is played (for example, it can be called CoverLayout), find the location of the CoverLayout on the screen, set the VideoPlayLayout to the display state, and move the position of the VideoPlayLayout to the top of the CoverLayout.
  • CoverLayout is the video to be played mentioned above.
  • Step 3 Get a scrollable ViewGroup and dynamically adjust the VideoPlayLayout position
  • the policy mode described herein may encapsulate a touch event for intercepting the View, and an implementation method for calculating the scroll distance of the View according to the intercepted Touch event.
  • the corresponding interface can be adjusted according to the position of the VideoPlayLayout in the screen, and the corresponding playback state can be set.
  • the interface mentioned herein may encapsulate the playing logic between the video playing state and the position, and the correspondence between the position and the playing state may be preset, for example, the distance scrolled in the VideoPlayLayout may exceed a predetermined distance. After that, stop its playback.
  • Step 4 Add the root layout of the video control interface to VideoPlayLayout
  • the root layout of the video control interface can be added to the VideoPlayLayout, and the developer can customize the interface of the playback control according to the UI.
  • the framework can also design a set of UI that implements playback control by default, such as progress control, volume control, and sound control.
  • Step 5 Global Control of Playback State Callback
  • the child thread can monitor the complete state during the video playback process, and each state is posted from the child thread to the main thread and distributed to the listening logic of each setting, so that the developer can handle some logic in the playing state process.
  • the lifecycle method related to the self-built window can be executed in the sub-thread, unifiedly managed by the one-way queue, and then released to the main thread for execution on the Android platform.
  • the self-built window may be pre-established in the pre-established sub-thread, and the sub-thread may be used to monitor the complete state during the self-built window playing process, and then the monitored state may be postped to the main thread. This ensures that the developer can control the playback life of the entire video, prevent ANR, and provide a possibility to play the video for the list.
  • the video playing method, apparatus, and computing device have been described in detail above with reference to the accompanying drawings.
  • the present application replaces a plurality of play containers in a playlist by a self-built play container, and preferably covers the play content of the self-built container over the original play content and follows the scroll event scroll, thereby maintaining the page response efficiency while maintaining the page.
  • the natural smooth display This scrolling follow-up solution can also be combined with a fixed small window scheme to provide a more complete video list playback experience.
  • the method according to the present application can also be implemented as a computer program or computer program product comprising computer program code instructions for performing the various steps defined above in the above method of the present application.
  • the application can be implemented as a non-transitory machine readable storage medium (or computer readable storage medium, or machine readable storage medium) having stored thereon executable code (or computer program, or computer instruction code)
  • executable code or computer program, or computer instruction code
  • the above code can be implemented as a reusable play "frame" to facilitate the corresponding movement and specific setting of the function of the solution.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions.
  • the functions noted in the blocks may also occur in a different order than the ones in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.

Abstract

本申请公开了一种视频播放方法、装置、计算设备以及存储介质。其中,通过获取页面上待播放视频的播放内容和播放位置信息,在自建窗口中播放获取的播放内容,其中根据播放位置信息使自建窗口覆盖播放位置的至少一部分,监听所述页面上的滚动事件,以及使得所述自建窗口跟随所述滚动事件进行滚动。由此,通过创建用于播放视频的自建窗口可以实现单一播放容器对页面中各视频的无 ANR 播放,并且通过自建窗口的跟随滚动提升窗口显示的自然度。

Description

视频播放方法、装置、计算设备以及存储介质 技术领域
本申请涉及多媒体技术领域,特别是涉及一种视频播放方法、装置、计算设备以及存储介质。
背景技术
随着互联网技术和多媒体技术的快速发展,视频在线播放业务被越来越多的用户使用。用户可以使用个人电脑、移动终端以及智能电视等多种形式的终端通过多种方式浏览在线视频资源。例如,用户可以通过腾讯视频、优酷、爱奇艺等视频播放软件点播视频,通过今日头条、新浪微博等新闻资讯类APP浏览视频资讯,通过UC浏览器、QQ浏览器、百度浏览器等浏览器APP观看视频,还可以通过斗鱼TV、虎牙TV等直播平台观看视频直播。
由于互联网上的视频资源较多,为了提高用户的浏览体验,现有的视频播放软件或视频播放网站大多是以视频列表的形式向用户展示可供观看的视频资源。图1示出了视频列表的一个例子。如图1所示,视频列表中各条视频相继排列,用户可以上下滑动操作来滚动视频列表,并通过点击视频封面中的播放键(在其他示例中,点击视频标题或视频封面的任意位置)来观看相应的视频。这种通过视频列表向用户展示视频资源的方式可以使用户直观、清楚地预览多个视频资源。
但由于系统(例如,Android系统)天然属性的限制,视频列表中的每个视频项都需要配备一个播放容器,使得在视频列表中各视频项被点播时,很容易造成UI线程被挂起,导致ANR(应用程序无响应),大大影响用户浏览体验。由此,需要一种在确保视频顺畅显示的情况下尽量避免ANR的技术方案。
发明内容
为了解决如上的至少一个问题,本申请提出了一种新的播放机制的视频播放方案。具体地,本申请通过一个自建的播放容器来代替播放列表中的多个播放容器,并且优选将自建容器的播放内容覆盖原始播放内容并跟随滚动事件滚动,由此在提升页面响应效率的同时保持页面的自然顺畅的显示。这一滚动跟随方案还可以与固定小窗方案相结合,以提供更为完善的视频列表播放体验。
根据本申请的一个方面,提供了一种视频播放方法,包括:获取页面上待播放视频的播放内容和播放位置信息;在自建窗口中播放获取的播放内容,其中根据播放位置信息使自建窗口覆盖播放位置的至少一部分;监听所述页面上的滚动事件;以及使得所述自建窗口跟随所述滚动事件进行滚动。
由此,通过创建用于播放视频的自建窗口可以实现单一播放容器对页面中各视频的无ANR播放,并且通过自建窗口的跟随滚动提升窗口显示的自然度。上述页面优选为至少包括两个或以上视频项的视频列表页面,以便能够从本申请的技术方案中受益。
自建窗口优选完全覆盖待播放视频的播放位置,由此使得播放效果更加自然。
优选地,上述滚动跟随可以仅仅在播放位置完全或部分处于屏幕内显示时进行。而当上述播放位置完全离开屏幕时,可以使得覆盖显示的自建窗口跳转至屏幕内的固定位置并对播放内容进行完整显示。由此,在视频播放的完整度和自然顺畅度之间取得良好的平衡。
优选地,监听页面上的滚动事件可以包括:预先获取页面的可滚动类型信息;根据获取的可滚动类型信息以及监听到的滚动事件计算滚动距离;以及使得自建窗口跟随滚动滚动距离。由此,在视频播放过程中,用户对页面中执行滚动操作时,不会影响视频的正常观看。
优选地,预先获取页面的可滚动类型信息可以包括:循环遍历页面上待播放视频区域的上级ViewGroup,并获取可滚动的ViewGroup,可滚动的ViewGroup包括ListView、RecyclerView和ViewPager。
优选地,该视频播放方法还可以包括:预先建立自建窗口,其中自建窗口被布置在最上层布局。自建窗口可被隐藏,并在需要播放视频时取消上述隐藏。由此确保在需要时对自建窗口的恰当显示。
优选地,预先建立自建窗口还可以包括:为自建窗口提供默认的视频控制参数;和/或为自建窗口提供可供编辑的视频控制参数选项。由此,可以进一步完善自建窗口的视频播放功能。
优选地,预先建立自建窗口还可以包括:在子线程中预先建立自建窗口。由此,通过在子线程中执行自建窗户口的建立事件,可以保证主线程的响应能力,避免由主线程的阻塞而引起ANR的发生。
优选地,子线程监听自建窗口播放过程中的完整状态,并将每个状态从子线程发布到主线程中。由此,通过将子线程监听到的视频播放状态Post到主线程,可以进一步避免ANR的发生。上述自建窗口可以在不同的时刻建立,以满足实际应用 中的具体要求。
根据本申请的另一个方面,还提供了一种视频播放装置,包括:播放信息获取单元,用于获取页面上待播放视频的播放内容和播放位置信息;内容播放单元,用于在自建窗口中播放获取的播放内容,其中根据播放位置信息使自建窗口覆盖播放位置的至少一部分;页面事件监听单元,用于监听页面上的滚动事件;以及窗口跟随单元,用于使使得所述自建窗口跟随所述滚动事件进行滚动。上述页面优选是可滚动的包括至少两个视频的视频播放列表页面。
优选地,所述内容播放单元可以使得所述自建窗口完全覆盖所述播放位置并在所述自建窗口中播放获取的播放内容。
优选地,所述窗口跟随单元可以在所述播放位置至少有一部分在屏幕内显示时,使得所述自建窗口跟随所述滚动事件进行滚动。
优选地,上述装置还可以包括:窗口固定单元,用于在所述播放位置完全或部分不在屏幕内显示时,使得所述自建窗口在所述屏幕内固定并完整显示。
优选地,页面事件监听单元可以用于:预先获取页面的可滚动类型信息;根据获取的可滚动类型信息以及监听到的滚动事件计算滚动距离;以及使得自建窗口跟随滚动滚动距离。
优选地,预先获取页面的可滚动类型信息可以包括:循环遍历页面上待播放视频区域的上级ViewGroup,并获取可滚动的ViewGroup,可滚动的ViewGroup包括ListView、RecyclerView和ViewPager。
优选地,该视频播放装置还可以包括:窗口预建单元,用于预先建立自建窗口,其中自建窗口被布置在最上层布局中。优选地,所述窗口预建单元可以隐藏自己预先建立的所述自建窗口,并且所述内容播放单元取消对预先建立的所述自建窗口的隐藏并在所述自建窗口中播放获取的播放内容。
优选地,窗口预建单元为自建窗口提供默认的视频控制参数;和/或为自建窗口提供可供编辑的的视频控制参数选项。
优选地,窗口预建单元在子线程中建立自建窗口。所述自建窗口可以在如下时刻建立:在播放视频的应用被启动时;在进入包括可播放视频的页面时;或者在所述包括可播放视频的页面内视频第一次被点击播放时。
优选地,子线程监听自建窗口播放过程中的完整状态,并将每个状态从子线程发布到主线程中。
根据本申请的又一个方面,还提供了一种计算设备,包括:处理器;以及存储器,其上存储有可执行代码,当可执行代码被处理器执行时,使处理器执行上文述 及的方法。
根据本申请的再一个方面,还提供了一种非暂时性机器可读存储介质,其上存储有可执行代码,当可执行代码被电子设备的处理器执行时,使处理器执行上文述及的方法。
本申请的视频播放方法、装置、计算设备以及存储介质,通过创建用于播放视频的自建窗口可以实现单一播放容器对页面中各视频的无ANR播放,并且通过自建窗口的跟随滚动提升窗口显示的自然度。上述跟随播放方案可以与小窗播放方案相结合,以便给出在视频播放的完整度和自然顺畅度之间具有良好的平衡的整体播放方案。
附图说明
通过结合附图对本公开示例性实施方式进行更详细的描述,本公开的上述以及其它目的、特征和优势将变得更加明显,其中,在本公开示例性实施方式中,相同的参考标号通常代表相同部件。
图1是示出了现有技术中视频播放列表的例子。
图2是用于实现本申请实施例的环境的示意图。
图3是示出了根据本申请一实施例的视频播放方法的示意性流程图。
图4和5分别示出了自建窗口保持跟随和跳转为小窗的例子。
图6是示出了根据本申请一实施例的视频播放装置的结构的示意性方框图。
图7是示出了根据本申请一实施例的计算设备的结构的示意性方框图。
具体实施方式
下面将参照附图更详细地描述本公开的优选实施方式。虽然附图中显示了本公开的优选实施方式,然而应该理解,可以以各种形式实现本公开而不应被这里阐述的实施方式所限制。相反,提供这些实施方式是为了使本公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的技术人员。
如图1所示,为了方便用户的视频观看与浏览,现有的视频播放列表中通常从上到下的排列着多个视频,例如,图中所示的该视频列表中的第N个和其后的第N+1个视频。用户可以对视频列表进行滚动,例如,通过对触屏的上下滑动,并且例如通过点击选择感兴趣的视频进行观看。上述布置虽然有助于用户的方便浏览和观看,但从操作系统(例如,Android系统)的功能实现来看,由于需要为视频列表中的每个视频项提供播放容器(即,包含了播放器的视图控件),很容易造成 UI线程(例如,本文中的主线程)的阻塞,从而导致极为影响用户体验的ANR。
针对于此,发明人深入研究后提出,可以通过建立一个自建窗口而将页面中原本需要的多个播放容器缩减为一个,并优选在子线程中实现其整个生命周期,从而大大减轻操作系统应对视频列表的负担。另外,上述自建窗口可以覆盖原有的播放区域并跟随用户的滚动操作滚动,使得用户感受不出其实并非在原始视频窗口而是在上层的自建窗口中观看视频。上述跟随滚动方案还可以与小窗播放方案相结合,例如,在原始视频窗口将要完全立刻屏幕显示时跳转至小窗播放,由此为用户提供一个更为完整全面的视频列表播放体验。
至此以视频播放列表为例,就本申请的视频播放方案的基本原理做了简要说明。需要说明的是,本申请的视频播放方案可以应用于多种类型的提供视频播放资源的页面。其中,本申请述及的页面可以是网页,也可以是嵌入在应用中的页面,例如,可以是腾讯视频等视频网站提供的网页,也可以是新浪微博、百度贴吧等资讯类网页,还可以是适于安装在移动终端上的今日头条等APP中的页面。并且,页面可以按照图1所示,以视频列表形式向用户展示可播放的视频资源,也可以以其它形式向用户展示可播放的视频资源。
下面将结合图2至图5详细说明本申请的视频播放方案。本申请实施例所提供的视频播放方案可应用于如图2所示的环境中。图2是用于实现本申请实施例的环境的示意图。在一个实施例中,环境中的移动终端10可以经由网络40实现与服务器20的信息收发。服务器20可以通过访问数据库30来获取移动终端10所需的内容。移动终端之间(例如,10_1与10_2或10_N之间)也可以经由网络40彼此通信。网络40可以是广义上的用于信息传递的网络,可以包括一个或多个通信网络,诸如无线通信网络、因特网、私域网、局域网、城域网、广域网或是蜂窝数据网络等。在一个实施例中,网络40也可以包括卫星网络,由此将移动终端10的GPS信号传送给服务器20。应当注意,如果向图2中添加或从图2中去除附加模块,不会改变本申请的示例实施例的底层概念。另外,虽然为了方便说明而在图中示出了从数据库30到服务器20的双向箭头,但本领域技术人员可以理解的是,上述数据的收发也是可以通过网络40实现的。
移动终端10是可用来进行网络访问的任何合适的便携式电子设备,包括但不限于智能电话、平板电脑或是其他便携式客户端。服务器20则是能够通过网络访问的提供交互服务所需信息的任何服务器。图中虽然示出了多个移动终端10-1…N以及单个服务器20和数据库30,并且在随后的描述中会选择其中的一个或部分移动终端加以描述(例如,移动终端10-1),但是本领域技术人员应该理解的是,上 述1…N个移动终端旨在表示真实网络中存在的多个移动终端,示出的单个服务器20和数据库30旨在表示本申请的技术方案涉及服务器及数据库的操作。对特定编号的移动端以及单个服务器和数据库加以详述至少为了说明方便,而非暗示对移动端和服务器的类型或是位置等具有限制。
图3是根据本申请一个实施例的视频播放方法的示意性流程图。该方法可由图2所示的移动终端10执行。
参见图3,方法始于步骤S310,获取页面上待播放视频的播放内容和播放位置信息。
此处述及的页面是指显示在移动终端上的带有视频播放资源的可滚动页面,其可以是移动终端通过浏览器访问的网页,也可以是安装在移动终端上的APP中的页面。页面可以提供一个或多个视频资源,优选为包括至少两个视频的可滚动视频播放列表页面,例如,图1所示页面。待播放视频可以是页面中用户期望播放的视频,可以根据用户对页面执行的拖动、点击等操作确定页面上的待播放视频,例如,图1中用户想要点击的视频N。对于待播放视频,可以将待播放视频在页面中的位置信息视为待播放视频的播放位置信息,并且可以根据待播放视频在页面中的属性设置信息确定其播放位置信息。在这里,播放位置是相对于页面而非屏幕显示而言的,页面的滚动会影响屏显的位置但不会改变播放位置。待播放视频的播放内容可以根据页面中指示的待播放视频的地址通过网络在线获取。
在步骤S320,在自建窗口中播放获取的播放内容。
在这里,可以将自建窗口看做是有别于上述页面而自行建立的窗口。自建窗口可以位于页面中,也可以位于页面之上,并且用于提供对用户可见的视频播放区域。自建窗口可以获取页面中各视频的播放权限(例如,通过其所属的子线程,如下将详述),使得页面中的视频均可以在该自建窗口中进行播放。优选可以将自建窗口布置在最上层布局中,以使得自建窗口不会被遮挡。作为本申请的一个可选实施例,可以预先建立自建窗口,并且自建窗口的初始状态可以设置为隐藏状态,然后响应于步骤S320的执行,可以取消对预先建立的自建窗口的隐藏。由此,在用户仅浏览页面而未点播视频的情况下,自建窗口被隐藏,不会影响用户正常的浏览体验,而通过将自建窗口布置在最上层布局中则可以保证视频的播放始终对用户可见。
在建立自建窗口的过程中,可以为自建窗口提供默认的视频控制参数,并且/或者,还可以为自建窗口提供可供编辑的视频控制参数选项。此处述及的视频控制参数可以是诸如音量控制、进度控制、声音控制等与视频播放相关的参数。
自建窗口的初始位置可以是一个任意值,在获取了待播放视频的播放位置信息 后,可以根据待播放视频的播放位置信息,重新设定自建窗口的位置。例如可以将自建窗口移动到待播放视频的播放位置,以覆盖待播放视频,也可以将自建窗口移动到部分覆盖播放位置的位置。优选地,使得所述自建窗口完全覆盖所述播放位置,使得用户完全感觉不到是在不同于原始视频窗口的上层窗口中观看视频。
在步骤S330,监听页面上的滚动事件,并且在步骤S340,使得自建窗口所述自建窗口跟随所述滚动事件进行滚动。
这里述及的页面上的滚动事件指的是用户例如通过上下滑动触摸屏而引起的滚动事件。在这里,滚动事件主要是指基于用户的输入而引起的页面中的页面内容的滚动。通过监听滚动事件可以(实时)获取页面中发生滚动的位移。根据本申请的应用场景不同,监听页面上的滚动事件的具体实现也不尽相同。例如,在本申请中的页面为基于浏览器访问的网页时,可以根据网页中滚动条的滚动参数来确定滚动距离。再例如,在本申请中的页面为安卓系统下嵌入在应用中的页面(例如图1所示的页面)时,由于页面中可能存在多种类型的可滚动的View(视图),例如ListView(列表视图)、RecyclerView(复用视图)、ViewPager(滑动视图),此时页面上的滚动事件大多是针对View的滚动,因此可以监听View的滚动,根据View的滚动参数确定具体的滚动距离。具体实现上,可以预先获取页面的可滚动类型信息,这里可以通过循环遍历页面上待播放视频区域的上级ViewGroup(视图组),以获取可滚动的ViewGroup,可滚动的ViewGroup可以包括ListView、RecyclerView、ViewPager等多种类型。在获取了可滚动类型信息后,可以根据所获取的可滚动类型信息以及监听到的滚动事件计算滚动距离,并使自建窗口(实时)跟随滚动所计算的滚动距离。
为了使得在页面上发生滚动事件时,不影响视频的正常观看。可以在执行步骤S330的过程中,执行步骤S340,使得自建窗口跟随滚动事件滚动并保存完整显示。换句话说,监听步骤和跟随步骤通常可以交替进行,以确保自建窗口对滚动操作的实时跟随。
在一个实施例中,可以为上述跟随操作限定具体范围,并且可以与小窗播放相结合以实现一个更为自然且完整的播放方案。例如,自建窗口可以仅在原始播放位置完全在屏幕中显示的情况下保持跟随,而其显示不完整时跳转为固定位置的小窗播放。例如,自建窗口也可以在原始播放位置只要有部分还在屏幕中显示的情况下保持跟随,而其显示不完整时跳转为固定位置的小窗播放。
图4和5分别示出了自建窗口保持跟随和跳转为小窗的例子。用户例如可以点击图1所示的视频N封面上的播放按钮,使得视频N开始播放。本申请的自建窗 口可以获取视频N的具体播放内容并完整覆盖该视频的默认播放位置,使得在用户看来该视频就像是由其默认视频播放容器进行播放的一样。随后用户可以对页面进行列表滚动操作,使得播放位置只有部分在屏幕内显示,这时仍然保持自建页面的跟随显示,如图4所示。而当视频N的播放位置完全不在屏幕内显示时,自建窗口的跟随播放可以转为小窗播放,如图5所示。这里的“播放容器”可以理解为包含了播放器的视图控件。而小窗播放则可以是固定位置播放,并且其大小可以相应调整,例如图5所示的右下角缩小显示。
虽然在此示出了跟随播放与小窗播放操作相结合的实施例,但本领域技术人员可以理解的是,本申请的跟随播放可以不与小窗播放相结合。例如,可以在放位置完全不在屏幕内显示时单纯保持或是停止自建窗口的显示等。
本申请的视频播放方案可以优选地应用于安卓系统中,例如可以应用于安卓系统下的应用开发,如今日头条、腾讯视频等提供视频播放资源的APP开发。在将本申请的视频播放方法应用于这类场景中时,为了避免会严重影响用户体验的ANR对话框的出现,可以在由子线程建立自建窗口,并将自建窗口的完整生命周期全部放在该子线程执行。另外,还可以由子线程执行步骤S330的监听操作,即可以由子线程监听自建窗口播放过程中的完整状态,并将监听到的每个状态发布到主线程。
根据具体的应用场景,可以在恰当的时刻建立本申请的自建窗口,例如在播放视频的应用被启动时;在进入包括可播放视频的页面时;在所述包括可播放视频的页面内视频第一次被点击播放时;或者其他合适的时刻。在自建窗口由子线程创建时,该子线程本身也可以在合适的时间点或是情况下创建。
至此,结合图3-5就本申请的视频播放方法做了详细说明,另外,本申请的视频播放方法还可以实现为一种视频播放装置。图6是示出了根据本申请一实施例的视频播放装置的结构的示意性方框图。其中,视频播放装置600的功能模块可以由实现本申请原理的硬件、软件或硬件和软件的结合来实现。本领域技术人员可以理解的是,图6所描述的功能模块可以组合起来或者划分成子模块,从而实现上述发明的原理。因此,本文的描述可以支持对本文描述的功能模块的任何可能的组合、或者划分、或者更进一步的限定。
下面仅就视频播放装置600可以具有的功能模块以及各功能模块可以执行的操作做简要说明,对于其中涉及的细节部分可以参见上文描述,这里不再赘述。
参见图6,视频播放装置600包括播放信息获取单元610、内容播放单元620、页面事件监听单元630以及窗口跟随单元640。
播放信息获取单元610用于获取页面上待播放视频的播放内容和播放位置信息, 内容播放单元620用于在自建窗口中播放获取的播放内容,其中根据播放位置信息使自建窗口覆盖所述播放位置的至少一部分。页面事件监听单元630用于监听页面上的跟随事件。窗口跟随单元640用于所述自建窗口跟随所述滚动事件滚动。
在一个实施例中,内容播放单元620可以使得所述自建窗口完全覆盖所述播放位置,由此使得用户不会感受到原始播放容器上的自建窗口,使得上述播放更为自然顺畅。
在一个实施例中,可以为上述跟随操作限定具体范围。例如,窗口跟随单元640可以在播放位置至少有一部分在屏幕内显示时,使得所述自建窗口跟随所述滚动事件进行滚动。跟随操作还可以与小窗播放相结合以实现一个更为自然且完整的播放方案。例如,视频播放装置600还可以包括窗口固定单元,用于在所述播放位置完全或部分不在屏幕内显示时,使得所述自建窗口在所述屏幕内固定并完整显示。
作为本申请的一个可选实施例,页面事件监听单元430可以预先获取页面的可滚动类型信息,根据获取的可滚动类型信息以及监听到的滚动事件计算滚动距离,使得自建窗口跟随滚动滚动距离。其中,可滚动类型信息可以包括循环遍历页面上待播放视频区域的上级ViewGroup,并获取可滚动的ViewGroup,可滚动的ViewGroup包括ListView、RecyclerView和ViewPager。
如图6所示,作为本申请的一个可选实施例,视频播放装置600还可以包括图中虚线框所示的窗口预建单元650。
窗口预建单元650可以用于预先建立自建窗口,其中自建窗口被布置在最上层布局。窗口预建单元650可以隐藏自建窗口,内容播放单元620则可在需要播放视频时取消对预先建立的自建窗口的隐藏。
可选地,窗口预建单元650还可以为自建窗口提供默认的视频控制参数,并且还可以为自建窗口提供可供编辑的视频控制参数选项。
窗口预建单元650可以在预先建立的子线程中预先建立自建窗口,子线程可以监听自建窗口播放过程中的完整状态,并将每个状态从子线程发布到主线程中。
图7是示出了根据本申请一实施例的计算设备的结构的示意性方框图。
参见图7,计算设备700可以是台式机、便携式计算机、平板电脑、智能手机、个人数据助理(PDA),或者其他类型的计算机装置,但是不限于任何特定形式。计算设备700可以包括但不限于处理器710和存储器720。
处理器710可以是一个多核的处理器,也可以包含多个子处理器。在一些实施例中,处理器710可以包含一个通用的主处理器以及一个或多个特殊的协处理器,例如图形处理器(GPU)、数字信号处理器(DSP)等等。
存储器720可以包括存储文件形式或其他形式的内容的任何类型的存储设备中的一个或多个,包括磁硬盘驱动器、固态硬驱、半导体存储设备、闪存,或者能够存储程序指令或数字信息的任何其他计算机可读可写存储介质。存储器720上可以存储有可执行代码,在本申请中,当存储器720上的可执行代码被处理器710执行时,可以使处理器710执行图3所示的视频播放方法。
具体应用
在当前的互联网领域内,无论是视频直播还是视频点播都是热点和商机所在。各大互联网公司争相在视频直播、视频点播上投入大量资源,希望能占据一席之地。但是由于安卓系统的开源本质导致安卓手机的碎片化,并且用户对相关产品的需求千变万化,因此尤其需要一个通用的播放框架来快速集成短视频功能的开发,以快速跟上需求的迭代。由此,为了便于开发者快速将视频播放功能集成到产品(APP)中,可以基于本申请的视频播放方案预先设计一个通用视频播放框架(framework),即可以将本申请的视频播放方法封装到该框架中,该框架为系统的可重用设计,其可被应用开发者使用。如此,基于预先设计的视频播放框架,开发者仅需按照产品需求设计视频的UI,即可实现自定义的视频播放功能,例如列表视频播放,从而可以快速将自定义的视频播放功能集成到产品中,设计过程中不需要考虑兼容性问题,也不需要考虑页面滚动时视频的生命周期,在短时间内就可以实现良好的视频播放体验效果。
另外,为了进一步便于开发者设计,框架中还可以为提供默认的视频控制参数,例如进度控制、音量控制、声音控制等等。并且,还可以提供可供开发者编辑的视频控制参数选项。优选地,为了提高框架的可扩展性,还可以提供面向开发者的接口,该接口可以允许开发者加入针对自建窗口的自定义控制逻辑,例如开发者可以将视频控制界面的根布局添加到自建窗口中,开发者可以根据UI来自定义播放控制的界面,比如针对横竖屏增加不同的控制布局等。再例如,还可以让开发者选择是否将页面上的滚动事件透传下去,是否由滚动的列表处理页面上的滚动事件等等。
由此,基于本申请的视频播放方案实现的视频播放框架能良好的支持Android平台的主流控件,让开发者能在短时间内集成到特定的产品功能中,且扩展性强,维护成本小,符合互联网多变的基因。开发者只需要提供一个视频播放区域的ViewGroup(视图组)/View(视图),该框架会根据此ViewGroup/View找到其所有父布局中所有能滚动的View,例如ListView(列表视图)、RecyclerView(复用视图)、ViewPager(滑动视图)。然后监听View的滚动事件,动态移动视频的播放区域(即自建窗口的位置),达到自建窗口跟随滚动效果。
本申请的视频播放方法应用于安卓系统中的应用开发时的视频播放流程如下。
第一步:增加视频播放ViewGroup(可以理解为上文述及的自建窗口的一个实现)
将容纳视频播放的ViewGroup(例如,可将其称为VideoPlayLayout)添加到Activity的最上层布局,然后将其隐藏。
第二步:传递最终播放区域的ViewGroup
获取视频播放展示的区域的ViewGroup(例如,可将其称为CoverLayout),找到该CoverLayout在屏幕中位置,将VideoPlayLayout设置为显示状态,移动VideoPlayLayout的位置到CoverLayout之上。CoverLayout即为上文述及的待播放视频。
第三步:得到可滚动的ViewGroup,动态调整VideoPlayLayout位置
这里可以通过循环遍历CoverLayout的父ViewGroup,得到可滚动的ViewGroup(例如ListView),然后可以采用策略模式根据不同的可滚动视图得到对应的滚动距离,动态设置VideoPlayLayout在屏幕中的位置,让其跟随滚动。其中,此处述及的策略模式中可以封装用于拦截View的Touch事件、根据所拦截的Touch事件计算View的滚动距离的实现方法。
在将VideoPlayLayout动态设置在屏幕中的位置后,可以根据VideoPlayLayout在屏幕中的位置来回调相应的接口,设置对应播放状态。其中,此处述及的接口中可以封装有视频播放状态与位置之间的播放逻辑,位置和播放状态之间的对应关系可以是预先设定的,例如可以是在VideoPlayLayout滚动的距离超过预定距离后,停止其播放。
第四步:添加视频控制界面的根布局到VideoPlayLayout
为了提高框架的可扩展性,可以将视频控制界面的根布局添加到VideoPlayLayout中,开发者可以根据UI来自定义播放控制的界面。另外,框架还可以设计一套默认实现播放控制的UI,比如进度控制、音量控制、声音控制等。
第五步:播放状态回调的全局控制
可以由子线程监听视频播放过程中的完整状态,将每个状态从子线程post到主线程中,并分发给各个设置的监听逻辑中,如此可以方便开发者处理一些播放状态过程中的逻辑。具体实现上,可以将与自建窗口相关的生命周期方法放在子线程中执行,统一用单向队列管理,然后依次在Android平台上发布到主线程执行。具体地,可以在预先建立的子线程中预先建立自建窗口,并且可以使用子线程监听自建窗口播放过程中的完整状态,然后可以将监听到的状态Post到主线程中。如此可以 保证开发者能自己控制整个视频的播放生命周期,防止ANR,并为列表播放视频提供可能。
上文中已经参考附图详细描述了根据本申请的视频播放方法、装置以及计算设备。本申请通过一个自建的播放容器来代替播放列表中的多个播放容器,并且优选将自建容器的播放内容覆盖原始播放内容并跟随滚动事件滚动,由此在提升页面响应效率的同时保持页面的自然顺畅的显示。这一滚动跟随方案还可以与固定小窗方案相结合,以提供更为完善的视频列表播放体验。
此外,根据本申请的方法还可以实现为一种计算机程序或计算机程序产品,该计算机程序或计算机程序产品包括用于执行本申请的上述方法中限定的上述各步骤的计算机程序代码指令。
或者,本申请还可以实施为一种非暂时性机器可读存储介质(或计算机可读存储介质、或机器可读存储介质),其上存储有可执行代码(或计算机程序、或计算机指令代码),当所述可执行代码(或计算机程序、或计算机指令代码)被电子设备(或计算设备、服务器等)的处理器执行时,使所述处理器执行根据本申请的上述方法的各个步骤。上述代码尤其可以实现为一种可重用的播放“框架”,以方便对本方案的功能进行相应的移至和具体设定。
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。
附图中的流程图和框图显示了根据本申请的多个实施例的系统和方法的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标记的功能也可以以不同于附图中所标记的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
以上已经描述了本申请的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (26)

  1. 一种视频播放方法,包括:
    获取页面上待播放视频的播放内容和播放位置信息;
    在自建窗口中播放获取的播放内容,其中根据所述播放位置信息使所述自建窗口覆盖所述播放位置的至少一部分;
    监听所述页面上的滚动事件;以及
    使得所述自建窗口跟随所述滚动事件进行滚动。
  2. 如权利要求1所述的方法,其中,在自建窗口中播放获取的播放内容,其中根据所述播放位置信息使所述自建窗口覆盖所述播放位置的至少一部分包括:
    使得所述自建窗口完全覆盖所述播放位置。
  3. 如权利要求1所述的方法,其中,使得所述自建窗口跟随所述滚动事件进行滚动包括:
    在所述播放位置至少有一部分在屏幕内显示时,使得所述自建窗口跟随所述滚动事件进行滚动。
  4. 如权利要求3所述的方法,还包括:
    在所述播放位置完全或部分不在屏幕内显示时,使得所述自建窗口在所述屏幕内固定并完整显示。
  5. 如权利要求1所述的方法,其中,所述监听所述页面上的滚动事件包括:
    预先获取所述页面的可滚动类型信息;
    根据获取的所述可滚动类型信息以及监听到的滚动事件计算滚动距离;以及
    使得所述自建窗口跟随滚动所述滚动距离。
  6. 如权利要求5所述的方法,其中,所述预先获取所述页面的可滚动类型信息包括:
    循环遍历所述页面上待播放视频区域的上级ViewGroup,并获取可滚动的ViewGroup,可滚动的ViewGroup包括ListView、RecyclerView和ViewPager。
  7. 如权利要求1所述的方法,还包括:
    预先建立所述自建窗口,其中所述自建窗口被布置在最上层布局中。
  8. 如权利要求7所述的方法,其中,所述预先建立所述自建窗口还包括:
    为所述自建窗口提供默认的视频控制参数;和/或
    为所述自建窗口提供可供编辑的视频控制参数选项。
  9. 如权利要求7所述的方法,其中,所述预先建立所述自建窗口还包括:
    隐藏预先建立的所述自建窗口,并且
    所述在自建窗口中播放获取的播放内容包括:
    取消对预先建立的所述自建窗口的隐藏并在所述自建窗口中播放获取的播放内容。
  10. 如权利要求7所述的方法,还包括:
    由子线程建立所述自建窗口,其中所述子线程监听所述自建窗口播放过程中的完整状态,并将每个状态从所述子线程发布到主线程中。
  11. 如权利要求10所述的方法,其中,所述自建窗口在如下时刻建立:
    在播放视频的应用被启动时;
    在进入包括可播放视频的页面时;或者
    在所述包括可播放视频的页面内视频第一次被点击播放时。
  12. 如权利要求1所述的方法,其中,所述页面是可滚动的包括至少两个视频的视频播放列表页面。
  13. 一种视频播放装置,包括:
    播放信息获取单元,用于获取页面上待播放视频的播放内容和播放位置信息;
    内容播放单元,用于在自建窗口中播放获取的播放内容,其中根据所述播放位置信息使所述自建窗口覆盖所述播放位置的至少一部分;
    页面事件监听单元,用于监听所述页面上的滚动事件;以及
    窗口跟随单元,用于使得所述自建窗口跟随所述滚动事件进行滚动。
  14. 如权利要求13所述的装置,其中,所述内容播放单元使得所述自建窗口完全覆盖所述播放位置并在所述自建窗口中播放获取的播放内容。
  15. 如权利要求13所述的装置,其中,所述窗口跟随单元在所述播放位置至少有一部分在屏幕内显示时,使得所述自建窗口跟随所述滚动事件进行滚动。
  16. 如权利要求15所述的装置,还包括:
    窗口固定单元,用于在所述播放位置完全或部分不在屏幕内显示时,使得所述自建窗口在所述屏幕内固定并完整显示。
  17. 如权利要求13所述的装置,其中,所述页面事件监听单元进一步用于:
    预先获取所述页面的可滚动类型信息;
    根据获取的所述可滚动类型信息以及监听到的滚动事件计算滚动距离;以及
    使得所述自建窗口跟随滚动所述滚动距离。
  18. 如权利要求17所述的装置,其中,所述预先获取所述页面的可滚动类型 信息包括:
    循环遍历所述页面上待播放视频区域的上级ViewGroup,并获取可滚动的ViewGroup,可滚动的ViewGroup包括ListView、RecyclerView和ViewPager。
  19. 如权利要求13所述的装置,还包括:
    窗口预建单元,用于预先建立所述自建窗口,其中所述自建窗口被布置在最上层布局中。
  20. 如权利要求19所述的装置,其中,所述窗口预建单元为所述自建窗口提供默认的视频控制参数;和/或为所述自建窗口提供可供编辑的视频控制参数选项。
  21. 如权利要求19所述的装置,其中,所述窗口预建单元隐藏预先建立的所述自建窗口,并且,
    所述内容播放单元取消对预先建立的所述自建窗口的隐藏并在所述自建窗口中播放获取的播放内容。
  22. 如权利要求19所述的装置,其中,所述窗口预建单元由子线程建立所述自建窗口。
  23. 如权利要求22所述的装置,其中,所述自建窗口在如下时刻建立:
    在播放视频的应用被启动时;
    在进入包括可播放视频的页面时;或者
    在所述包括可播放视频的页面内视频第一次被点击播放时。
  24. 如权利要求13所述的装置,其中,所述页面是可滚动的包括至少两个视频的视频播放列表页面。
  25. 一种计算设备,包括:
    处理器;以及
    存储器,其上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器执行如权利要求1-12中任何一项所述的方法。
  26. 一种非暂时性机器可读存储介质,其上存储有可执行代码,当所述可执行代码被电子设备的处理器执行时,使所述处理器执行如权利要求1至12中任一项所述的方法。
PCT/CN2018/094273 2017-07-06 2018-07-03 视频播放方法、装置、计算设备以及存储介质 WO2019007327A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710546196.8 2017-07-06
CN201710546196.8A CN107241657A (zh) 2017-07-06 2017-07-06 视频播放方法、装置、计算设备以及存储介质

Publications (1)

Publication Number Publication Date
WO2019007327A1 true WO2019007327A1 (zh) 2019-01-10

Family

ID=59990363

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/094273 WO2019007327A1 (zh) 2017-07-06 2018-07-03 视频播放方法、装置、计算设备以及存储介质

Country Status (2)

Country Link
CN (1) CN107241657A (zh)
WO (1) WO2019007327A1 (zh)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241657A (zh) * 2017-07-06 2017-10-10 广州优视网络科技有限公司 视频播放方法、装置、计算设备以及存储介质
CN110300328B (zh) * 2018-03-21 2021-11-02 腾讯科技(深圳)有限公司 一种视频播放控制方法、装置及可读存储介质
CN108924623A (zh) * 2018-07-27 2018-11-30 北京优酷科技有限公司 视频窗口的展示控制方法及装置
CN108881998A (zh) * 2018-08-13 2018-11-23 北京搜狐新动力信息技术有限公司 一种视频播放方法及装置
CN109688455B (zh) * 2018-12-27 2021-03-09 北京字节跳动网络技术有限公司 视频播放方法、装置及设备
CN110267088B (zh) * 2019-07-18 2021-09-07 北京字节跳动网络技术有限公司 视频播放的控制方法、装置、电子设备、及存储介质
CN112911367B (zh) * 2019-12-03 2022-04-19 腾讯科技(深圳)有限公司 视频播放界面的处理方法、装置和电子设备
CN110996154B (zh) * 2019-12-13 2022-09-02 北京爱奇艺科技有限公司 一种视频播放方法、装置及电子设备
CN111586486A (zh) * 2020-03-31 2020-08-25 深圳市麦谷科技有限公司 一种基于ijk实现可移植播放控制的方法及系统
CN115002549A (zh) * 2021-03-01 2022-09-02 腾讯科技(深圳)有限公司 视频画面的显示方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120296739A1 (en) * 2011-05-20 2012-11-22 Sukhinder Singh Cassidy System For Selling Products Based On Product Collections Represented In Video
CN103841342A (zh) * 2014-03-20 2014-06-04 乐视网信息技术(北京)股份有限公司 显示控制方法及其系统
CN104268251A (zh) * 2014-09-30 2015-01-07 北京奇虎科技有限公司 一种网页中视频元素的播放方法和装置
US20160080817A1 (en) * 2014-09-11 2016-03-17 Opentv Inc. System and method of displaying content based on locational activity
CN107241657A (zh) * 2017-07-06 2017-10-10 广州优视网络科技有限公司 视频播放方法、装置、计算设备以及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504648A (zh) * 2008-11-14 2009-08-12 北京搜狗科技发展有限公司 展现网页资源的方法及装置
CN102117291B (zh) * 2009-12-30 2013-03-06 北京搜狗科技发展有限公司 一种展现网络资源的方法及系统
CN102117290B (zh) * 2009-12-30 2015-03-18 北京搜狗科技发展有限公司 一种展现网页中页面元素的方法及系统
CN103577176A (zh) * 2012-08-02 2014-02-12 腾讯科技(深圳)有限公司 视频独立播放的实现方法及实现该方法的移动终端设备
CN104133898A (zh) * 2014-07-31 2014-11-05 上海二三四五网络科技股份有限公司 一种浏览器内视频小窗播放的方法和装置
CN104965693A (zh) * 2014-08-29 2015-10-07 腾讯科技(深圳)有限公司 一种视频处理的方法和系统
CN104469516B (zh) * 2014-12-11 2017-12-19 福州瑞芯微电子股份有限公司 一种安卓系统的网页视频处理方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120296739A1 (en) * 2011-05-20 2012-11-22 Sukhinder Singh Cassidy System For Selling Products Based On Product Collections Represented In Video
CN103841342A (zh) * 2014-03-20 2014-06-04 乐视网信息技术(北京)股份有限公司 显示控制方法及其系统
US20160080817A1 (en) * 2014-09-11 2016-03-17 Opentv Inc. System and method of displaying content based on locational activity
CN104268251A (zh) * 2014-09-30 2015-01-07 北京奇虎科技有限公司 一种网页中视频元素的播放方法和装置
CN107241657A (zh) * 2017-07-06 2017-10-10 广州优视网络科技有限公司 视频播放方法、装置、计算设备以及存储介质

Also Published As

Publication number Publication date
CN107241657A (zh) 2017-10-10

Similar Documents

Publication Publication Date Title
WO2019007327A1 (zh) 视频播放方法、装置、计算设备以及存储介质
US10999650B2 (en) Methods and systems for multimedia content
JP6427616B2 (ja) ディスプレイ・オブジェクトの前生成
JP2020035469A (ja) ユーザ・インターフェース内のコンポーネントの位置調整
US10296641B2 (en) Techniques for efficient access of software application functionality in search
JP2018531454A (ja) 非ブラウザアプリケーションにおけるコンテンツの統合
JP2018531454A6 (ja) 非ブラウザアプリケーションにおけるコンテンツの統合
US11245951B2 (en) Display device and content providing method thereof
KR20160123377A (ko) 크리에이티브의 랜딩 페이지와 함께 기능적 확장들을 제공하는 방법들 및 시스템들
US20150248722A1 (en) Web based interactive multimedia system
US20180376209A1 (en) Video player framework for a media distribution and management platform
US20160179766A1 (en) Electronic device and method for displaying webpage using the same
KR20150143718A (ko) 애플리케이션-맞춤형 객체 사전-확대
CN105229691B (zh) 在滚动时延迟繁重操作
US11947695B2 (en) Discovering availability of digital media from multiple sources
JP2021534606A (ja) デジタルコンテンツ消費の同期
CN110618811B (zh) 信息呈现方法和装置
US10055508B1 (en) Platform-agnostic thick-client system for combined delivery of disparate streaming content and dynamic content by combining dynamic data with output from a continuous queue transmitter
US20190109798A1 (en) Platform-agnostic thick-client system for combined delivery of disparate streaming content and dynamic content by combining dynamic data with output from a continuous queue transmitter
CN113038225B (zh) 视频播放方法、装置、计算设备以及存储介质
US10769354B2 (en) System and method for triggering state changes in content with initiation of multi-media playback
JP6491261B2 (ja) 情報表示プログラム、情報表示方法、情報表示装置、及び配信装置
CN114286158B (zh) 直播间的虚拟资源活动显示方法、装置、介质以及设备
CN108984247A (zh) 一种信息展示方法及其终端设备和网络设备
US20230128808A1 (en) Connected cloud applications

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18828349

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18828349

Country of ref document: EP

Kind code of ref document: A1