Video playing method and device

文档序号:38500 发布日期:2021-09-24 浏览:8次 中文

阅读说明:本技术 一种视频的播放方法及装置 (Video playing method and device ) 是由 易桂 李小红 彭一 赵仙勇 王亚飞 于 2021-06-24 设计创作,主要内容包括:本申请公开了一种视频的播放方法及装置,其中,所述方法包括:接收目标客户端发送的获取目标视频的播放串的请求;判断是否存在目标备份地址;其中,目标备份地址包括目标客户端对应的备份地址,和/或目标视频对应的备份地址;目标客户端对应的备份地址为预先在目标客户端无法播放视频时设置的,用于获取任意一个视频的备份播放串的地址;目标视频对应的备份地址预先在无法正常播放目标视频时设置;若判断出存在目标备份地址,则基于目标备份地址确定出目标视频的备份播放串;将目标视频的备份播放串反馈给目标客户端进行播放;若判断出不存在目标备份地址,则获取目标视频的原始播放串,并将目标视频的原始播放串反馈给目标客户端进行播放。(The application discloses a video playing method and device, wherein the method comprises the following steps: receiving a request for acquiring a play string of a target video, which is sent by a target client; judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video; the backup address corresponding to the target client is an address which is set in advance when the target client cannot play the video and is used for acquiring a backup play string of any one video; setting a backup address corresponding to the target video when the target video cannot be normally played in advance; if the target backup address exists, determining a backup play string of the target video based on the target backup address; feeding back the backup play string of the target video to the target client for playing; and if the target backup address does not exist, acquiring the original play string of the target video, and feeding the original play string of the target video back to the target client for playing.)

1. A method for playing a video, comprising:

receiving a request for acquiring a play string of a target video, which is sent by a target client;

judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video; the backup address corresponding to the target client is an address which is set before the request is received and when the target client cannot play videos and is used for storing a backup play string of any one video; setting a backup address corresponding to the target video before receiving the request and when the target video cannot be normally played;

if the target backup address exists, determining a backup play string of the target video based on the target backup address;

feeding back the backup play string of the target video to the target client for playing;

and if the target backup address does not exist, acquiring the original play string of the target video, and feeding the original play string of the target video back to the target client for playing.

2. The method of claim 1, wherein the determining whether the target backup address exists comprises:

judging whether a backup address corresponding to the target client exists or not;

if the backup address corresponding to the target client does not exist, judging whether the backup address corresponding to the target video exists or not;

if the target backup address is determined to exist, determining a backup play string of the target video based on the target backup address, including:

if the backup address corresponding to the target client exists, searching a backup play string of the target video from a position indicated by the backup address corresponding to the target client;

and if the backup address corresponding to the target video exists, determining the backup address of the target video based on the backup address corresponding to the target video.

3. The method according to claim 2, wherein the backup address corresponding to the target video includes a first backup address and/or a second backup address, and the determining whether the backup address corresponding to the target video exists comprises:

judging whether the first backup address exists or not; when any client cannot play, configuring the backup play string of the target video as the first backup address, and caching the backup play string in a play gateway;

if the first backup address does not exist, judging whether a second backup address exists or not; the second backup address is configured when any client cannot play videos and is used for acquiring addresses of backup play strings of a plurality of videos;

if it is determined that the backup address corresponding to the target video exists, determining the backup address of the target video based on the backup address corresponding to the target video includes:

if the first backup address exists, determining the first backup address cached in the playing gateway as a backup playing string of the target video;

and if the second backup address exists, searching a backup play string of the target video from a storage space indicated by the second backup address.

4. The method of claim 3, wherein the finding the backup play string of the target video from the location indicated by the backup address corresponding to the target client comprises:

removing the parameters of the specified type in the request to obtain a backup video request; wherein, at least the identification of the target video is reserved in the backup video request;

and forwarding the request with the parameters removed to a backup playing back end so as to find out a backup address corresponding to the target client from the position indicated by the backup address corresponding to the target client through the backup playing back end.

5. The method of claim 2, further comprising:

polling and playing each target data in the operation background at regular time through a playing gateway; the target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier;

and associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into the playback gateway.

6. A video playback apparatus, comprising:

the receiving unit is used for receiving a request for acquiring a play string of a target video, which is sent by a target client;

the judging unit is used for judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video; the backup address corresponding to the target client is an address which is set before the request is received and when the target client cannot play videos and is used for storing a backup play string of any one video; setting a backup address corresponding to the target video before receiving the request and when the target video cannot be normally played;

the first determining unit is used for determining a backup play string of the target video based on the target backup address when the judging unit judges that the target backup address exists;

the first feedback unit is used for feeding back the backup play string of the target video to the target client for playing;

and the second feedback unit is used for acquiring the original playing string of the target video when the judging unit judges that the target backup address does not exist, and feeding back the original playing string of the target video to the target client for playing.

7. The apparatus according to claim 6, wherein the determining unit comprises:

the first judging unit is used for judging whether a backup address corresponding to the target client exists or not;

a second judging unit, configured to judge whether a backup address corresponding to the target video exists when the first judging unit judges that the backup address corresponding to the target client does not exist;

wherein the first determination unit includes:

the second determining unit is used for searching a backup play string of the target video from a position indicated by a backup address corresponding to the target client when the first judging unit judges that the backup address corresponding to the target client exists;

a third determining unit, configured to determine, when the second determining unit determines that the backup address corresponding to the target video exists, the backup address of the target video based on the backup address corresponding to the target video.

8. The apparatus according to claim 7, wherein the backup address corresponding to the target video includes a first backup address and/or a second backup address, and the second determining unit includes:

a third judging unit, configured to judge whether the first backup address exists; when any client cannot play, configuring the backup play string of the target video as the first backup address, and caching the backup play string in a play gateway;

a fourth judging unit, configured to judge whether the second backup address exists when the third judging unit judges that the first backup address does not exist; the second backup address is configured when any client cannot play videos and is used for acquiring addresses of backup play strings of a plurality of videos;

wherein the third determination unit includes:

a third determining subunit, configured to determine, when the third determining unit determines that the first backup address exists, the first backup address cached in the playback gateway as a backup playback string of the target video;

and the searching unit is used for searching the backup play string of the target video from the storage space indicated by the second backup address when the fourth judging unit judges that the second backup address exists.

9. The apparatus of claim 8, wherein the second determining unit comprises:

the deleting unit is used for removing the parameters of the specified type in the request to obtain a backup video request; wherein, at least the identification of the target video is reserved in the backup video request;

and the second determining subunit is configured to forward the request with the parameter removed to a backup playing back end, so as to find out, by the backup playing back end, a backup address corresponding to the target client from a position indicated by the backup address corresponding to the target client.

10. The apparatus of claim 7, further comprising:

the polling unit is used for regularly polling and playing each target data in the operation background through the playing gateway; the target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier;

and the cache unit is used for associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into the playback gateway.

Technical Field

The present application relates to the field of video playing technologies, and in particular, to a method and an apparatus for playing a video.

Background

Although the current video technology has been developed to a higher level, the situation that the video cannot be played normally still occurs due to factors such as file errors and server failures, so how to effectively ensure the normal playing of the video still is an important problem in the field.

In the current video playing mode, when a user requests a video, a client sends a video playing request to a backend to obtain a playing string of the requested video. After receiving the video playing request, the back end finds an original playing string of the video requested to be played according to the video identifier in the video playing request, and feeds the original playing string back to the client for playing. When the video cannot be played normally in the user equipment, the problem needs to be located by technical personnel, and the located video file or server with the problem needs to be maintained correspondingly.

Therefore, in the existing playing mode, technicians need to locate problems and solve the problems, the technicians can normally visit the back end to obtain the video file which can be normally played for playing. However, since the maintenance process is relatively long, there is a problem that the video playing cannot be resumed in time, which seriously affects the user experience.

Disclosure of Invention

Based on the defects of the prior art, the application provides a video playing method and device, so as to solve the problem that the video playing cannot be timely recovered in the prior art.

In order to achieve the above object, the present application provides the following technical solutions:

a first aspect of the present application provides a method for playing a video, including:

receiving a request for acquiring a play string of a target video, which is sent by a target client;

judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video; the backup address corresponding to the target client is an address which is set before the request is received and when the target client cannot play videos and is used for storing a backup play string of any one video; setting a backup address corresponding to the target video before receiving the request and when the target video cannot be normally played;

if the target backup address exists, determining a backup play string of the target video based on the target backup address;

feeding back the backup play string of the target video to the target client for playing;

and if the target backup address does not exist, acquiring the original play string of the target video, and feeding the original play string of the target video back to the target client for playing.

Optionally, in the foregoing method, the determining whether the target backup address exists includes:

judging whether a backup address corresponding to the target client exists or not;

if the backup address corresponding to the target client does not exist, judging whether the backup address corresponding to the target video exists or not;

if the target backup address is determined to exist, determining a backup play string of the target video based on the target backup address, including:

if the backup address corresponding to the target client exists, searching a backup play string of the target video from a position indicated by the backup address corresponding to the target client;

and if the backup address corresponding to the target video exists, determining the backup address of the target video based on the backup address corresponding to the target video.

Optionally, in the foregoing method, the backup address corresponding to the target video includes a first backup address and/or a second backup address, and the determining whether the backup address corresponding to the target video exists includes:

judging whether the first backup address exists or not; when any client cannot play, configuring the backup play string of the target video as the first backup address, and caching the backup play string in a play gateway;

if the first backup address does not exist, judging whether a second backup address exists or not; the second backup address is configured when any client cannot play videos and is used for acquiring addresses of backup play strings of a plurality of videos;

if it is determined that the backup address corresponding to the target video exists, determining the backup address of the target video based on the backup address corresponding to the target video includes:

if the first backup address exists, determining the first backup address cached in the playing gateway as a backup playing string of the target video;

and if the second backup address exists, searching a backup play string of the target video from a storage space indicated by the second backup address.

Optionally, in the foregoing method, the finding out the backup play string of the target video from the position indicated by the backup address corresponding to the target client includes:

removing the parameters of the specified type in the request to obtain a backup video request; wherein, at least the identification of the target video is reserved in the backup video request;

and forwarding the request with the parameters removed to a backup playing back end so as to find out a backup address corresponding to the target client from the position indicated by the backup address corresponding to the target client through the backup playing back end.

Optionally, in the above method, the method further includes:

polling and playing each target data in the operation background at regular time through a playing gateway; the target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier;

and associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into the playback gateway.

A second aspect of the present application provides a video playing apparatus, including:

the receiving unit is used for receiving a request for acquiring a play string of a target video, which is sent by a target client;

the judging unit is used for judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video; the backup address corresponding to the target client is an address which is set before the request is received and when the target client cannot play videos and is used for storing a backup play string of any one video; setting a backup address corresponding to the target video before receiving the request and when the target video cannot be normally played;

the first determining unit is used for determining a backup play string of the target video based on the target backup address when the judging unit judges that the target backup address exists;

the first feedback unit is used for feeding back the backup play string of the target video to the target client for playing;

and the second feedback unit is used for acquiring the original playing string of the target video when the judging unit judges that the target backup address does not exist, and feeding back the original playing string of the target video to the target client for playing.

Optionally, in the above apparatus, the determining unit includes:

the first judging unit is used for judging whether a backup address corresponding to the target client exists or not;

a second judging unit, configured to judge whether a backup address corresponding to the target video exists when the first judging unit judges that the backup address corresponding to the target client does not exist;

wherein the first determination unit includes:

the second determining unit is used for searching a backup play string of the target video from a position indicated by a backup address corresponding to the target client when the first judging unit judges that the backup address corresponding to the target client exists;

a third determining unit, configured to determine, when the second determining unit determines that the backup address corresponding to the target video exists, the backup address of the target video based on the backup address corresponding to the target video.

Optionally, in the above apparatus, the backup address corresponding to the target video includes a first backup address and/or a second backup address, and the second determining unit includes:

a third judging unit, configured to judge whether the first backup address exists; when any client cannot play, configuring the backup play string of the target video as the first backup address, and caching the backup play string in a play gateway;

a fourth judging unit, configured to judge whether the second backup address exists when the third judging unit judges that the first backup address does not exist; the second backup address is configured when any client cannot play videos and is used for acquiring addresses of backup play strings of a plurality of videos;

wherein the third determination unit includes:

a third determining subunit, configured to determine, when the third determining unit determines that the first backup address exists, the first backup address cached in the playback gateway as a backup playback string of the target video;

and the searching unit is used for searching the backup play string of the target video from the storage space indicated by the second backup address when the fourth judging unit judges that the second backup address exists.

Optionally, in the above apparatus, the second determining unit includes:

the deleting unit is used for removing the parameters of the specified type in the request to obtain a backup video request; wherein, at least the identification of the target video is reserved in the backup video request;

and the second determining subunit is configured to forward the request with the parameter removed to a backup playing back end, so as to find out, by the backup playing back end, a backup address corresponding to the target client from a position indicated by the backup address corresponding to the target client.

Optionally, in the above apparatus, further comprising:

the polling unit is used for regularly polling and playing each target data in the operation background through the playing gateway; the target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier;

and the cache unit is used for associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into the playback gateway.

According to the video playing method, before a request currently sent by a target client is received, if the target client cannot play the target video, a target backup address is set. When the target client cannot play the video, setting a backup address corresponding to the target client and used for storing a backup play string of any video; and when the target video cannot be played normally, setting a backup address corresponding to the target video. Therefore, when a request currently sent by the target client is received, if the target backup address is determined to exist, it is indicated that the target client cannot normally acquire the original play string of the target video. At the moment, the backup playing string of the target video is determined based on the target backup address, and the backup playing string of the target video is fed back to the target client side to be played, so that the playing of the video can be quickly recovered no matter the client side has problems and cannot be played normally, and the maintenance of technicians on the problems is not needed.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, 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 structural diagram of a video playing system according to an embodiment of the present application;

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

fig. 3 is a flowchart of a method for determining that a target backup address exists and determining a backup play string according to another embodiment of the present application;

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

fig. 5 is a schematic diagram illustrating a method for searching for a backup playlist based on a backup address corresponding to a target client according to another embodiment of the present application;

fig. 6 is a schematic structural diagram of a video playing apparatus according to another embodiment of the present application;

fig. 7 is a schematic structural diagram of a second determining unit according to another embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.

In this application, 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 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 application provides a video playing method, which aims to solve the problem that video playing cannot be timely recovered in the prior art.

Optionally, in order to implement the method for playing a video provided by the present application, an embodiment of the present application provides a video playing system. As shown in fig. 1, a video playing system provided in an embodiment of the present application includes:

a playing gateway 101, a playing back end 102, a backup playing back end 103, and a playing operation background 104.

The playing gateway 101 is configured to obtain and cache a target backup address generated by the operation background 104, receive a request for obtaining a video playing string sent by the client, and then determine whether to cache the corresponding target backup address, so as to determine whether to feed back an original playing string of the video obtained by the playing back end to the client or to feed back a backup playing string of the video obtained by the backup playing back end 103 to the client.

The playing back end 102 provides a main interface for playing data for the client, and serves for video playing. The method is mainly used for providing playing data to the client through the playing gateway 101 when the video is played normally.

The backup playing back end 103 provides a backup interface for playing data for the client, and is mainly used for providing backup playing data, i.e. providing a backup playing string of the video, to the client through the playing gateway when the video cannot be played normally.

The playing operation background 104 is mainly used for dynamically setting a backup address corresponding to a corresponding video or a backup address corresponding to a client according to a playing failure condition when the playing fails.

Based on the video playing system provided above, another embodiment of the present application provides a video playing method, as shown in fig. 2, including the following steps:

s201, receiving a request for acquiring a play string of a target video, which is sent by a target client.

The play string of the target video refers to an address of a play file storing the target video. And the target video refers to a video requested by a user, and when the user requests the video through the client, the client sends a request for acquiring a play string of the target video to the play gateway.

Optionally, the request usually includes information of the target video, information of the client, and the like. Such as the identification of the target video and the identification of the client.

S202, judging whether a target backup address exists or not; the target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video.

The backup address corresponding to the target client is an address which is set before the current request is received and when the target client cannot play the video and is used for storing the backup play string of any video.

When a problem occurs in the device and user logic processing, the playing server may cause that a particular client cannot normally acquire the playing string of the video from the playing back end and play the video, so that the video cannot be normally played. Therefore, in the embodiment of the present application, when a user feeds back that a client of the user cannot normally play a video, or when it is detected that a certain client cannot normally play a video, a corresponding backup address is set for the client, so that when the client requests to play a video again, a request of the client is directed to the corresponding backup address to obtain a backup play string of the video, thereby recovering a function of the client to normally play the video in time. For example, for an ID: 2dc80, when it can not play video, the playing operation background sets corresponding backup address for it as: "https:// bac. bz. mgtv.com/source", the interface defaults to VIP authority, and the playout gateway can obtain the ID and corresponding backup address of the client and then associate and cache them, such as: "2 dc80- > https:// bac. bz. mgtv. com/source".

And setting the backup address corresponding to the target video before the current request is received and when the target video cannot be normally played. Due to the fact that the video file is in error or cannot be played in error, the target video normally acquired from the playing back end cannot be played, or the target video cannot be normally acquired from the playing back end. Therefore, in the embodiment of the application, when the target video cannot be played normally, the corresponding backup address is set, and when the client requests to play the target video, the backup play string of the target video is fed back to the client based on the backup address, so that the normal play of the target video is restored in time.

It should be noted that the target video that cannot be played normally is divided into two cases, one is a special case of the target video and a case that the target video cannot be played normally, and the other is a case that both the entire client and the video cannot be played normally, and the case also includes the case that the target video cannot be played. The first situation is usually caused by an error in the file of the target video normally acquired, and the second situation is usually caused by a failure in the playback service.

Alternatively, a backup address may be set only for the target video for the first case, thereby avoiding unnecessary work. Specifically, when the target video cannot be normally played in a monitored state or when the target video cannot be normally played after receiving feedback of a plurality of users, a fixed backup address is set for the target video in the playing operation background, so that the normal playing of the target video is timely recovered. And, the backup play string of the target video can be set as the backup address corresponding to the target video. For example, when monitoring or receiving feedback, the video "sister who breaks the wave by riding wind, stage 6" fails to be played, the ID of the video is 10000, and at this time, the corresponding backup address is set for the video as follows: "https:// www.mgtv.com/10000.m3u 8", video ID and backup address can also be associated by the playout gateway and stored as: "10000- > https:// www.mgtv.com/10000.m3u 8".

For the second case, when it is monitored that the whole client cannot play the video, a backup address can be set for a plurality of videos. The backup play string of each video in the plurality of videos can be found according to the backup address, so that the normal play of the plurality of videos can be restored in time. Alternatively, backup addresses may be set for all videos. However, in consideration of the workload and necessity, the backup address may be set only for a part of videos, for example, only for a hot video.

Optionally, after the backup address is set, the backup address may be cached in the playback gateway, so as to determine whether the target backup address exists in time. The specific caching mode comprises the following steps: and regularly polling and playing each target data in the operation background through the playing gateway. The target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier.

And then associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into a playing gateway.

It should be noted that, when it is determined that the target backup address exists, it is determined that the target client needs to acquire the backup play string of the target video to enable the target client to normally play the target video, so step S203 is executed at this time. If it is determined that the target backup address does not exist, step S205 is executed.

S203, determining a backup play string of the target video based on the target backup address.

And the backup play string of the target video is the address of the backup play file of the target video.

Since the target backup address may correspond to a plurality of videos, a backup play string of the target video needs to be determined based on the target backup address.

It should be noted that, if a backup address corresponding to the target client and a backup address corresponding to the target video exist at the same time, the backup play string of the target video may be determined based on the backup address corresponding to the target client, or the backup play string of the target video may be determined based on the backup address corresponding to the target video, and both of the two manners may ensure that the target client plays the target video.

Optionally, since the target backup address includes a backup address corresponding to the target client and/or a backup address corresponding to the target video, an embodiment of steps S202 to S203, as shown in fig. 3, includes:

s301, judging whether a backup address corresponding to the target client exists.

That is to say, in the embodiment of the present application, it is preferentially determined whether a backup address corresponding to a target client exists. Of course, this is only one of the optional execution sequences, and both may be determined at the same time, or it is determined whether a backup address corresponding to the target video exists first.

If it is determined that the backup address corresponding to the target client does not exist, step S302 is performed. If it is determined that the backup address corresponding to the target client exists, step S303 is directly performed.

S302, judging whether a backup address corresponding to the target video exists.

If it is determined that the backup address corresponding to the target video exists, step S304 is executed. If it is determined that the backup address corresponding to the target video does not exist, it indicates that the target backup address does not exist, so step S205 is executed at this time.

S303, finding out the backup play string of the target video from the position indicated by the backup address corresponding to the target client.

S304, determining the backup address of the target video based on the backup address corresponding to the target video.

And S204, feeding back the backup play string of the target video to the target client for playing.

S205, obtaining the original playing string of the target video, and feeding back the original playing string of the target video to the target client for playing.

The original playing string of the target video is the address of the original playing file of the target video, and when the target backup address does not exist, the target client can normally play the target video, so the original playing string of the target video is normally acquired from the playing back end at the moment, and the original playing string of the target video is fed back to the target client for playing.

According to the video playing method provided by the embodiment of the application, when a client cannot play a video, a backup address corresponding to the client is set, and the backup address can be used for obtaining a backup playing string of any one video, so that when the playing string of the target video sent by the client is obtained, the backup playing string of the target video can be determined according to the existing backup address corresponding to the client and fed back to the client, the client can play the video by using the backup playing string, and the video playing function of the client is restored in time. And when the target video cannot be played normally, setting a backup address corresponding to the target video, determining a backup playing string of the target video according to the existing backup address corresponding to the target video, and feeding back the backup playing string to the client, so that the client can play the video by using the backup playing string of the target video and restore the normal playing of the target video in time. Therefore, the video playing method provided by the embodiment of the application can quickly recover the playing of the video no matter the client has a problem and the video cannot be normally played, and does not need to wait for the maintenance of technicians on the problems.

Optionally, another embodiment of the present application provides another video playing method, as shown in fig. 4, including the following steps:

s401, receiving a request for acquiring a play string of a target video sent by a target client.

S402, judging whether a backup address corresponding to the target client exists or not.

The backup address corresponding to the target client is an address which is set when the target client cannot play the video and is used for acquiring the backup play string of any one video. The specific setting process of the backup address corresponding to the target client may refer to the corresponding description in step S202, and is not described herein again.

It should be noted that, in the embodiment of the present application, it is preferentially determined whether a backup address corresponding to the target client exists, and when it is determined that the backup address corresponding to the target client does not exist, step S404 is executed. If it is determined that the backup address corresponding to the target client exists, step S403 is executed.

S403, searching the backup play string of the target video from the position indicated by the backup address corresponding to the target client.

Optionally, an implementation of step S403, as shown in fig. 5, includes the following steps:

s501, removing the parameters of the specified type in the request to obtain the backup video request.

And at least keeping the identification of the target video in the backup video request.

Because the back end can make many business logic judgments according to some attributes of the client, and finally a special play string may be returned, and there may be a situation that the play cannot be performed. It is necessary to remove the parameters related to the device in the request, such as the device name, user credentials, etc., and retain some necessary parameters such as the video ID, etc., so as to convert the request into a generic request, rather than a specific request for the target client, i.e., to exclude specificity.

S502, the request with the parameters removed is forwarded to a backup playing back end, so that a backup address corresponding to the target client is found out from the position indicated by the backup address corresponding to the target client through the backup playing back end.

S404, judging whether a first backup address exists or not.

When any client cannot play, the backup play string of the target video is configured as a first backup address and cached in the play gateway. It should be noted that the first backup address is a backup address set for the target video when the target video cannot be played normally. Since the backup address is set for only one video, the backup play string of the target video can be directly configured as the first backup address. For a more specific setting process, reference may be made to corresponding descriptions in step S202, and details are not described here.

When it is determined that the first backup address exists, step S405 is performed. If it is determined that the first backup address does not exist, step S406 is performed.

S405, determining the first backup address cached in the playing gateway as a backup playing string of the target video.

In the embodiment of the application, the backup play string of the target video is directly configured as the first backup address and is cached in the play gateway, so that the backup play string of the target video determined by the first backup address cached in the play gateway can be directly fed back to the target client, that is, the first backup address is directly fed back to the target client.

S406, judging whether a second backup address exists.

The second backup address is configured when any client cannot play the video, and is used for acquiring addresses of backup play strings of the plurality of videos. It should be noted that the first backup address is a backup address set for a plurality of videos when the entire client cannot play and identify. For a specific setting process, reference may be made to corresponding descriptions in step S202, and details are not described here.

When it is determined that the second backup address exists, step S407 is performed. When it is determined that the second backup address does not exist, since the second backup address is determined last, it is indicated that the target backup address does not exist, so step S408 is performed at this time.

S407, the backup play string of the target video is found out from the storage space indicated by the second backup address.

S408, obtaining the original playing string of the target video, and feeding back the original playing string of the target video to the target client for playing.

And S409, feeding back the backup play string of the target video to the target client for playing.

Another embodiment of the present application provides a video playing apparatus, as shown in fig. 6, including the following units:

the receiving unit 601 is configured to receive a request for acquiring a play string of a target video sent by a target client.

A determining unit 602, configured to determine whether a target backup address exists.

The target backup address comprises a backup address corresponding to the target client and/or a backup address corresponding to the target video. The backup address corresponding to the target client is an address which is set before the current request is received and when the target client cannot play the video and is used for storing the backup play string of any one video. The backup address corresponding to the target video is set before the current request is received and the target video cannot be played normally.

A first determining unit 603, configured to determine a backup play string of the target video based on the target backup address when the determining unit determines that the target backup address exists.

The first feedback unit 604 is configured to feed back the backup play string of the target video to the target client for playing.

The second feedback unit 605 is configured to, when the determining unit determines that the target backup address does not exist, obtain an original play string of the target video, and feed back the original play string of the target video to the target client for playing.

Optionally, in a video playing apparatus provided in another embodiment of the present application, the determining unit includes:

the first judging unit is used for judging whether a backup address corresponding to the target client exists or not.

And the second judging unit is used for judging whether a backup address corresponding to the target video exists or not when the first judging unit judges that the backup address corresponding to the target client does not exist.

It should be noted that, the first determining unit in the embodiment of the present application includes:

and the second determining unit is used for searching the backup play string of the target video from the position indicated by the backup address corresponding to the target client when the first judging unit judges that the backup address corresponding to the target client exists.

And the third determining unit is used for determining the backup address of the target video based on the backup address corresponding to the target video when the second judging unit judges that the backup address corresponding to the target video exists.

Optionally, in a video playing apparatus provided in another embodiment of the present application, a backup address corresponding to a target video includes a first backup address and/or a second backup address, and the second determining unit includes:

and the third judging unit is used for judging whether the first backup address exists or not.

When any client cannot play, the backup play string of the target video is configured as a first backup address and cached in the play gateway.

And the fourth judging unit is used for judging whether the second backup address exists or not when the third judging unit judges that the first backup address does not exist.

The second backup address is configured when any client cannot play the video, and is used for acquiring addresses of backup play strings of the plurality of videos.

Wherein, the third determining unit in this embodiment of the application includes:

and the third determining subunit is configured to determine, when the third determining unit determines that the first backup address exists, the first backup address cached in the playback gateway as the backup playback string of the target video.

And the searching unit is used for searching the backup play string of the target video from the storage space indicated by the second backup address when the fourth judging unit judges that the second backup address exists.

Optionally, in a video playing apparatus provided in another embodiment of the present application, as shown in fig. 7, the second determining unit includes:

a deleting unit 701, configured to remove the specified type of parameter in the request, so as to obtain a backup video request.

And at least keeping the identification of the target video in the backup video request.

The second determining subunit 702 is configured to forward the request with the parameter removed to the backup playing back end, so as to find out, by the backup playing back end, the backup address corresponding to the target client from the position indicated by the backup address corresponding to the target client.

Optionally, in the video playing apparatus provided in another embodiment of the present application, the method further includes:

and the polling unit is used for regularly polling and playing each target data in the operation background through the playing gateway.

The target data comprises a backup address corresponding to the client, a backup address corresponding to the video, a client identifier and a video identifier.

And the cache unit is used for associating the backup address corresponding to the client with the client identifier corresponding to the client, associating the backup address corresponding to the video with the video identifier corresponding to the video, and caching the associated target data into the playback gateway.

It should be noted that the units provided in the above embodiments of the present application may be units in various components in the video playing system shown in fig. 1. And the specific working process of each unit may refer to the corresponding step in the above method embodiment accordingly, which is not described herein again.

Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. 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 application. Thus, the present application 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.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数据上传和接收方法、装置、设备及存储介质

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类