Video playing method, device, equipment and storage medium

文档序号:276518 发布日期:2021-11-19 浏览:18次 中文

阅读说明:本技术 一种视频播放方法、装置、设备及存储介质 (Video playing method, device, equipment and storage medium ) 是由 严斌 范文昊 严华梁 于 2020-05-15 设计创作,主要内容包括:本申请提供一种视频播放方法、装置、设备及存储介质,可以在检测到路由器接收到视频播放请求时,确定路由器是否为互联网中用于接收视频播放请求的第一跳路由器;如果路由器为第一跳路由器,检测路由器本地存储的视频数据中是否存在发送视频播放请求的目标用户的第一视频数据;若路由器本地存储有第一视频数据,从第一视频数据中确定用于供目标用户所在终端下载的视频播放请求所请求播放的第二视频数据。基于本发明,能够提高视频起播速度、降低视频播放过程中卡顿情况的发生。(The application provides a video playing method, a video playing device and a storage medium, which can determine whether a router is a first-hop router for receiving a video playing request in the Internet or not when detecting that the router receives the video playing request; if the router is a first-hop router, detecting whether first video data of a target user sending a video playing request exists in video data locally stored by the router; and if the router locally stores the first video data, determining second video data requested to be played by a video playing request downloaded by the terminal where the target user is located from the first video data. Based on the invention, the video playing starting speed can be improved, and the occurrence of the pause condition in the video playing process can be reduced.)

1. A video playback method, comprising:

if the router is detected to receive a video playing request, determining whether the router is a first-hop router used for receiving the video playing request in the Internet;

if the router is the first-hop router, detecting whether first video data of a target user sending the video playing request exists in video data locally stored by the router;

if the router locally stores the first video data, determining second video data requested to be played by the video playing request for being downloaded by the terminal where the target user is located from the first video data;

the video data stored locally by the router are the video data of various historical users which are downloaded from the CDN by the router in non-video playing peak periods and take the router as a first-hop router, and the video data of the historical users are the video data to be played by the historical users predicted based on historical video playing requests which are sent by the historical users and take the router as the first-hop router.

2. The method of claim 1, further comprising:

determining at least one historical video playing request received by the router;

screening all first video playing requests which take the router as a first-hop router from the at least one historical video playing request;

predicting a target video to be played by the historical user according to all the first video playing requests sent by the same historical user;

and requesting the video data to be played by the historical user from the CDN at the non-playing peak period based on the target video to be played by the historical user.

3. The method according to claim 2, wherein the predicting the target video to be played by the historical user according to all the first video playing requests sent by the same historical user comprises:

counting at least one second video playing request requesting playing of the same video in all the first video playing requests sent by the same historical user;

determining the total request times and the total playing time of the historical users for the video according to at least one second video playing request which is sent by the same historical user and requests to play the same video;

and predicting the target video to be played by the historical user according to the total request times and the total playing time of the historical user for the video.

4. The method according to claim 3, wherein the predicting the target video to be played by the historical user according to the total request times and the total playing time of the video by the historical user comprises:

calculating playing information of the historical user on the video according to the total request times and the total playing duration of the historical user on the video, wherein the playing information represents the possibility that the historical user requests to play the video;

judging whether the playing information of the historical user to the video meets preset playing conditions or not;

and if the playing information of the historical user to the video meets the playing condition, predicting a target video to be played by the historical user according to the video.

5. The method of claim 4, wherein the predicting the target video to be played by the historical user according to the video comprises:

acquiring a video type of the video, wherein the video type is a television play type, a movie type or a short video type;

predicting a target video to be played by the historical user according to the video type of the video;

if the video type of the video is a television episode type, determining a next episode adjacent to the episode to which the video belongs as a target video to be played by the historical user; and if the video type of the video is a movie type or a short video type, determining the video related to the video as a target video to be played by the historical user.

6. The method of claim 5, wherein the requesting video data to be played by the historical user from the CDN during the off-peak hours based on the target video to be played by the historical user comprises:

determining video data request information of a target video to be played by the historical user according to the video type of the video, wherein the video data request information represents the video data duration of the target video;

requesting video data related to the video data request information in the target video from the CDN during the non-play peak period;

if the video type of the video is a television play type or a movie type, the video data duration represented by the video data request information determined according to the video type of the video is a preset initial playing duration; and if the video type of the video is a short video type, the video data duration represented by the video data request information determined according to the video type of the video is the total playing duration of the target video.

7. The method of claim 6, further comprising:

if the router does not locally store the second video data, the terminal is controlled to download the second video data from other terminals by adopting a peer-to-peer internet technology;

if the terminal does not successfully download the second video data from other terminals, controlling the terminal to continue downloading the second video data from other routers by adopting a peer-to-peer internet technology;

and if the terminal does not successfully download the second video data from other routers, controlling the terminal to continue downloading the second video data from the CDN.

8. A video playback apparatus, comprising:

the router determination unit is used for determining whether the router is a first-hop router used for receiving the video playing request in the Internet or not if the router is detected to receive the video playing request;

a first video data detection unit, configured to detect whether there is first video data of a target user that sends the video playing request in video data locally stored in a router if the router is the first-hop router;

a second video data determining unit, configured to determine, if the router locally stores the first video data, second video data requested to be played by the video playing request for being downloaded by the terminal where the target user is located from the first video data;

the video data stored locally by the router are the video data of various historical users which are downloaded from the CDN by the router in non-video playing peak periods and take the router as a first-hop router, and the video data of the historical users are the video data to be played by the historical users predicted based on historical video playing requests which are sent by the historical users and take the router as the first-hop router.

9. An apparatus, comprising: the system comprises a processor and a memory, wherein the processor and the memory are connected through a communication bus; the processor is used for calling and executing the program stored in the memory; the memory for storing a program for implementing the video playback method according to any one of claims 1 to 7.

10. A computer-readable storage medium having computer-executable instructions stored thereon for performing the video playback method of any one of claims 1-7.

Technical Field

The present invention relates to the field of computer technologies, and in particular, to a video playing method, apparatus, device, and storage medium.

Background

With the continuous development of information technology, watching video programs has become one of the most common entertainment ways in people's life. When a user uses a terminal to play a video, the user needs to access the CDN through the internet to request video data, and download the video data from the CDN to the terminal to play the video.

In the video playing mode, all terminals requesting video playing request video data from the CDN, which easily causes bandwidth increase of the CDN, affects speed of downloading video data by the terminals, and causes video playing to be stuck, and especially for a video start playing process, if the video start playing speed is slow and the video start playing is stuck, user experience is seriously affected.

Disclosure of Invention

In view of the above, the present application provides a video playing method, apparatus, device and storage medium, so as to increase the video playing speed and reduce the occurrence of a pause condition in the video playing process. The technical scheme is as follows:

a video playback method, comprising:

if the router is detected to receive a video playing request, determining whether the router is a first-hop router used for receiving the video playing request in the Internet;

if the router is the first-hop router, detecting whether first video data of a target user sending the video playing request exists in video data locally stored by the router;

if the router locally stores the first video data, determining second video data requested to be played by the video playing request for being downloaded by the terminal where the target user is located from the first video data;

the video data stored locally by the router are the video data of various historical users which are downloaded from the CDN by the router in non-video playing peak periods and take the router as a first-hop router, and the video data of the historical users are the video data to be played by the historical users predicted based on historical video playing requests which are sent by the historical users and take the router as the first-hop router.

A video playback apparatus comprising:

the router determination unit is used for determining whether the router is a first-hop router used for receiving the video playing request in the Internet or not if the router is detected to receive the video playing request;

a first video data detection unit, configured to detect whether there is first video data of a target user that sends the video playing request in video data locally stored in a router if the router is the first-hop router;

a second video data determining unit, configured to determine, if the router locally stores the first video data, second video data requested to be played by the video playing request for being downloaded by the terminal where the target user is located from the first video data;

the video data stored locally by the router are the video data of various historical users which are downloaded from the CDN by the router in non-video playing peak periods and take the router as a first-hop router, and the video data of the historical users are the video data to be played by the historical users predicted based on historical video playing requests which are sent by the historical users and take the router as the first-hop router.

An apparatus, comprising: the system comprises a processor and a memory, wherein the processor and the memory are connected through a communication bus; the processor is used for calling and executing the program stored in the memory; the memory is used for storing programs, and the programs are used for realizing the video playing method.

A computer-readable storage medium having stored therein computer-executable instructions for performing the video playback method.

According to the video playing method, the device, the equipment and the storage medium provided by the embodiment of the application, the router closest to the user can predict the video to be played by the user and download the video to be played by the user from the CDN to the router closest to the user (namely, a first hop router for receiving a video playing request sent by the user through a terminal) in a non-video playing peak period, so that when the user sends the video playing request through the terminal to request for playing the video, the video data requested to be played by the video playing request can be preferentially downloaded from the router closest to the user, thereby not only saving the bandwidth of the CDN, but also improving the video playing speed and reducing the occurrence of a jam condition in the video playing process.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.

Fig. 1 is a schematic diagram of a video data downloading system according to an embodiment of the present application;

fig. 2 is a flowchart of a method for locally caching video data in a router according to an embodiment of the present application;

fig. 3 is a flowchart of a method for predicting a target video to be played by a user according to first video playing requests sent by the same user according to an embodiment of the present application;

fig. 4 is a flowchart of a method for requesting video data to be played by a user from a CDN during an off-peak period based on a target video to be played by the user according to an embodiment of the present application;

fig. 5 is a flowchart of a video playing method according to an embodiment of the present application;

fig. 6 is a flowchart of another video playing method provided in the embodiment of the present application;

fig. 7 is a structural diagram of a video playing apparatus according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Example (b):

CDN: it is called Content Delivery Network, i.e. Content distribution Network. The CDN is an intelligent virtual network constructed on the basis of the existing network, and by means of edge servers deployed in various places and functional modules of load balancing, content distribution, scheduling and the like of a central platform, a user can obtain required content nearby, network congestion is reduced, and the access response speed and hit rate of the user are improved. The key technology of the CDN is mainly content storage and distribution technology.

When a traditional user watches a video, the user needs to access the CDN to request video data, which brings traffic to the CDN, and the traffic accumulation is bandwidth. The increase of the bandwidth of the CDN affects the speed at which the terminal downloads the video data from the CDN, which further causes the video playing of the terminal to be paused, thereby affecting the user experience. Especially, when a video start-up process is paused, the video start-up speed is slow, which causes poor experience of the user on the application program providing video play in the terminal and reduces the stickiness of the user on the application program.

In order to save the bandwidth cost of the CDN, the P2P technology is developed. P2P technique: also called peer-to-peer internet technology, is a new network technology, and relies on the computing power and bandwidth of participants in the network, rather than aggregating the dependence on a few servers. P2P networks are commonly used to connect nodes through Ad Hoc connections. Such networks can be used for a variety of purposes, and various archive sharing software has been widely used. P2P technology is also used in data communication for real-time media services like VoIP.

Generic P2P download scheme: when other users need to watch the video download data, the video data is downloaded from the existing terminal caching the video through the P2P technology. The general P2P downloading scheme is mainly used to save bandwidth cost of the CDN, but the user terminal is unstable, and there are also problems of network outage, network fluctuation, deletion of video data, and the like at any time, and poor user experience.

Further, in the patent application with publication No. CN108200478A, the video that the user has watched can be pushed to the router, and when other users play, the video data can be downloaded from the router to other users, and the data can be transmitted by using the P2P technology to achieve the purpose of data sharing. The scheme downloaded from the router based on the P2P technology is also only for increasing a scheme form of a terminal device, and needs video data watched by a user to be cached on the router to provide data sharing for other users, and has no difference from the general P2P downloading scheme, and both of them have the problem of bad user experience.

In view of this, embodiments of the present application provide a video playing method, apparatus, device, and storage medium, which can not only reduce CDN bandwidth, but also improve video playing speed, reduce the occurrence of a jam during video playing, and improve user experience.

First, in consideration of the general regularity of video watching, the inventor of the present application may regard a period of a day in which a large number of users request to play video as a video playing peak period, and regard a period of a day in which a small number of users request to play video as a non-video playing peak period.

For example, the time of day may be divided into a video playing peak period and a non-video playing peak period, such as afternoon, evening are generally concentrated time periods when the user watches the video, and early morning is generally a time period when the user watches the video least, so the video playing peak period may be determined as 11 o 'clock-24 o' clock of the day, and the non-video playing peak period may be determined as 0 o 'clock-11 o' clock of the day.

The method and the device can actively push the video data which can be watched by the user from the CDN to the router to which the current user belongs (the router to which the current user belongs can be regarded as the router nearest to the user) in advance during non-video playing peak periods, the user does not need to download the video data from the CDN when watching the video, the video data is directly downloaded from the nearest router, the router nearest to the user has higher stability, and the router nearest to the user caches the video data which can be watched by the user, therefore, when the user requests to watch the video, the video data cached in the router closest to the user has a high hit for the video requested to watch by the user, and because the router closest to the user has high stability relative to the user, therefore, the video playing starting process can be accelerated, and the occurrence of the pause condition in the video playing process can be reduced.

Particularly, when the router closest to the user caches video playing start data which can be watched by the user, the storage space of the router can be saved so that the router can store more video data which can be watched by the user, the purpose of accelerating the video playing start speed can be achieved, and further, the downloading speed of the video playing start data is improved, so that the buffer time is provided for downloading the residual video data except the video playing start data in the video, and the occurrence of a pause condition in the video playing process is reduced.

Fig. 1 is a schematic diagram of a video data downloading system according to an embodiment of the present application.

As shown in fig. 1, there are three current ways for a terminal to download video data, where the first way may be to download video data from a CDN, the second way may be to download video data from a router based on P2P technology, and the third way may be to download video data from other terminals based on P2P technology.

When a user requests to watch a video by sending a video playing request by using an application program on a terminal device (including a PC, an Android device, an iOS device, etc.), video data is downloaded to the terminal device of the user by accessing a CDN or a P2P technology, all video playing requests need to be forwarded by a router, and all video playing requests forwarded by the router can be collected correspondingly. For example, if video data is downloaded from the CDN, DNS resolution (forwarding through a router) is required first, a real IP address of the CDN is taken, and then the video data is requested from the CDN; if video data is downloaded by using the P2P technology, a connection needs to be established to other terminals/routers through the router before data transmission can be performed by using the P2P technology.

In the embodiment of the application, the router can analyze the video playing request sent by the user in real time to determine the video data which are possibly watched by the user and are required to be cached in the router, and download the video data which are possibly watched by the user from the CDN in the non-video playing peak period, so that when the video playing request sent by the user is received, the video data requested to be played by the video playing request can be directly downloaded from the router.

It should be noted that the router may receive video playing requests sent by many users, but when analyzing the video playing requests received by the router, the router may analyze only the user to which the video playing request that uses the router as the first-hop router belongs, so that video data that the user may watch may be cached in the router closest to the user, because the router closest to the user has more stability in the process of downloading the video data by the user, and thus, the video data downloading speed may be effectively increased.

It should be noted that, after a user sends a video playing request through a terminal, a first router in the internet for receiving the video playing request may be considered as a first-hop router of the video playing request, the user may be considered as a user who uses the router as a first-hop router, and the first-hop router may be considered as a router closest to the user.

Fig. 2 is a flowchart of a method for locally caching video data in a router according to an embodiment of the present disclosure.

As shown in fig. 2, the method includes:

s201, determining at least one historical video playing request received by a router;

the method for caching video data locally at a router, as shown in fig. 2, provided by the embodiment of the present application may be performed separately for each router in the internet.

In the embodiment of the present application, the video playing request received by the router may be analyzed, and when the video playing request received by the router is analyzed, the video playing request received by the router may be referred to as a historical video playing request. Specifically, at least one historical video playing request received by the router may be analyzed, and the router may be determined to be a historical user of the first-hop router by analyzing the at least one historical video playing request received by the router, so as to predict a target video to be played by the historical user, and download video data of the target video to be played by the historical user from the CDN to the router during a non-video playing peak period.

As a preferred embodiment of the present application, the at least one historical video play request received by the router may be all historical video play requests received by the router.

As another preferred implementation manner of the embodiment of the present application, the at least one historical video playing request received by the router may be all historical video playing requests received by the router within the recent historical time period.

In this embodiment of the application, the specific content of the at least one history video playing request received by the router may be set by the inventor according to the needs of the inventor, which is not limited herein.

S202, screening all first video playing requests which take the router as a first-hop router from at least one historical video playing request;

in the embodiment of the application, after determining at least one historical video playing request received by a router, all historical video playing requests that use the router as a first-hop router may be screened from the at least one historical video playing request received by the router, and for convenience of distinguishing, each screened historical video playing request that uses the router as a first-hop router may be temporarily referred to as a first video playing request.

S203, predicting a target video to be played by the historical user according to all first video playing requests sent by the same historical user;

in the embodiment of the application, after at least one historical video playing request received by a router is determined, and all first video playing requests taking the router as a first hop router are determined from the at least one historical video playing request received by the router, all the screened first video playing requests can be grouped according to different sending historical users, all the first video playing requests sent by the same historical user are divided into one group, videos to be played by the historical users sending the group of first video playing requests are predicted according to each group of first video playing requests, and the videos to be played by the historical users can be changed into target videos for convenience of distinguishing.

In the embodiment of the present application, after all the first video play requests of the router are screened from at least one historical video play request received by the router (all the first video play requests of the router are all the historical video play requests of the router that are taken as a first-hop router in the at least one historical video play request received by the router), all the first video play requests sent by the same historical user in all the first video play requests of the router may be considered as one group, so that all the first video play requests of the router are divided into multiple groups, the sending historical users of each group of first video play requests of the router are different, and the following operations are performed for each group of first video play requests of the router: and predicting a target video to be played by the historical user sending the group of first video playing requests by using the group of first video playing requests, wherein the historical user sending the group of first video playing requests can be regarded as a historical user taking the router as a first-hop router.

For a specific way of predicting the target video to be played by the historical user according to all the first video playing requests sent by the same historical user, please refer to the description of fig. 3 below, which is not repeated herein.

S204, requesting the CDN for the video data to be played by the historical user in the non-playing peak period based on the target video to be played by the historical user.

In the embodiment of the application, after determining that the router is used as each historical user of a first-hop router according to at least one historical video playing request received by the router and predicting the target video to be played by each historical user, video data of the predicted target video to be played by each historical user can be respectively requested to the CDN during a non-video playing peak period.

The request for the video data to be played by the historical user from the CDN during the off-peak period based on the target video to be played by the historical user may be the request for the video data of the target video to be played by the historical user from the CDN during the off-peak period based on the target video to be played by the historical user.

Further, after the router requests video data to be played by the historical user from the CDN, the video data to be played by the historical user requested by the CDN may be stored locally in the router, and the video data to be played by the historical user locally stored in the router may be considered as the video data of the historical user locally stored in the router.

For example, if the video data 1 to be played by the historical user a is requested from the CDN and then the video data 1 is stored locally in the router 1, and the video data 2 to be played by the historical user b is requested from the CDN and then the video data 2 is stored locally in the router 1, the video data 1 locally stored in the router 1 is the video data of the historical user a, and the video data 2 locally stored in the router 1 is the video data of the historical user b.

As a preferred implementation manner of the embodiment of the present application, the video data to be played by the historical user requested by the CDN may be cached locally in the router.

For a specific implementation manner of requesting historical video data to be played by a user from the CDN during an off-peak period based on a target video to be played by the user, please refer to the detailed description in fig. 4, which is not repeated herein.

According to the embodiment of the application, the predicted video data to be played by the historical user can be cached in the router closest to the historical user, so that the historical user can conveniently acquire the video data from the router closest to the historical user when requesting to play the video subsequently, the video playing speed is improved, and the occurrence of the video blocking condition in the video playing process is reduced.

Fig. 3 shows a method for predicting a target video to be played by a historical user according to all first video playing requests sent by the same historical user according to an embodiment of the present application.

As shown in fig. 3, the method includes:

s301, counting at least one second video playing request requesting playing of the same video in all first video playing requests sent by the same historical user;

in the embodiment of the application, at least one historical video playing request received by a router is determined, after all first video playing requests taking the router as a first-hop router are screened out from the at least one historical video playing request received by the router, all screened out first video playing requests are divided according to different sending historical users, all first video playing requests sent by the same historical user are divided into one group, and then the following processes are respectively executed for each group of first video playing requests: dividing all the first video playing requests in the group of first video playing requests according to different video playing requests, and dividing all the first video playing requests in the group of first video playing requests for playing the same video into one group, so that the group of first video playing requests are further divided into one or more groups, the videos requested to be played by the first video playing requests in different groups are different, and the videos requested to be played by the first video playing requests in the same group are the same. For the sake of convenience of differentiation, each first video playback request in the group may be referred to as a second video playback request for each group. Thus, a small set of first video playback requests can be considered a set of second video playback requests, a set of second video playback requests including at least one second video playback request requesting playback of the same video.

S302, determining the total request times and the total playing time of the historical users for the video according to at least one second video playing request sent by the same historical user and requesting to play the same video;

in the embodiment of the present application, the following processes are respectively performed for each group of second video playing requests determined in step S301: and determining the total request times and the total playing time of the historical users sending the group of second video playing requests for the videos requested to be played by the group of second video playing requests. The number of the second video playing requests in the group of second video playing requests can be determined as the total number of times of requests of the historical user sending the group of second video playing requests for the video requested to be played by the group of second video playing requests; and determining the sum of the video playing time lengths of all the second video playing requests in the group of second video playing requests as the total playing time length of the video requested to be played by the group of second video playing requests of the historical user sending the group of second video playing requests.

The time length of the video requested to be played by the video playing request, which is watched by the historical user based on the video playing request after the video playing request is sent by the terminal, can be regarded as the video playing time length of the video playing request.

And S303, predicting the target video to be played by the historical user according to the total request times and the total playing time of the historical user to the video.

In this embodiment of the application, after determining, for each group of second video play requests determined in step S301, the total request times and the total play time of the videos requested to be played by the group of second video play requests by the historical users sending the group of second video play requests, videos to be played by the historical users sending the group of second video play requests may be predicted according to the total request times and the total play time of the videos requested to be played by the group of second video play requests by the historical users sending the group of second video play requests, and in order to facilitate distinguishing, videos to be played by the historical users sending the group of second video play requests may be called target videos.

Taking a group of second video playing requests as an example, after determining the total request times and the total playing time length of the videos requested to be played by the group of second video playing requests by the historical users sending the group of second video playing requests, the playing information of the videos requested to be played by the group of second video playing requests by the historical users sending the group of second video playing requests can be calculated according to the total request times and the total playing time length (the playing information represents the possibility that the videos requested to be played by the group of second video playing requests are requested to be played by the historical users sending the group of second video playing requests); and judging whether the playing information meets preset playing conditions or not, and if the playing information meets the playing conditions, predicting and sending the target video to be played by the historical user of the group of second video playing requests according to the video requested to be played by the group of second video playing requests.

For example, taking a group of second video playing requests as an example, if the video requested to be played by the group of second video playing requests is video 1, the historical user sending the group of second video playing requests is user 1; the total request times of the user 1 to the video 1 determined according to the group of second video playing requests is N, and the total playing time length of the user 1 to the video 1 determined according to the group of second video playing requests is T; and calculating the product of the total request times N and the total playing time T as the playing information of the user 1 to the video 1, if N x T meets the preset playing condition, hitting the video data to push the scene in advance, and predicting the target video to be played by the user 1 according to the video 1.

In the embodiment of the present application, the playing condition may be a preset value, and if the playing information exceeds the preset value, it is determined that the playing information satisfies the playing condition, and if the playing information does not exceed the preset value, it is determined that the playing information does not satisfy the playing condition.

Still taking the above as an example, if the playing condition is the preset value P, if N × T > P, it is determined that the playing information satisfies the playing condition; and if N x T is not larger than P, determining that the playing information does not meet the playing condition.

In this embodiment of the present application, taking a group of second video playing requests as an example, a manner of predicting a target video to be played by a historical user who sends the group of second video playing requests according to a video requested to be played by the group of second video playing requests may be as follows: and acquiring the video type of the video requested to be played by the group of second video playing requests, and predicting the target video to be played by the historical user sending the group of second video playing requests according to the video type of the video. If the video type of the video is a television episode type, determining a next episode adjacent to the episode to which the video belongs as a target video to be played by the historical user; and if the video type of the video is a movie type or a short video type, determining the video related to the video as a target video to be played by the historical user.

The video type of the video is the same as the video type of the target video to be played by the historical user predicted according to the video type of the video.

As a preferred implementation manner of the embodiment of the present application, if the video type of the video is a movie type, a recommended movie related to the video may be used as the video related to the video; if the video type of the video is a short video type, other short videos related to the video can be used as the video related to the video.

Still taking the group of second video playing requests as an example, if the video requested to be played by the group of second video playing requests is video 1, the historical user sending the group of second video playing requests is user 1; the total request times of the user 1 to the video 1 determined according to the group of second video playing requests is N, and the total playing time length of the user 1 to the video 1 determined according to the group of second video playing requests is T; calculating a product N x T of the total request times N and the total playing time T as playing information of the user 1 to the video 1, and if the N x T meets a preset playing condition, acquiring a video type of the video 1; if the video type of the video 1 is a television episode type, determining a next episode adjacent to the episode to which the video 1 belongs as a target video to be played by the user 1; if the video type of the video 1 is the movie type, determining a recommended movie related to the video 1 as a target video to be played by the user 1; and if the video type of the video 1 is the short video type, determining other short videos related to the video 1 as the target video to be played by the user 1.

For example, if the video genre to which the video 1 belongs is a drama genre and the episode to which the video 1 belongs is the 25 th episode in the drama 1, the 26 th episode in the drama 1 may be determined as the target video to be played by the user 1.

Further, after predicting the target video to be played by the historical user, the embodiment of the application may request the CDN for the video data to be played by the historical user at the off-play peak time based on the target video to be played by the user.

Fig. 4 is a flowchart of a method for requesting, to a CDN, video data to be played by a historical user during an off-peak period based on a target video to be played by the historical user according to an embodiment of the present application.

As shown in fig. 4, the method includes:

s401, determining video data request information of a target video to be played by a historical user according to the video type of the video, wherein the video data request information represents the video data duration of the target video;

in the embodiment of the application, if the video type of the video is a television play type or a movie type, the video data duration represented by the video data request information determined according to the video type of the video is a preset initial playing duration; and if the video type of the video is the short video type, the video data duration represented by the video data request information determined according to the video type of the video is the total playing duration of the target video.

In the embodiment of the present application, preferably, the starting playing time period may be 3 minutes, 5 minutes, and the like, and the above is only preferred contents regarding the starting playing time period provided in the embodiment of the present application, and specific contents regarding the starting playing time period may be set by the inventor according to his own needs, and is not limited herein.

S402, requesting video data related to the video data request information in the target video from the CDN in the non-playing peak period.

In the embodiment of the application, after the target video to be played by a historical user is predicted according to the video type of the video, the video data request information of the target video can be determined according to the video type of the video, and then the video data related to the video data request information in the target video is requested to the CDN at the non-playing peak period.

Specifically, if the video type of the video is a television play type, the video data duration represented by the video data request information of the target video determined according to the video type of the video is a preset initial playing duration, and accordingly, the video data with the initial playing duration in the target video is requested to the CDN at the non-playing peak time.

Still taking the above embodiment as an example, if the video genre to which the video 1 belongs is a drama genre and the episode to which the video 1 belongs is the 25 th episode in the drama 1, the 26 th episode in the drama 1 may be determined as the target video to be played by the user 1 predicted according to the video genre of the video 1; if the initial play duration is 3 minutes, the CDN may be requested for the first 3 minutes of video data in the 26 th set of the series 1 during non-video-play peak hours.

If the video type of the video is a movie type, the video data duration represented by the video data request information of the target video determined according to the video type of the video is a preset initial playing duration, and correspondingly, the video data with the initial playing duration in the target video is requested to the CDN at the non-playing peak period.

For example, if the video type of the video is a movie type and the initial playing time is 3 minutes, the CDN may request video data of the first 3 minutes of the target video during the non-video playing peak period.

If the video type of the video is a short video type, the video data duration represented by the video data request information of the target video determined according to the video type of the video is the total playing duration of the target video data, and accordingly, all the video data of the target video are requested to the CDN at the non-playing peak period.

According to the embodiment of the application, the video data of the initial playing time length in the target video is cached in the router aiming at the target video of the television drama type/movie type, and all the video data of the target video is cached in the router aiming at the target video of the short video type, so that the storage space of the router can be effectively saved, and more video data to be played by a historical user can be conveniently stored.

In combination with the method for locally caching predicted video data of the target video to be played by the historical user in the router closest to the user in the foregoing embodiment, an embodiment of the present application further provides a video playing method, and please refer to fig. 5 specifically.

As shown in fig. 5, the method includes:

s501, if the router is detected to receive the video playing request, determining whether the router is a first-hop router for receiving the video playing request in the Internet; if the router is the first hop router, executing step S502;

the video playing method provided by the embodiment of the application is applied to a router, and after it is detected that the router receives a video playing request, it may be determined whether the router is a first router in the internet for receiving the video playing request, and if the router is the first router in the internet for receiving the video playing request, the router is determined as a first-hop router in the internet for receiving the video playing request, and then step S502 is executed.

S502, detecting whether first video data of a target user sending a video playing request exists in the video data locally stored in the router, and executing the step S503 if the first video data is locally stored in the router;

in the embodiment of the present application, a user sending a video playing request is temporarily referred to as a target user, whether video data of the target user sending the video playing request exists in video data locally stored in a router is detected (for convenience of distinguishing, the video data of the target user may be referred to as first video data of the target user), and if the first video data of the target user sending the video playing request exists in the video data locally stored in the router, step S503 is executed.

S503, determining second video data requested to be played by a video playing request downloaded by a terminal where a target user is located from the first video data;

in this embodiment of the application, if there is first video data of a target user that sends a video playing request in video data locally stored by a router, video data requested to be played by the video playing request may be determined from the first video data (for convenience of distinguishing, the video data requested to be played by the video playing request may be referred to as second video data), so that a terminal where the target user that sends the video playing request is located downloads the second video data.

Correspondingly, the terminal can realize downloading and playing the second video data simultaneously; or the terminal plays the second video data after downloading the second video data.

The above is only a preferred way for the terminal to download and play the second video data provided in the embodiment of the present application, and the inventor may set the download and play way of the second video data according to his own requirement, which is not limited herein.

Further, refer to fig. 6 as a flowchart of another video playing method provided in this embodiment of the present application.

As shown in fig. 6, the method includes:

s601, if the router is detected to receive the video playing request, determining whether the router is a first-hop router for receiving the video playing request in the Internet; if the router is the first hop router, executing step S602;

s602, detecting whether first video data of a target user sending a video playing request exists in the video data locally stored by the router; if the router locally stores the first video data, executing step S603;

further, if the router does not locally store the first video data, step S605 is executed.

S603, detecting whether second video data requested to be played by the video playing request is stored in the first video data; if the first video data stores the second video data requested to be played by the video playing request, executing step S604; if the first video data does not store the second video data requested to be played by the video playing request, executing step S605;

s604, determining second video data requested to be played by a video playing request downloaded by a terminal where a target user is located from the first video data;

further, after determining the second video data for downloading from the first video data, the terminal may download the second video data from the router, and if the terminal does not successfully download the second video data from the router, step S605 may be executed. In this case, step S605 may specifically be to control the terminal to continue downloading the second video data from the other terminal by using the peer-to-peer internet technology.

S605, adopting a peer-to-peer internet technology to control the terminal to download second video data from other terminals;

s606, detecting whether the terminal successfully downloads the second video data from other terminals; if the terminal does not successfully download the second video data from other terminals, executing step S607;

s607, the terminal is controlled by adopting the peer-to-peer internet technology to continuously download the second video data from other routers;

s608, detecting whether the terminal successfully downloads the second video data from other routers; if the terminal does not successfully download the second video data from other routers, executing step S609;

and S609, the control terminal continuously downloads the second video data from the CDN.

It should be noted that if the router of the first-hop router serving as the video playing request does not locally store the second video data requested to be played by the video playing request, the peer-to-peer internet technology is preferentially adopted to control the terminal to download the second video data from other terminals; if the peer-to-peer internet technology control terminal is not adopted to successfully download the second video data from other terminals, the peer-to-peer internet technology control terminal is continuously adopted to download the second video data from other routers; and if the peer-to-peer internet technology control terminal cannot be used for successfully downloading the second video data from other routers, continuing to control the terminal to download the second video data from the CDN.

It should be noted that, when the video type of the video requested to be played by the video playing request is a tv play type or a movie type, the first-hop router that receives the video playing request stores part of video data (video start-playing data) in the video requested to be played by the video playing request, and does not store all video data of the video requested to be played by the video playing request, in this case, the first-hop router that receives the video playing request may also store the second video data requested to be played by the video playing request. Accordingly, the terminal downloads only the video start playing data of the video requested to be played by the video playing request from the first-hop router, and after the terminal finishes downloading the video start playing data of the video from the first-hop router, the terminal executes steps S605 to S609 to realize downloading of other video data in the video except the video start playing data.

When a user sends a video playing request through a terminal to request for playing a video, the video playing method provided by the embodiment of the application can preferentially download video data of the video from a router (namely, a first-hop router for receiving the video playing request sent by the terminal) closest to the terminal sending the video playing request, so that the video playing starting speed is increased, and the occurrence of a pause condition in the video playing process is reduced.

Based on the above commonalities, a video playing apparatus provided in the embodiments of the present application will now be described in detail.

Fig. 7 is a schematic structural diagram of a video playing apparatus according to an embodiment of the present application.

As shown in fig. 7, the apparatus includes:

a router determining unit 71, configured to determine, if it is detected that the router receives the video playing request, whether the router is a first-hop router in the internet for receiving the video playing request;

a first video data detecting unit 72, configured to detect whether there is first video data of a target user that sends a video playing request in video data locally stored by a router if the router is a first-hop router;

a second video data determining unit 73, configured to determine, if the router locally stores the first video data, second video data requested to be played by a video playing request downloaded by a terminal where the target user is located from the first video data;

the video data stored locally by the router are video data of history users which are downloaded from the CDN by the router in non-video playing peak periods and take the router as a first-hop router, and the video data of the history users are predicted based on history video playing requests which are sent by the history users and take the router as the first-hop router to be played by the history users.

Further, an embodiment of the present application provides a video playing apparatus, further including:

the router comprises a first determining unit, a second determining unit and a control unit, wherein the first determining unit is used for determining at least one historical video playing request received by the router;

the screening unit is used for screening all first video playing requests which take the router as a first-hop router from at least one historical video playing request;

the video playing device comprises a first prediction unit, a second prediction unit and a third prediction unit, wherein the first prediction unit is used for predicting a target video to be played by a historical user according to all first video playing requests sent by the same historical user;

and the video data request unit is used for requesting the video data to be played by the historical user from the CDN at the non-playing peak period based on the target video to be played by the historical user.

In this embodiment, preferably, the first prediction unit includes:

the statistical unit is used for counting at least one second video playing request requesting to play the same video in all first video playing requests sent by the same historical user;

the second determining unit is used for determining the total request times and the total playing time of the historical users for the video according to at least one second video playing request which is sent by the same historical user and requests to play the same video;

and the second prediction unit is used for predicting the target video to be played by the historical user according to the total request times and the total playing time of the historical user for the video.

In the embodiment of the present application, preferably, the second prediction unit includes:

the playing information calculation unit is used for calculating the playing information of the historical user on the video according to the total request times and the total playing duration of the historical user on the video, and the playing information represents the possibility that the historical user requests to play the video;

the judging unit is used for judging whether the playing information of the historical user to the video meets the preset playing condition;

and the third prediction unit is used for predicting the target video to be played by the historical user according to the video if the playing information of the historical user on the video meets the playing condition.

In the embodiment of the present application, preferably, the third prediction unit includes:

the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the video type of a video, and the video type is a television series type, a movie type or a short video type;

the fourth prediction unit is used for predicting a target video to be played by a historical user according to the video type of the video;

if the video type of the video is a television episode type, determining a next episode adjacent to the episode to which the video belongs as a target video to be played by a historical user; and if the video type of the video is a movie type or a short video type, determining the video related to the video as a target video to be played by the historical user.

In this embodiment, preferably, the video data request unit includes:

the video data request information determining unit is used for determining video data request information of a target video to be played by a historical user according to the video type of the video, and the video data request information represents the video data duration of the target video;

the video data request subunit is used for requesting video data related to the video data request information in the target video from the CDN at the non-playing peak period;

if the video type of the video is a television play type or a movie type, the video data duration represented by the video data request information determined according to the video type of the video is a preset initial playing duration; and if the video type of the video is the short video type, the video data duration represented by the video data request information determined according to the video type of the video is the total playing duration of the target video.

Furthermore, an embodiment of the present application provides a video playing apparatus, further including:

the first downloading unit is used for downloading the second video data from other terminals by adopting a peer-to-peer internet technology control terminal if the router does not locally store the second video data;

the second downloading unit is used for controlling the terminal to continuously download the second video data from other routers by adopting a peer-to-peer internet technology if the terminal does not successfully download the second video data from other terminals;

and the third downloading unit is used for controlling the terminal to continue downloading the second video data from the CDN if the terminal fails to download the second video data from other routers.

Furthermore, an embodiment of the present application further provides an apparatus, where the apparatus includes: the processor and the memory are connected through a communication bus; the processor is used for calling and executing the program stored in the memory; the memory is used for storing programs, and the programs are used for realizing the video playing method provided by the embodiment of the application.

An apparatus provided by the embodiment of the present application may be a router.

Furthermore, an embodiment of the present application further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used for executing the video playing method.

Alternatively, the detailed functionality and extended functionality of the computer-executable instructions may be as described above.

According to the video playing method, the device, the equipment and the storage medium provided by the embodiment of the application, the router closest to the user can predict the video to be played by the user and download the video to be played by the user from the CDN to the router closest to the user (namely, the first hop router for receiving the video playing request sent by the user through the terminal) in the non-video playing peak period, so that when the user sends the video playing request through the terminal to request for playing the video, the video data requested to be played by the video playing request can be preferentially downloaded from the router closest to the user, and therefore the problem of bandwidth increase of the CDN can be solved, the video playing speed can be increased, and the occurrence of blocking in the video playing process can be reduced.

The video playing method, apparatus, device and storage medium provided by the present invention are described in detail above, and the principle and implementation of the present invention are explained herein by applying specific examples, and the description of the above examples is only used to help understanding the method and core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.

It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include or include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:电子资源显示和发放方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类