Video playing method, device, computer device and storage medium

By pre-loading video segments based on available bandwidth and playing from local storage, the method addresses memory and performance issues in traditional video streaming, achieving faster and smoother video playback.

CN115174987BActive Publication Date: 2025-07-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110366499.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-06
Publication Date
2025-07-15
Estimated Expiration
2041-04-06

AI Technical Summary

Technical Problem

The prior art requires waiting for the first-frame video screen to load when playing video, resulting in slow startup speed and pre-initialization of multiple player instances occupies a large amount of memory, affecting device performance and running stuttering.

Method used

Through the preload bandwidth control strategy, the video of the video is cached locally, the video to be preloaded is determined and cached based on the available bandwidth, optimize bandwidth usage, avoid excessive resources, and improve video playback speed.

Benefits of technology

It improves the first frame speed of video playback, reduces the server transcoding delay and transmission delay, and improves the operation stability and startup rate of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115174987B_ABST
    Figure CN115174987B_ABST
Patent Text Reader

Abstract

The present application relates to a video playing method, apparatus, computer device, and storage medium. The method relates to the technical field of video processing, and the method includes: displaying a current video playing page; determining at least one preloading video to be preloaded when staying on the video playing page; caching the first-screen video segments of each of the preloading videos to the local based on a preloading bandwidth control policy; determining a target preloading video requested by a trigger operation in the video playing page; obtaining the first-screen video segment corresponding to the target preloading video from the local; and playing the target preloading video starting from the first-screen video segment. By using this method, the speed of starting video playing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and particularly to a method, apparatus, computer device, and storage medium for playing videos. Background Art

[0002] With the development of computer technology and Internet technology, videos have become one of the important channels for people to obtain information, and video forms are becoming more and more diverse, such as live videos, online videos, etc. When starting to play a video, users often need to wait for the loading of the first-frame video image and have to wait a long time to see the video image.

[0003] In order to improve the speed of starting to play a video, the traditional method is to pre-initialize multiple player instances before playing the video and use these multiple player instances to simultaneously start multiple stream warm-ups. When the user switches the video, one of the multiple player instances can be directly used to play the pre-warmed video stream. However, this method occupies a large amount of memory and is overly dependent on device performance, which will cause the terminal to run stuck and heat up, and instead affects the speed of starting to play the video to a certain extent. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a method, apparatus, computer device, and storage medium for playing videos that can improve the first-frame playing speed when playing videos.

[0005] A method for playing a video, the method comprising:

[0006] Display the current video playing page;

[0007] Determine at least one pre-loaded video to be pre-loaded when staying on the video playing page;

[0008] Based on a pre-loading bandwidth control policy, cache the first-screen video segments of each pre-loaded video locally;

[0009] Determine the target pre-loaded video requested by a trigger operation on the video playing page;

[0010] Obtain the first-screen video segment corresponding to the target pre-loaded video from local;

[0011] Start playing the target pre-loaded video from the first-screen video segment.

[0012] A video playing apparatus, the apparatus comprising:

[0013] A display module, configured to display the current video playing page;

[0014] A pre-loaded video determination module, configured to determine at least one pre-loaded video to be pre-loaded when staying on the video playing page;

[0015] A cache module, configured to cache the first-screen video segments of each preloaded video locally based on a preloading bandwidth control policy;

[0016] A target preloading video determination module, configured to determine a target preloading video requested by a trigger operation in a video playback page;

[0017] An acquisition module, configured to acquire the first-screen video segment corresponding to the target preloading video from local;

[0018] A playback module, configured to start playing the target preloading video from the first-screen video segment.

[0019] In one embodiment, the cache module is further configured to: determine the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine the number of videos to be preloaded according to the available bandwidth; select target videos from each preloaded video according to the number of videos; and cache the first-screen video segments of each target video locally.

[0020] In one embodiment, the cache module is further configured to: determine the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine the preloading speed according to the available bandwidth; and cache the first-screen video segments of each preloaded video locally according to the preloading speed.

[0021] In one embodiment, the video playback page is a live video playback page, and the preloaded video is a preloaded live video; the video playback device further includes an update module, and the update module is configured to: determine the time interval for updating the local cache; and after pulling the latest first-screen video segments of each preloaded live video according to the time interval, update the first-screen video segments of each preloaded live video in the local cache.

[0022] In one embodiment, the update module is further configured to: determine the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine the single-task loading bandwidth according to the available bandwidth and the number of preloaded live videos; determine the single-task loading traffic of each preloaded live video according to the duration of the first-screen video segment of the preloaded live video; obtain the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic; and use the single-task loading duration as the time interval for updating the local cache.

[0023] In one embodiment, the update module is further configured to: determine whether the time interval for updating the local cache meets the live video frame chasing condition; and when the time interval meets the live video frame chasing condition, perform the step of updating the first-screen video segments of each preloaded live video in the local cache.

[0024] In one embodiment, the update module is further configured to: when the time interval does not meet the live frame chasing condition, adjust the number of pre-loaded live videos; re-determine the time interval for updating the local cache according to the adjusted number of pre-loaded live videos until the time interval meets the live frame chasing condition.

[0025] In one embodiment, the update module is further configured to: obtain the buffering duration of the live video of the video server and the caching duration of the local first-screen video segment; when the time interval for updating the local cache is less than or equal to the sum of the buffering duration and the caching duration, determine that the time interval meets the live frame chasing condition; when the time interval for updating the local cache is greater than the sum of the buffering duration and the caching duration, determine that the time interval does not meet the live frame chasing condition.

[0026] In one embodiment, the video playing device further includes an allocation module, and the allocation module is configured to: allocate local link addresses to each pre-loaded video; the obtaining module is further configured to: determine the target local link address corresponding to the target pre-loaded video; obtain the first-screen video segment of the target pre-loaded video from the local according to the target local link address.

[0027] In one embodiment, the playing module is further configured to: play the first-screen video segment corresponding to the target pre-loaded video obtained from the local; during the process of playing the first-screen video segment, pull the remaining video segments corresponding to the target pre-loaded video from the video server; after the first-screen video segment finishes playing, continue to play the target pre-loaded video according to the remaining video segments.

[0028] In one embodiment, the playing module is further configured to: according to the time stamp corresponding to the last frame of the first-screen video segment of the target pre-loaded video cached locally, request the remaining video segments corresponding to the target pre-loaded video from the video server; receive the remaining video segments sent by the video server.

[0029] In one embodiment, the video playing device further includes a request module, and the request module is configured to: when the local has not completed caching the first-screen video segment of the target pre-loaded video requested by the trigger operation, or has not completed updating the first-screen video segment of the target pre-loaded video, directly request the target pre-loaded video from the video server and then play it.

[0030] A computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0031] Display the current video playing page;

[0032] Determine at least one pre-loaded video to be pre-loaded when staying on the video playing page;

[0033] Based on the preloading bandwidth control strategy, cache the first-screen video segments of each preloaded video locally;

[0034] Determine the target preloaded video requested by the trigger operation in the video playback page;

[0035] Obtain the first-screen video segment corresponding to the target preloaded video from local;

[0036] Start playing the target preloaded video from the first-screen video segment.

[0037] A computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0038] Display the current video playback page;

[0039] Determine at least one preloaded video to be preloaded when staying on the video playback page;

[0040] Based on the preloading bandwidth control strategy, cache the first-screen video segments of each preloaded video locally;

[0041] Determine the target preloaded video requested by the trigger operation in the video playback page;

[0042] Obtain the first-screen video segment corresponding to the target preloaded video from local;

[0043] Start playing the target preloaded video from the first-screen video segment.

[0044] A computer program, which includes computer instructions. The computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps of the above video playback method.

[0045] The above video playing method, device, computer equipment and storage medium determine at least one preloading video to be preloaded in advance when currently displaying a video playing page, and cache the first-screen video segments of each preloading video to the local based on a preloading bandwidth control policy. On the one hand, the first-screen video segments of the preloading videos are cached based on the preloading bandwidth control policy, which can control the bandwidth occupied by preloading within the available bandwidth range, avoid excessive bandwidth occupation by preloading from affecting the normal playing of the video in the current video playing page, and the preloading bandwidth control policy enables the caching process to proceed orderly and smoothly, without occupying too much memory resources and without causing device operation lag, thus improving the video startup playing rate. On the other hand, by caching the first-screen video segments of the preloading videos to the local first, when a trigger operation to switch to play the target preloading video is obtained, the first-screen video segment corresponding to the target preloading video can be directly obtained from the local, and the target preloading video is played starting from the first-screen video segment. Since the locally cached video segment is played first, there is no need to pull the first-screen video segment of the target video from the video server, avoiding transcoding delay of the video server, transmission delay between the server and the terminal, etc., thereby improving the speed of starting video playing. Description of the Drawings

[0046] Figure 1 It is an application environment diagram of the video playing method in an embodiment;

[0047] Figure 2 It is a flowchart of the video playing method in an embodiment;

[0048] Figure 3 It is a schematic diagram of a video playing page in an embodiment;

[0049] Figure 4 It is a schematic diagram of a video playing page in another embodiment;

[0050] Figure 5 It is a schematic diagram of live video frame chasing in an embodiment;

[0051] Figure 6 It is a functional schematic diagram of a software development kit in an embodiment;

[0052] Figure 7 It is a schematic diagram of a task queue management service in an embodiment;

[0053] Figure 8 It is a flowchart of the video playing method in another embodiment;

[0054] Figure 9 It is a flowchart of the video playing method in yet another embodiment;

[0055] Figure 10Block diagram of a video playback device in an embodiment;

[0056] Figure 11 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0057] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0058] The video playback method provided by the embodiments of the present application relates to cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.

[0059] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The back-end services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the back-end system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system back-end support, which can only be achieved through cloud computing.

[0060] The video playback method provided by the embodiments of the present application mainly relates to cloud computing in cloud technology. Cloud computing refers to the delivery and usage model of IT infrastructure, which means obtaining the required resources in a on-demand and easily expandable manner through the network; in a broad sense, cloud computing refers to the delivery and usage model of services, which means obtaining the required services in a on-demand and easily expandable manner through the network. Such services can be related to IT and software, the Internet, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balance.

[0061] With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the driving forces of demands such as search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from previous parallel distributed computing, the emergence of cloud computing will, in concept, drive a revolutionary change in the entire Internet model and enterprise management model.

[0062] For example, in the embodiment of the present application, the video server receives the original video stream uploaded by the live streaming terminal, and converts the original video stream into transcoded video streams with different encoding formats, different resolutions, and different bitrates to meet the playback requirements in various scenarios such as different network environments and different pulling terminal devices.

[0063] The video playback method provided by the embodiment of the present application also relates to blockchain technology. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0064] For example, in the embodiment of the present application, the video server can be a blockchain node in the blockchain network. The live streaming terminal transmits the original video stream to the blockchain node in the blockchain network, and the pulling terminal pulls the transcoded video stream from the blockchain network for playback.

[0065] The video playback method provided by the present application can be applied to the application environment as Figure 1 shown. Among them, the live streaming terminal 102 and the pulling terminal 106 communicate with the video server 104 through the network respectively. The video server 104 can be an online video server or a live video server. The live streaming terminal 102 collects and encodes to generate the original video stream, and transmits the original video stream to the video server 104; the video server 104 converts the original video stream into transcoded video streams with different encoding formats, different resolutions, and different bitrates to meet the playback requirements in various scenarios such as different network environments and different pulling terminal devices; the pulling terminal 106 pulls the transcoded video stream from the video server 104 for playback.

[0066] In one embodiment, the pull stream terminal 106 displays the current video playback page, determines at least one preloaded video to be preloaded when staying on the video playback page; based on the preloading bandwidth control policy, pulls the first-screen video segments of each preloaded video from the video server 104 and caches them locally; the pull stream terminal 106 determines the target preloaded video requested by the trigger operation in the video playback page, obtains the first-screen video segment corresponding to the target preloaded video from local, and starts playing the target preloaded video from the first-screen video segment. Optionally, during the playback of the first-screen video segment, the remaining video segments corresponding to the target preloaded video are pulled from the video server 104, and when the first-screen video segment playback ends, the target preloaded video is continued to be played according to the remaining video segments.

[0067] Among them, the push stream terminal 102 and the pull stream terminal 106 can both be but are not limited to various personal computers, laptop computers, smart phones, tablet computers, portable wearable devices, televisions, etc. The video server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0068] The video playback method provided by the embodiments of the present application may be executed by the video playback device provided by the embodiments of the present application, or a terminal integrated with the video playback device, where the video playback device may be implemented in a hardware or software manner.

[0069] The video playback method provided by the embodiments of the present application can be applied to video playback scenarios, such as online video playback scenarios, live video playback scenarios, and so on.

[0070] For example, in an online video playback scenario, through the method provided by the embodiments of the present application, the pull stream terminal is currently displaying the video picture of the current online video through the current video playback page. The pull stream terminal determines at least one preloaded video to be preloaded when staying on the current video playback page. The preloaded video can be an online video published by a friend followed by the user, for example, an online video with high current popularity, large click volume or high comment count, or an online video pushed by the video server to the user. The pull stream terminal can cache the first-screen video segments of each preloaded online video based on the preloading bandwidth control policy. When the terminal detects a trigger operation to switch to the target preloaded online video among the at least one preloaded video, it obtains the first-screen video segment corresponding to the target preloaded online video from local and starts playing the target preloaded online video from the first-screen video segment. In this way, the first-frame playback speed during online video playback can be improved.

[0071] For example, in a live video playback scenario, by using the method provided in the embodiments of the present application, the video streaming terminal is currently displaying the video picture of the current live video through the video playback page. When the video streaming terminal determines at least one preloading live video to be preloaded when staying on the current video playback page, the preloading live video can be the live video being broadcast by the anchor that the user is following, or the live video with a relatively high current popularity, such as a live video with a relatively high current number of viewers, or it can also be the live video pushed by the video server. The video streaming terminal can cache the first-screen video segments of each preloading live video based on the preloading bandwidth control policy, and update the first-screen video segments cached locally at time intervals, so that the first-screen video segments cached locally closely follow the progress of the corresponding preloading live video. When the terminal detects a trigger operation to switch to the target preloading live video among the at least one preloading live videos, it obtains the first-screen video segment corresponding to the target preloading live video from the local, and starts playing the target preloading live video from the first-screen video segment. In this way, the first-frame playback speed during live video playback can be improved.

[0072] In one embodiment, as Figure 2 shown, a video playback method is provided. In this embodiment, the method is mainly illustrated by applying it to the video streaming terminal 106 (hereinafter referred to as the terminal) in the above Figure 1 , and the method includes the following steps:

[0073] Step S202: Display the current video playback page.

[0074] Among them, the video playback page is a page related to the video playback function. The video playback page can be the page where the video playback picture is located, or it can also be the video list page, and at least one entry for starting video playback is included in the video list page.

[0075] The current video playback page is the video playback page currently being displayed by the terminal. It can be understood that the current video playback page is a relatively changing concept. When the user enters the next video playback page from the current video playback page, the next video playback page becomes the latest "current video playback page".

[0076] Specifically, when playing a video, the terminal can display the page where the currently played video is located, that is, the current video playback page. Then, when the user needs to switch to the next video for playback, the terminal needs to improve the first-screen playback speed of the switched-to next video through subsequent processing. The terminal can also display the current video list page when about to play a video. Then, when the user swipes this page or is about to select a certain video from this page for playback, the terminal needs to improve the first-screen playback speed of this video through subsequent processing.

[0077] In a specific application scenario, an application program that supports video playback function is running on the terminal. After the terminal enters the application program according to the user's operation, video playback is started in the user interaction interface provided by the application program, and the terminal displays the current video playback page. Or, the terminal displays a video list page including the playback entry of each video.

[0078] In one embodiment, the video playback page may be a page for playing video pictures. Refer to Figure 3 , Figure 3 FIG. is a schematic diagram of a video playback page in an embodiment, where page 302 is the page for currently playing a video, and page 302 may be the current video playback page. It can be understood that when the user swipes from page 302 to page 306 by a downward swipe operation, the terminal displays page 306, and at this time page 306 becomes the current video playback page, and page 302 is no longer the current video playback page. When the user swipes from page 302 to page 304 by an upward swipe operation, the terminal displays page 304, and at this time page 304 becomes the current video playback page, and page 302 is no longer the current video playback page.

[0079] In other embodiments, the video playback page may also be a page for displaying videos to be played. Refer to Figure 4 , Figure 4 FIG. is a schematic diagram of a video playback page in another embodiment, where page 402 is the page for currently displaying videos to be played, and page 402 includes the playback entries of multiple videos. The user can start the playback of the corresponding video by clicking on a certain video entry. The current video playback page 402 includes the playback entry of video 404, the playback entry of video 406, the playback entry of video 408, the playback entry of video 410, the playback entry of video 412, and the playback entry of video 414. It can be understood that when the user swipes page 402 by a downward or upward swipe operation, the video entries displayed in page 402 will be updated, so that the content displayed in the current video playback page 402 is updated, and the current video playback page.

[0080] In one embodiment, the terminal displays the current video playback page in response to a user operation. The video playback page can be provided by the terminal. For example, the terminal displays the video playback page in response to a user operation. The video playback page can also be provided by a browser. For example, the terminal launches the installed browser in response to a user operation to enter the video playback page of the web video player. The video playback page can also be provided by a video playback client installed on the terminal. For example, the terminal launches the installed video playback client in response to a user operation to enter the video playback page of the video playback client. Among them, the video playback client is an application with video playback function, which can be an application that specifically provides video services, or an application that specifically provides other services and also provides video services, such as a social application, etc.

[0081] Step S204, determine at least one preloading video to be preloaded when staying on the video playback page.

[0082] Among them, the preloading video is the video to be preloaded. The video to be preloaded corresponds to the currently stayed video playback page. When the current video playback page changes, the preloading video to be preloaded will also change accordingly.

[0083] In one embodiment, the video to be preloaded is pushed by the video server to the terminal. Optionally, the video server can determine the videos to be pushed to the current user according to the playback popularity of the videos in the current video server and the user's preferences, and screen out the preloading videos from the videos to be pushed to the current user. For example, if the video server determines that there are multiple videos to be pushed to the current user and screens out one of them as the video that the user will browse when switching next time, then the previously browsed video of the currently played video by the user and the next video to be switched to are the preloading videos corresponding to the current video playback page.

[0084] In one embodiment, the video to be preloaded is the video corresponding to each video entry in the current video list page. When the user stays on the current page when sliding to the video list page, one or more of the video entries included in this page will be used as the preloading videos to be preloaded.

[0085] For example, continue to refer to Figure 3 , when the user stays on the current video playback page 302, the video played on the video playback page 304 is the previously browsed video of the video played on the current video playback page 302, and the video played on the video playback page 306 is the next video to be switched to from the current video playback page 302. The videos on the video playback page 304 and the video playback page 306 are both the preloading videos determined when staying on the current video playback page 302. Continue to refer to Figure 4, when the user stays on the current video playback page 402, the videos 404 to 414 corresponding to each video playback entry in this page are all playable, and the videos 404 to 414 can be preloaded videos.

[0086] Specifically, the terminal determines at least one preloaded video to be preloaded according to the currently stayed video playback page.

[0087] Generally, before a video is played, it is necessary to first pull the video stream from the video server. The video stream is transcoded and then transmitted to the stream-pulling terminal. The stream that has not started transcoding is called a cold stream, and the stream that has started transcoding is called a hot stream. When the terminal requests a video stream, if it encounters a cold stream, it will first request the video server to start transcoding, and then it can successfully receive the video stream; if it encounters a hot stream, it can directly receive the video stream. In order to reduce or eliminate the transcoding delay of the transcoding server, in the embodiments of the present application, after determining the preloaded video when the user switches the video and stays on the current video playback page, by performing subsequent processing on the preloaded video, the first-frame startup delay caused by switching video playback can be greatly reduced.

[0088] Step S206, based on the preloading bandwidth control policy, cache the first-screen video segments of each preloaded video locally.

[0089] Among them, the preloading bandwidth control policy is used to control the bandwidth occupied by preloading. Usually, when presenting the current video playback page, there may be a small amount of data requests in the video playback page, or a video is being played in the video playback page. In order to ensure the normal response of the video application, the terminal can adjust the bandwidth occupied by the preloading task through the preloading bandwidth control policy, so as to preload videos as much as possible to reduce the first-screen startup delay while being able to normally respond to video playback or data requests in this video playback page.

[0090] For example, when the video playback page is a page including multiple video playback entries, that is, the home page of the video application or the waterfall video stream scenario, the current page is in an idle state, no video is being played, and there may be a small amount of data requests. At this time, the terminal can use more network bandwidth for video preloading to obtain a preheated video stream, that is, cache the first-screen video segments of each preloaded video locally. When the video playback page is a page for playing a video, that is, in the scenario of switching video streams up and down, the terminal needs to first ensure the normal playback of the video in the current video playback page and allocate less network bandwidth for video preloading.

[0091] Among them, the first-screen video segment is the video data corresponding to the first video frame of the pre-loaded video. For example, it can be the video data from the 1st second to the 2nd second when the pre-loaded video starts playing. It should be noted that the first-screen video segment is a part of the pre-loaded video, rather than a video independent of the pre-loaded video, such as a video advertisement or a short video that exists independently of the video. The first-screen video segment of the pre-loaded video and the pre-loaded video correspond to the same loading address locally.

[0092] In one embodiment, the first-screen video segment is a video segment with a specified duration starting from the beginning of the pre-loaded video. For an online video, the first-screen video segment can be a video segment with a specified duration starting from the beginning of the online video, and its video content is fixed. No matter when the user watches the online video, the content of the first-screen video segment when the video starts playing remains unchanged. For a live video, the video content of the live video changes with time, and the beginning of the live video also changes with time. Therefore, the first-screen video segment cached locally needs to be updated at time intervals so that the first-screen video segment cached locally follows the progress of the corresponding live video. In this way, when the user intends to play the live video, the user can see the latest live content.

[0093] In one embodiment, the terminal determines the available bandwidth currently used for pre-loading based on the pre-loading bandwidth control policy, and caches the first-screen video segments of each pre-loaded video to the local according to the available bandwidth. For example, the terminal can control the bandwidth occupied by pre-loading within the available bandwidth range by adjusting the number of pre-loaded videos, the pre-loading speed, etc., to avoid excessive bandwidth occupation by pre-loading affecting the normal playback of the video.

[0094] In one embodiment, the terminal obtains the network environment bandwidth currently; determines the available bandwidth currently used for pre-loading according to the current network bandwidth and the video playback bitrate.

[0095] Among them, the network environment bandwidth is the actual bandwidth of the network environment where the terminal is located. The video playback bitrate is the bitrate at which the terminal plays the video. The bitrate reflects the size of the traffic that needs to be transmitted per second by the network channel. The traffic reflects the volume of the video. The bandwidth reflects the ability of the network channel to transmit traffic, such as the size of the traffic that can be transmitted per second.

[0096] In one embodiment, the terminal determines the pre-loading bandwidth multiple according to the current network bandwidth and the video playback bitrate; determines the available bandwidth currently used for pre-loading according to the pre-loading bandwidth multiple and the video playback bitrate.

[0097] In one embodiment, the terminal determines a preloading bandwidth magnification based on the size relationship between the current network bandwidth and the video playback bitrate. For example, when the current network bandwidth > 1.5 * video playback bitrate, the preloading bandwidth magnification can be set to 1.5; when 1.5 * video playback bitrate > the current network bandwidth > video playback bitrate, the preloading bandwidth magnification can be set to the ratio between the current network bandwidth and the video playback bitrate; when the current network bandwidth < video playback bitrate, it indicates that the current network bandwidth cannot even play one video, and no preloading is performed.

[0098] In one embodiment, the terminal calculates the available bandwidth currently used for preloading based on the preloading bandwidth magnification and the video playback bitrate. For example, the available bandwidth currently used for preloading = video playback bitrate * (preloading bandwidth magnification - 1). Suppose the video playback bitrate is 2000 kbps and the preloading bandwidth magnification is 1.5, then the available bandwidth currently used for preloading = 2000 kbps * 0.5 = 1000 kbps.

[0099] In this embodiment, determining the available bandwidth based on the current network bandwidth and the video playback bitrate, and then controlling the bandwidth occupied by preloading within the available bandwidth range can prevent preloading from occupying too much bandwidth and affecting the normal playback of the video.

[0100] In one embodiment, step S206 includes: determining the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determining the preloading speed according to the available bandwidth; and caching the first-screen video segments of each preloaded video to the local according to the preloading speed.

[0101] Among them, the preloading speed is the bandwidth for preloading a single preloaded video.

[0102] Specifically, the terminal determines the preloading speed according to the available bandwidth currently used for preloading and the number of preloaded videos, and caches the first-screen video segments of each preloaded video to the local according to the preloading speed. For example, the preloading speed = the available bandwidth currently used for preloading / the number of preloaded videos. Suppose the available bandwidth currently used for preloading is 1000 kbps and the number of preloaded videos is 5, then the preloading speed = 1000 kbps / 5 = 200 kbps.

[0103] In one embodiment, step S206 includes: determining the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determining the number of preloaded videos according to the available bandwidth; selecting target videos from each preloaded video according to the number of videos; and caching the first-screen video segments of each target video to the local.

[0104] Specifically, if the available bandwidth currently used for preloading does not support caching the first-screen video segments of all preloaded videos, the terminal determines the number of videos to be preloaded according to the available bandwidth, selects target videos from the preloaded videos according to the number of videos, and caches the first-screen video segments of each target video locally.

[0105] In one embodiment, the terminal determines the preloading speed according to the available bandwidth currently used for preloading and the number of preloaded videos. If the preloading speed is less than the preset speed, it is determined that the available bandwidth currently used for preloading does not support caching the first-screen video segments of all preloaded videos, and the number of videos to be preloaded needs to be reduced. Optionally, the terminal determines the number of videos to be preloaded according to the available bandwidth currently used for preloading and the preset speed. The preset speed can be set according to actual applications.

[0106] In one embodiment, the terminal determines the preloading duration according to the available bandwidth currently used for preloading and the number of preloaded videos. The preloading duration is the duration of preloading a single preloaded video. If the preloading duration is greater than or equal to the preset duration, it is determined that the available bandwidth currently used for preloading does not support caching the first-screen video segments of all preloaded videos, and the number of videos to be preloaded needs to be reduced. Optionally, the terminal determines the number of videos to be preloaded according to the available bandwidth currently used for preloading and the preset duration. The preset duration can be set according to actual applications.

[0107] In one embodiment, the terminal determines the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determines the preloading speed according to the available bandwidth and the number of preloaded videos; determines the single-task loading traffic of each preloaded video according to the duration of the first-screen video segment of the preloaded video; and obtains the preloading duration according to the single-task loading traffic and the preloading speed. The single-task loading traffic is the traffic for preloading a single preloaded video. The caching duration of the local first-screen video segment is the duration of caching the first-screen video segment in the terminal. For example, preloading duration = single-task loading traffic / preloading speed, and single-task loading traffic = caching duration of local first-screen video segment * single-task loading video bit rate.

[0108] In one embodiment, the terminal may select a preloaded video from the videos that can be preloaded according to a priority policy. The priority policy is used to sort the priority levels of each video. The factors affecting the sorting may include the click-through rate, play popularity, interaction situation, and user preferences of the video. The interaction situation may include, for example, the number of comments, likes, and shares. That is to say, the videos with higher popularity, higher recommendation index, and better match with the user will be preferentially selected for preloading. For example, in the scenario of a waterfall video stream, the current page includes play entry points for multiple videos. When the network bandwidth is sufficient, the terminal may preload all the videos on this page. When the network bandwidth is insufficient, the terminal may screen the videos on this page according to the priority policy and use the screened videos as the preloaded videos. Another example is in the scenario of switching between upper and lower videos. Optionally, the terminal may sort each video based on the historical click-through rate, historical play popularity, historical interaction situation, and user characteristics of each video on the current page, so as to determine the next video to be switched to by the user, that is, the preloaded video that needs to be preloaded in advance.

[0109] In this embodiment, based on the preloading bandwidth control policy, the first-screen video segment of each preloaded video is cached locally, which can control the bandwidth occupied by preloading within the available bandwidth range and avoid excessive bandwidth occupation by preloading from affecting the normal playback of the video.

[0110] In one embodiment, the video playback page may be a live video playback page, and the preloaded video may be a preloaded live video. In some other embodiments, the video playback page may be an online video playback page, and the preloaded video may be a preloaded online video.

[0111] In the embodiments of the present application, in order to reduce the first-frame startup delay, for the preloaded video, after the first-screen video segment is loaded, the terminal will cache the loaded first-screen video segment locally, that is, perform chain switching on the preheated video stream. Compared with directly pulling the stream from the video server for playback after preheating, it can achieve an experience close to local playback and can reach a first-frame rendering speed at the millisecond level.

[0112] Step S208, determine the target preloaded video requested by the trigger operation in the video playback page.

[0113] Among them, the target preloaded video is any one of the preloaded videos and is the video to be switched to from the current video playback page. The trigger operation is an operation to switch the video, and the trigger operation may be a click operation, a double-click operation, a swipe-up operation, a swipe-down operation, etc. Continue to refer to Figure 3 , Figure 3The video playback page shown belongs to the form of video switching between upper and lower rooms. Users can switch video playback through operations such as pulling down or swiping up. When the user swipes up, the video in video playback page 304 will be switched for playback. When the user pulls down, the video in video playback page 306 will be switched for playback. Continue to refer to Figure 4 , Figure 4 The video playback page shown belongs to the form of waterfall video stream. Users can select a target preloaded video from the preloaded videos on this page for playback through operations such as clicking.

[0114] In one embodiment, the terminal obtains the target preloaded video requested to be played by the trigger operation in response to the trigger operation in the video playback page.

[0115] Step S210, obtain the first-screen video segment corresponding to the target preloaded video from local.

[0116] In one embodiment, after step S206, the method further includes: allocating local link addresses for each preloaded video; step S210 includes: determining the target local link address corresponding to the target preloaded video; obtaining the first-screen video segment of the target preloaded video from local according to the target local link address.

[0117] Among them, the local link address is the jump address of local resources. The local link address can be a Uniform Resource Identifier (URI), etc.

[0118] In one embodiment, the terminal caches the first-screen video segments of each preloaded video to local according to the network link addresses of each preloaded video, and allocates local link addresses for each preloaded video; when obtaining the target preloaded video requested to be played by the trigger operation, determine the target local link address corresponding to the target preloaded video, and obtain the first-screen video segment of the target preloaded video from local according to the target local link address.

[0119] Step S212, start playing the target preloaded video from the first-screen video segment.

[0120] In one embodiment, step S212 includes: playing the first-screen video segment corresponding to the target preloaded video obtained from local; during the process of playing the first-screen video segment, pulling the remaining video segments corresponding to the target preloaded video from the video server; after the first-screen video segment finishes playing, continue to play the target preloaded video according to the remaining video segments.

[0121] Among them, the remaining video segments can be the video segments of the preloaded video other than the first-screen video segment.

[0122] In one embodiment, the first-screen video segment is a video segment with a specified duration starting from the beginning of the pre-loaded video, and the remaining video segments are the video segments following the first-screen video segment. For example, the first-screen video segment is the video segment from the 1st second to the 4th second of the pre-loaded online video, and the remaining video segments can be the video segments from the 5th second to the end of the pre-loaded online video.

[0123] In one embodiment, during the playback of the first-screen video segment, the remaining video segments corresponding to the target pre-loaded video are pulled from the video server, including: requesting the remaining video segments corresponding to the target pre-loaded video from the video server according to the timestamp corresponding to the last frame of the first-screen video segment cached locally; receiving the remaining video segments sent by the video server.

[0124] In one embodiment, each frame of the video picture cached locally corresponds to a timestamp, and the timestamp can be used to describe the playback time of the video picture.

[0125] In one embodiment, the terminal generates a video segment pull request according to the timestamp corresponding to the last frame of the first-screen video segment of the target pre-loaded video cached locally, and requests the remaining video segments corresponding to the target pre-loaded video from the video server according to the video segment pull request; the video server sends the remaining video segments corresponding to the target pre-loaded video to the terminal according to the timestamp in the video segment pull request, and the timestamp corresponding to the first frame of the remaining video segments is continuous with the timestamp corresponding to the last frame of the first-screen video segment.

[0126] In this embodiment, pulling the remaining video segments according to the timestamp corresponding to the last frame of the first-screen video segment of the target pre-loaded video cached locally realizes the accurate video streaming of the video server and ensures the seamless connection and playback between the first-screen video segment and the remaining video segments.

[0127] In one embodiment, the terminal plays the first-screen video segment of the target pre-loaded video cached locally. During the playback of the first-screen video segment, the remaining video segments corresponding to the target pre-loaded video are pulled from the video server and cached locally. After the first-screen video segment is played, the remaining video segments obtained locally are played.

[0128] In one embodiment, the terminal pulls the remaining video segments corresponding to the target pre-loaded video from the video server and caches them locally. After the first-screen video segment is played, the remaining video segments are obtained from the local according to the target local link address corresponding to the target pre-loaded video and played.

[0129] In this embodiment, during the playback of the first-screen video segment, the remaining video segments of the target pre-loaded video are pulled from the video server. Since the process of playing the first-screen video segment does not occupy the network bandwidth, sufficient bandwidth is reserved for pulling the remaining video segments; and the process of playing the first-screen video segment also reserves sufficient time for pulling the remaining video segments, which is sufficient to handle situations such as the transcoding delay of the server and the transmission delay between the server and the terminal. In this way, the smooth playback of the entire target pre-loaded video is ensured.

[0130] In one embodiment, after a trigger operation in the video playback page is obtained, the method further includes: when the local caching of the first-screen video segment of the target pre-loaded video requested by the trigger operation is not completed, or the update of the first-screen video segment of the target pre-loaded video is not completed, directly request the target pre-loaded video from the video server and then play it.

[0131] In one embodiment, when the local caching of the first-screen video segment of the target pre-loaded video requested by the trigger operation is not completed, directly request the target pre-loaded video from the video server and then play it.

[0132] In one embodiment, for a live video, when the local update of the first-screen video segment of the target pre-loaded video is not completed, directly request the target pre-loaded video from the video server and then play it.

[0133] It is found through experiments that by using the method provided in the embodiments of the present application, the first-frame loading time in the form of upper and lower rooms can be controlled within 200 milliseconds, and the first-frame loading time in the form of waterfall flow can be controlled at about 200 milliseconds, both reaching the leading level in the industry, bringing a fast and stable playback experience to users.

[0134] In the above video playback method, based on the pre-loading bandwidth control strategy, the first-screen video segments of each pre-loaded video are cached locally, and the bandwidth occupied by pre-loading can be controlled within the available bandwidth range, avoiding excessive bandwidth occupation by pre-loading and affecting the normal playback of the video; when the target pre-loaded video requested by the trigger operation in the video playback page is determined, the first-screen video segment corresponding to the target pre-loaded video is obtained from the local, and the target pre-loaded video is played starting from the first-screen video segment. Since the locally cached video segment is played first, the transcoding delay of the server, the transmission delay between the server and the terminal, etc. are avoided, and the first-frame playback speed during video playback is improved.

[0135] The method provided by this application can be applied to the scenario of playing live videos. For live videos, the video content of the live video changes over time, and the beginning of the live video also changes over time. Therefore, the first-screen video segment cached locally needs to be updated at time intervals so that the first-screen video segment cached locally follows the progress of the corresponding live video. The following introduces the update steps of the first-screen video segment of the live video.

[0136] In one embodiment, the video playback page is a live video playback page, and the pre-loaded video is a pre-loaded live video; before obtaining the trigger operation in the video playback page, the method further includes: determining the time interval for updating the local cache; after pulling the latest first-screen video segments of each pre-loaded live video according to the time interval, updating the first-screen video segments of each pre-loaded live video in the local cache.

[0137] Wherein, the time interval is the time interval for updating the first-screen video segment of the pre-loaded live video in the local cache.

[0138] In one embodiment, the terminal determines the time interval for updating the local cache, pulls the latest first-screen video segments of each pre-loaded live video from the video server according to the time interval, and updates the first-screen video segments of each pre-loaded live video in the local cache according to the latest first-screen video segments.

[0139] In one embodiment, the terminal determines the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determines the time interval for updating the local cache according to the available bandwidth.

[0140] In one embodiment, determining the time interval for updating the local cache includes: determining the available bandwidth currently used for preloading based on the preloading bandwidth control policy; determining the single-task loading bandwidth according to the available bandwidth and the number of pre-loaded live videos; determining the single-task loading traffic of each pre-loaded live video according to the duration of the first-screen video segment of the pre-loaded live video; obtaining the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic; using the single-task loading duration as the time interval for updating the local cache.

[0141] Wherein, the single-task loading bandwidth is the bandwidth for preloading a single pre-loaded live video. The single-task loading traffic is the traffic for preloading a single pre-loaded live video. The single-task loading duration is the duration for preloading a single pre-loaded live video. The duration of the first-screen video segment of the pre-loaded live video is the duration for caching the first-screen video segment in the terminal.

[0142] In one embodiment, the terminal determines the single-task loading bandwidth according to the available bandwidth and the number of pre-loaded live videos. For example, single-task loading bandwidth = available bandwidth / number of pre-loaded live videos. Suppose the available bandwidth is 1000 kbps and the number of pre-loaded live videos is 5, then the single-task loading bandwidth = 1000 kbps / 5 = 200 kbps.

[0143] In one embodiment, the terminal determines the single-task loading traffic of each pre-loaded live video according to the duration of the first-screen video segment of the pre-loaded live video. For example, single-task loading traffic = duration of the first-screen video segment of the pre-loaded live video * bitrate of the pre-loaded live video. Suppose the duration of the first-screen video segment of the pre-loaded live video is 2 seconds and the bitrate of the pre-loaded live video is 800 kbps, then the single-task loading traffic = 2 s * 800 kbps = 1600 kbps.

[0144] In one embodiment, the terminal obtains the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic. For example, single-task loading duration = single-task loading traffic / single-task loading bandwidth. Suppose the single-task loading bandwidth is 200 kbps and the single-task loading traffic is 1600 kbps, then the single-task loading duration = 1600 kbps / 200 kbps = 8 s.

[0145] In one embodiment, the terminal uses the single-task loading duration as the time interval for updating the local cache, which can ensure that all pre-loading tasks in this pre-loading can be completed.

[0146] In this embodiment, the time interval for updating the local cache is determined according to the currently available bandwidth for pre-loading, preventing situations such as large network fluctuations and excessive traffic occupation when updating the local cache; and, the first-screen video segments of each pre-loaded live video in the local cache are updated according to the time interval, so that the first-screen video segments in the local cache follow the progress of the corresponding live videos.

[0147] In one embodiment, after pulling the latest first-screen video segments of each pre-loaded live video at the time interval and before updating the first-screen video segments of each pre-loaded live video in the local cache, the method further includes: determining whether the time interval for updating the local cache meets the live video frame chasing condition; when the time interval meets the live video frame chasing condition, performing the step of updating the first-screen video segments of each pre-loaded live video in the local cache.

[0148] Among them, frame chasing means that the first-screen video segment cached locally and the remaining video segments pulled from the video server should be continuous in terms of playback time. For the consideration of saving memory, the video server sets a buffer duration for preloading live videos, that is, the buffer duration of the transcoded video stream, and the local device sets a buffer duration for the first-screen video segment. If the time interval for updating the local cache is too long, it may not be possible to ensure that the first-screen video segment cached locally and the remaining video segments pulled from the video server are continuous in terms of playback time. Therefore, it is necessary to determine whether the time interval meets the live frame-chasing condition.

[0149] Illustrated by way of example, refer to Figure 5 , Figure 5 which is a schematic diagram of live frame chasing in an embodiment. Assume that the buffer duration of the video server is 10 seconds and the buffer duration of the terminal is 1 second. When the transcoded video stream of the video server reaches the 12th second, the transcoded video streams of the 1st second and the 2nd second will be cleared. If the user watches the preloaded live video at this time, the terminal plays the 1st second live segment of the preloaded live video obtained locally, and pulls the 3rd second to the 12th second live segments of the preloaded live video from the video server. The user cannot watch the 2nd second live segment of the preloaded live video.

[0150] In one embodiment, the method further includes: when the time interval does not meet the live frame-chasing condition, adjusting the number of preloaded live videos; re-determining the time interval for updating the local cache according to the adjusted number of preloaded live videos until the time interval meets the live frame-chasing condition.

[0151] In one embodiment, when the time interval for updating the local cache does not meet the live frame-chasing condition, the number of preloaded live videos can be reduced to reduce the time interval for updating the local cache until the time interval determined according to the number of preloaded live videos meets the live frame-chasing condition.

[0152] In one embodiment, the method further includes: obtaining the buffer duration of the live video of the video server and the buffer duration of the local first-screen video segment; when the time interval for updating the local cache is less than or equal to the sum of the buffer duration and the buffer duration, determining that the time interval meets the live frame-chasing condition; when the time interval for updating the local cache is greater than the sum of the buffer duration and the buffer duration, determining that the time interval does not meet the live frame-chasing condition.

[0153] Illustrated by way of example, continue to refer to Figure 5, assume that the buffer duration of the video server is 10 seconds and the cache duration of the terminal is 1 second, and the sum of the two is 11 seconds. When the transcoded video stream of the video server reaches the 11th second, the transcoded video stream at the 1st second will be cleared, and the transcoded video stream at the 2nd second will not be cleared. That is to say, the 11th second is the last opportunity for the terminal to pull the transcoded video stream at the 2nd second from the video server. When the time interval for updating the local cache is less than or equal to 11 seconds, this time interval meets the live video frame chasing condition. When the time interval for updating the local cache is greater than 11 seconds, this time interval cannot meet the live video frame chasing condition.

[0154] In this embodiment, the time interval for updating the local cache needs to meet the live video frame chasing condition, ensuring seamless connection and playback between the first-screen video segment of the local cache and the remaining video segments pulled from the video server.

[0155] Each step in this application can be implemented by a Software Development Kit (SDK) installed in the terminal. This software development kit can be embedded in the video playback client or independent of the video playback client. This software development kit can be applied to live video playback scenarios, online video playback scenarios, etc. This software development kit can be extended for different bitrates, meet multiple transcoding protocols, and has a wide range of applications.

[0156] Refer to Figure 6 , Figure 6 is a functional schematic diagram of the software development kit in an embodiment. This software development kit can be used to provide task management services, local transcoding services, cache management services, etc. Among them, the task management service can include task queue management service, function control service, video frame chasing service, cache update service, etc.

[0157] Among them, the task queue management service can be used to determine the preloaded videos to be preloaded. For example, based on the preloading bandwidth control policy, determine the available bandwidth currently used for preloading, determine the number of videos to be preloaded according to the available bandwidth, and select target videos from the preloaded videos according to the number of videos, so as to cache the first-screen video segments of each target video locally. For another example, refer to Figure 7 , Figure 7 is a schematic diagram of the task queue management service in an embodiment. Taking the video playback page in the form of a waterfall flow as an example, add the preloaded videos when staying on the video playback page to the preloading queue, add the preloaded videos of the video playback page swiped by the user to the elimination queue, and pause the preloading of the preloaded videos in the elimination queue. If the user has a backward operation, update the preloaded videos in the preloading queue and the elimination queue in a timely manner. And the task queue management service can adjust the preloading tasks in the preloading queue in a timely manner according to the occupancy of the terminal processor and memory to control the memory occupied by the preloading.

[0158] Among them, the function control service can be used to configure parameters, such as the number of pre-loaded videos, the caching duration of the local first-screen video segment, etc. The video frame chasing service can be used to request the remaining video segments corresponding to the target pre-loaded video from the video server according to the timestamp corresponding to the end frame of the first-screen video segment corresponding to the target pre-loaded video cached locally, so as to ensure seamless connection and playback between the first-screen video segment and the remaining video segments. The cache update service can be used to determine the time interval for updating the local cache. After pulling the latest first-screen video segments of each pre-loaded live video at the time interval, update the first-screen video segments of each pre-loaded live video in the local cache. The task queue management service may also include an event callback service, etc. The event callback service can be used for player event notification, data reporting, etc. The local transcoding service can be used to cache the first-screen video segments of each pre-loaded video locally according to the network link address of each pre-loaded video, and assign a local link address to each pre-loaded video through the local transcoding service. The cache management service can be used to store the first-screen video segments of each pre-loaded video.

[0159] Specifically, the terminal determines at least one pre-loaded video to be pre-loaded when staying on the video playback page based on the task queue management service, and obtains the network link address of each pre-loaded video; based on the local transcoding service, according to the network link address and the pre-loading bandwidth control policy, caches the first-screen video segments of each pre-loaded video locally and assigns a local link address to each pre-loaded video; based on the cache update service, according to the pre-loading bandwidth control policy, determines the time interval for updating the local cache. After pulling the latest first-screen video segments of each pre-loaded video at the time interval, updates the first-screen video segments of each pre-loaded video in the local cache; based on the local transcoding service, determines the target local link address corresponding to the target pre-loaded video, and obtains the first-screen video segment of the target pre-loaded video from the local according to the target local link address; based on the video frame chasing service, requests the remaining video segments corresponding to the target pre-loaded video from the video server according to the timestamp corresponding to the end frame of the first-screen video segment corresponding to the target pre-loaded video cached locally.

[0160] In one embodiment, the method provided in the embodiments of the present application can be applied to the playback scenario of live videos. As Figure 8 shown, a method for playing a video is provided. In this embodiment, it is mainly illustrated by taking this method applied to the terminal 106 in the above Figure 1 as an example, including the following steps:

[0161] Step S802, display the current live video playback page, and determine at least one pre-loaded live video to be pre-loaded when staying on the live video playback page.

[0162] Step S804: Based on the preloading bandwidth control policy, cache the first-screen video segments of each preloaded live video locally and assign local link addresses to each preloaded live video.

[0163] Step S806: Based on the preloading bandwidth control policy, determine the available bandwidth currently used for preloading. Determine the single-task loading bandwidth according to the available bandwidth and the number of preloaded live videos. Determine the single-task loading traffic for each preloaded live video according to the duration of the first-screen video segment of the preloaded live video. Obtain the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic, and use the single-task loading duration as the time interval for updating the local cache.

[0164] Step S808: Determine whether the time interval for updating the local cache meets the live video frame chasing condition. When the time interval meets the live video frame chasing condition, update the first-screen video segments of each preloaded live video in the local cache according to the time interval. When the time interval does not meet the live video frame chasing condition, adjust the number of preloaded live videos, and re-determine the time interval for updating the local cache according to the adjusted number of preloaded live videos until the time interval meets the live video frame chasing condition.

[0165] Among them, obtain the buffering duration of the live video on the video server and the caching duration of the local first-screen video segment. When the time interval for updating the local cache is less than or equal to the sum of the buffering duration and the caching duration, determine that the time interval meets the live video frame chasing condition. When the time interval for updating the local cache is greater than the sum of the buffering duration and the caching duration, determine that the time interval does not meet the live video frame chasing condition.

[0166] Step S810: Determine the target preloaded live video requested by the trigger operation in the live video playing page.

[0167] Step S812: Determine the target local link address corresponding to the target preloaded live video, and obtain the first-screen video segment of the target preloaded live video from the local according to the target local link address.

[0168] Step S814: Play the first-screen video segment corresponding to the target preloaded live video obtained from the local. According to the timestamp corresponding to the last frame of the first-screen video segment of the target preloaded live video cached locally, request the remaining video segments corresponding to the target preloaded live video from the video server, receive the remaining video segments sent by the video server, and continue to play the target preloaded live video according to the remaining video segments after the first-screen video segment finishes playing.

[0169] The above video playing method caches the first-screen video segments of each pre-loaded live video locally based on a pre-loading bandwidth control strategy, which can control the bandwidth occupied by pre-loading within the available bandwidth range, avoiding excessive bandwidth occupation by pre-loading and affecting the normal playback of the video. The first-screen video segments of each pre-loaded live video cached locally are updated at time intervals, so that the first-screen video segments cached locally follow the progress of the corresponding live video, and the time intervals used to update the local cache need to meet the live video frame chasing conditions, ensuring seamless connection and playback between the first-screen video segments cached locally and the remaining video segments pulled from the video server. When determining the target pre-loaded live video requested by the trigger operation in the video playback page, the first-screen video segment corresponding to the target pre-loaded live video is obtained from local, and the target pre-loaded live video is played starting from the first-screen video segment. Since the video segments cached locally are played first, it avoids transcoding delays of the server, transmission delays between the server and the terminal, etc., and improves the first-frame playback speed during live video playback.

[0170] In one embodiment, the method provided by the embodiments of the present application can be applied to the playback scenario of online videos. As Figure 9 shown, a video playing method is provided. In this embodiment, it is mainly exemplified by applying this method to the terminal 106 in the above Figure 1 and includes the following steps:

[0171] Step S902: Display the current online video playback page and determine at least one pre-loaded online video to be pre-loaded when staying on the online video playback page.

[0172] Step S904: Based on the pre-loading bandwidth control strategy, cache the first-screen video segments of each pre-loaded online video locally and assign local link addresses to each pre-loaded online video.

[0173] Step S906: Determine the target pre-loaded online video requested by the trigger operation in the video playback page.

[0174] Step S908: Determine the target local link address corresponding to the target pre-loaded online video, and obtain the first-screen video segment of the target pre-loaded online video from local according to the target local link address.

[0175] Step S910: Play the first-screen video segment corresponding to the target pre-loaded online video obtained from local, request the remaining video segments corresponding to the target pre-loaded online video from the video server according to the timestamp corresponding to the last frame of the first-screen video segment of the target pre-loaded online video cached locally, receive the remaining video segments sent by the video server, and continue to play the target pre-loaded online video according to the remaining video segments after the first-screen video segment finishes playing.

[0176] The above video playing method caches the first-screen video segments of each pre-loaded online video locally based on a pre-loading bandwidth control strategy, and can control the bandwidth occupied by pre-loading within the available bandwidth range, avoiding excessive bandwidth occupation by pre-loading and affecting the normal playing of the video. When determining the target pre-loaded online video requested by a trigger operation in the video playing page, the first-screen video segment corresponding to the target pre-loaded online video is obtained from the local, and the target pre-loaded online video is played starting from the first-screen video segment. Since the locally cached video segment is played first, it avoids transcoding delays of the server, transmission delays between the server and the terminal, etc., and improves the first-frame playing speed during online video playing.

[0177] It should be understood that although Figure 2 , 8 each step in the flowchart of Figure 2 -9 is shown in sequence according to the indication of the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise clearly stated in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, 8 at least a part of the steps in

[0178] -9 may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps. Figure 10 As shown in

[0179] In one embodiment, there is provided a video playing device. This device can be a software module, a hardware module, or a combination of both to become a part of a computer device. Specifically, the device includes: a display module 1002, a pre-loaded video determination module 1004, a caching module 1006, a target pre-loaded video determination module 1008, an acquisition module 1010, and a playing module 1012, where:

[0180] The display module 1002 is used to display the current video playing page;

[0181] The pre-loaded video determination module 1004 is used to determine at least one pre-loaded video to be pre-loaded when staying on the video playing page;

[0182] The caching module 1006 is used to cache the first-screen video segments of each pre-loaded video locally based on a pre-loading bandwidth control strategy;

[0183] An acquisition module 1010, configured to acquire a first-screen video segment corresponding to a target pre-loaded video from a local device.

[0184] A playback module 1012, configured to start playing the target pre-loaded video from the first-screen video segment.

[0185] In one embodiment, the cache module 1006 is further configured to: determine the available bandwidth currently used for preloading based on a preloading bandwidth control policy; determine the number of videos to be preloaded according to the available bandwidth; select target videos from the pre-loaded videos according to the number of videos; and cache the first-screen video segments of the target videos to the local device.

[0186] In one embodiment, the cache module 1006 is further configured to: determine the available bandwidth currently used for preloading based on a preloading bandwidth control policy; determine the preloading speed according to the available bandwidth; and cache the first-screen video segments of the pre-loaded videos to the local device according to the preloading speed.

[0187] In one embodiment, the video playback page is a live video playback page, and the pre-loaded video is a pre-loaded live video; the video playback device further includes an update module, and the update module is configured to: determine the time interval for updating the local cache; and after pulling the latest first-screen video segments of the pre-loaded live videos at the time interval, update the first-screen video segments of the pre-loaded live videos in the local cache.

[0188] In one embodiment, the update module is further configured to: determine the available bandwidth currently used for preloading based on a preloading bandwidth control policy; determine the single-task loading bandwidth according to the available bandwidth and the number of pre-loaded live videos; determine the single-task loading traffic for each pre-loaded live video according to the duration of the first-screen video segment of the pre-loaded live video; obtain the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic; and use the single-task loading duration as the time interval for updating the local cache.

[0189] In one embodiment, the update module is further configured to: determine whether the time interval for updating the local cache meets the live video frame chasing condition; and when the time interval meets the live video frame chasing condition, perform the step of updating the first-screen video segments of the pre-loaded live videos in the local cache.

[0190] In one embodiment, the update module is further configured to: when the time interval does not meet the live video frame chasing condition, adjust the number of pre-loaded live videos; and re-determine the time interval for updating the local cache according to the adjusted number of pre-loaded live videos until the time interval meets the live video frame chasing condition.

[0191] In one embodiment, the update module is further configured to: obtain the buffer duration of the live video of the video server and the cache duration of the local first-screen video segment; when the time interval for updating the local cache is less than or equal to the sum of the buffer duration and the cache duration, determine that the time interval meets the live frame-by-frame chasing condition; when the time interval for updating the local cache is greater than the sum of the buffer duration and the cache duration, determine that the time interval does not meet the live frame-by-frame chasing condition.

[0192] In one embodiment, the video playing device further includes an allocation module, and the allocation module is configured to: allocate local link addresses for each pre-loaded video; the obtaining module 1010 is further configured to: determine the target local link address corresponding to the target pre-loaded video; obtain the first-screen video segment of the target pre-loaded video from the local according to the target local link address.

[0193] In one embodiment, the playing module 1012 is further configured to: play the first-screen video segment of the target pre-loaded video obtained from the local; during the process of playing the first-screen video segment, pull the remaining video segments of the target pre-loaded video from the video server; after the first-screen video segment is played, continue to play the target pre-loaded video according to the remaining video segments.

[0194] In one embodiment, the playing module 1012 is further configured to: request the remaining video segments of the target pre-loaded video from the video server according to the time stamp corresponding to the last frame of the first-screen video segment of the target pre-loaded video cached locally; receive the remaining video segments sent by the video server.

[0195] In one embodiment, the video playing device further includes a request module, and the request module is configured to: when the local has not completed caching the first-screen video segment of the target pre-loaded video requested by the trigger operation, or has not completed updating the first-screen video segment of the target pre-loaded video, directly request the target pre-loaded video from the video server and then play it.

[0196] For the specific limitations of the video playing device, reference may be made to the limitations of the video playing method in the foregoing text, which will not be elaborated here. Each module in the above video playing device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0197] In the video playing device described above, when the current video playing page is being displayed, at least one pre-loaded video to be pre-loaded is determined in advance, and based on the pre-loading bandwidth control strategy, the first-screen video segments of each pre-loaded video are cached locally. On the one hand, the first-screen video segments of the pre-loaded videos are cached based on the pre-loading bandwidth control strategy, which can control the bandwidth occupied by pre-loading within the available bandwidth range, avoid excessive bandwidth occupation by pre-loading affecting the normal playing of the video in the current video playing page, and the pre-loading bandwidth control strategy enables the caching process to proceed orderly and smoothly, without occupying too much memory resources or causing device operation lag, thus improving the video startup playing rate. On the other hand, by caching the first-screen video segments of the pre-loaded videos locally first, when a trigger operation to switch to playing the target pre-loaded video is obtained, the first-screen video segment corresponding to the target pre-loaded video can be directly obtained from the local, and the target pre-loaded video is played starting from the first-screen video segment. Since the locally cached video segment is played first, there is no need to pull the first-screen video segment of the target video from the video server, avoiding transcoding delay of the video server, transmission delay between the server and the terminal, etc., thereby improving the speed of starting video playing.

[0198] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 11 shown. The computer device includes a processor, a memory, a communication interface, and an image acquisition device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a carrier network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a video playing method.

[0199] Those skilled in the art can understand that Figure 11 the structure shown in

[0200] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0201] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which when executed by a processor implements the steps in the above method embodiments.

[0202] In one embodiment, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the above method embodiments.

[0203] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0204] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0205] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A method for playing a video, characterized in that, The method includes: Displaying the current live video playback page; Determining at least one preloading live video to be preloaded when staying on the live video playback page; Caching the first-screen video segments of each of the preloading live videos to the local based on the preloading bandwidth control policy; Determining the time interval for updating the local cache; When the time interval for updating the local cache meets the live video frame chasing condition, pulling the latest first-screen video segments of each of the preloading live videos according to the time interval, and then updating the first-screen video segments of each of the preloading live videos in the local cache; When the time interval for updating the local cache does not meet the live video frame chasing condition, adjusting the number of the preloading live videos, re-determining the time interval that meets the live video frame chasing condition according to the adjusted number of the preloading live videos, pulling the latest first-screen video segments of each of the preloading live videos according to the time interval, and then updating the first-screen video segments of each of the preloading live videos in the local cache; Determining the target preloading live video requested by the trigger operation in the live video playback page; Obtaining the first-screen video segment corresponding to the target preloading live video from the local; Playing the target preloading live video starting from the first-screen video segment.

2. The method according to claim 1, characterized in that, The caching the first-screen video segments of each of the preloading live videos to the local based on the preloading bandwidth control policy includes: Based on the preloading bandwidth control policy, determining the available bandwidth currently used for preloading; Determining the number of videos to be preloaded according to the available bandwidth; Selecting target videos from each of the preloading live videos according to the number of videos; Caching the first-screen video segments of each of the target videos to the local.

3. The method according to claim 1, wherein The caching the first-screen video segments of each of the preloading live videos to the local based on the preloading bandwidth control policy includes: Based on the preloading bandwidth control policy, determining the available bandwidth currently used for preloading; Determining the preloading speed according to the available bandwidth; Caching the first-screen video segments of each of the preloading live videos to the local according to the preloading speed.

4. The method according to claim 1, wherein The determining the time interval for updating the local cache includes: Based on the preloading bandwidth control policy, determining the available bandwidth currently used for preloading; Determining the single-task loading bandwidth according to the available bandwidth and the number of the preloading live videos; Determining the single-task loading traffic of each of the preloading live videos according to the duration of the first-screen video segment of the preloading live video; Obtaining the single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic; Taking the single-task loading duration as the time interval for updating the local cache.

5. The method according to claim 1, characterized in that The method further includes: Obtaining the buffering duration of the live video of the video server and the caching duration of the local first-screen video segment; When the time interval for updating the local cache is less than or equal to the sum of the buffering duration and the caching duration, determining that the time interval meets the live video frame chasing condition; When the time interval for updating the local cache is greater than the sum of the buffering duration and the caching duration, it is determined that the time interval does not meet the live video frame chasing condition.

6. The method according to claim 1, characterized in that, After caching the first-screen video segments of each of the pre-loaded live videos locally, the method further includes: Allocating local link addresses to each of the pre-loaded live videos; The obtaining the first-screen video segment corresponding to the target pre-loaded live video from local includes: Determining the target local link address corresponding to the target pre-loaded live video; Obtaining the first-screen video segment of the target pre-loaded live video from local according to the target local link address.

7. The method according to claim 1, characterized in that, The playing the target pre-loaded live video starting from the first-screen video segment includes: Playing the first-screen video segment of the target pre-loaded live video obtained from local; During the playing of the first-screen video segment, pulling the remaining video segments corresponding to the target pre-loaded live video from the video server; After the playing of the first-screen video segment ends, continuing to play the target pre-loaded live video according to the remaining video segments.

8. The method according to claim 7, wherein The pulling the remaining video segments corresponding to the target pre-loaded live video from the video server during the playing of the first-screen video segment includes: Requesting the remaining video segments corresponding to the target pre-loaded live video from the video server according to the timestamp corresponding to the last frame of the first-screen video segment of the target pre-loaded live video cached locally; Receiving the remaining video segments sent by the video server.

9. The method according to any one of claims 1 to 8, characterized in that, After obtaining the trigger operation in the live video playing page, the method further includes: When the local has not completed caching the first-screen video segment of the target pre-loaded live video requested by the trigger operation, or has not completed updating the first-screen video segment of the target pre-loaded live video, directly requesting the target pre-loaded live video from the video server and then playing it.

10. A video playback device, characterized in that, The device includes: A display module, configured to display the current live video playing page; A pre-loaded video determination module, configured to determine at least one pre-loaded live video to be pre-loaded when staying on the live video playing page; A caching module, configured to cache the first-screen video segments of each of the pre-loaded live videos locally based on a pre-loading bandwidth control policy; An update module, configured to determine the time interval for updating the local cache; when the time interval for updating the local cache meets the live video frame chasing condition, pulling the latest first-screen video segments of each of the pre-loaded live videos according to the time interval, and then updating the first-screen video segments of each of the pre-loaded live videos in the local cache; when the time interval for updating the local cache does not meet the live video frame chasing condition, adjusting the number of the pre-loaded live videos, re-determining the time interval that meets the live video frame chasing condition according to the adjusted number of the pre-loaded live videos, pulling the latest first-screen video segments of each of the pre-loaded live videos according to the time interval, and then updating the first-screen video segments of each of the pre-loaded live videos in the local cache; A target preloading video determination module, configured to determine a target preloading live video requested by a trigger operation in the live video playing page; An obtaining module, configured to obtain a first-screen video segment corresponding to the target preloading live video from local; A playing module, configured to start playing the target preloading live video from the first-screen video segment.

11. The device according to claim 10, characterized in that The caching module is further configured to determine available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine the number of videos to be preloaded according to the available bandwidth; select target videos from the preloading live videos according to the number of videos; and cache the first-screen video segments of the target videos to local.

12. The device according to claim 10, wherein The caching module is further configured to determine available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine the preloading speed according to the available bandwidth; and cache the first-screen video segments of the preloading live videos to local according to the preloading speed.

13. The device according to claim 10, wherein The updating module is further configured to determine available bandwidth currently used for preloading based on the preloading bandwidth control policy; determine single-task loading bandwidth according to the available bandwidth and the number of preloading live videos; determine single-task loading traffic of each preloading live video according to the duration of the first-screen video segment of the preloading live video; obtain single-task loading duration according to the single-task loading bandwidth and the single-task loading traffic; and use the single-task loading duration as a time interval for updating local cache.

14. The device according to claim 10, wherein The updating module is further configured to obtain the buffering duration of the live video of the video server and the caching duration of the local first-screen video segment; when the time interval for updating local cache is less than or equal to the sum of the buffering duration and the caching duration, determine that the time interval meets the live video frame chasing condition; when the time interval for updating local cache is greater than the sum of the buffering duration and the caching duration, determine that the time interval does not meet the live video frame chasing condition.

15. The device according to claim 10, characterized in that, The apparatus further includes an allocation module, configured to allocate local link addresses to the preloading live videos; the obtaining module is further configured to determine a target local link address corresponding to the target preloading live video; and obtain the first-screen video segment of the target preloading live video from local according to the target local link address.

16. The device according to claim 10, characterized in that, The playing module is further configured to play the first-screen video segment of the target preloading live video obtained from local; pull the remaining video segments corresponding to the target preloading live video from the video server during the playing of the first-screen video segment; and continue to play the target preloading live video according to the remaining video segments after the playing of the first-screen video segment ends.

17. The device according to claim 16, characterized in that, The playing module is further configured to request the remaining video segments corresponding to the target preloading live video from the video server according to the time stamp corresponding to the last frame of the first-screen video segment of the target preloading live video cached locally; and receive the remaining video segments sent by the video server.

18. The device according to claim 10, characterized in that, The device further includes a request module, configured to directly request the target pre-loaded live video from a video server and play it when the local caching of the first-screen video segment of the target pre-loaded live video requested by the trigger operation is not completed, or when the update of the first-screen video segment of the target pre-loaded live video is not completed.

19. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.

20. A computer-readable storage medium stores a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Video playing method, storage medium and terminal

    CN108259975A

  • Live video processing method and device, terminal and storage medium

    CN110809168A