Video playing method, electronic equipment and computer readable medium

Through unified format live broadcast and time-shift url, seamless switching between DASH protocol live broadcast and time-shift mode is achieved, solving the problems of black screen and delay during live broadcast to time-shift, and improving user experience.

CN120021264APending Publication Date: 2025-05-20ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311546771.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-17
Publication Date
2025-05-20

AI Technical Summary

Technical Problem

In the live broadcast to time shift service of the DASH protocol, when the terminal switches the live broadcast mode and time shift mode, it is prone to black screen and switching delay, resulting in poor user experience.

Method used

Through the unified format of live url and target time shift url, the time shift operation in the video playback method is realized, and the live url is directly updated to switch mode, without stopping playback and restarting, ensuring fast and seamless screen switching.

Benefits of technology

It realizes seamless switching between live broadcast mode and time-shift mode, avoids black screen phenomenon and switching delay, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120021264A_ABST
    Figure CN120021264A_ABST
Patent Text Reader

Abstract

The invention provides a video playing method, which comprises the following steps: in response to a time shifting operation instruction of a user, determining a target time shifting uniform resource locator url; wherein the time shifting operation instruction indicates that a video is started to be played from a video picture corresponding to a display timestamp PTS of a target time shifting point, and the target time shifting url points to time shifting relative time npt between the PTS of the target time shifting point and a current system time point of the server; determining an updated live broadcast url according to the target time shift url; and playing the video according to the updated live broadcast url. The invention further provides electronic equipment and a computer readable medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technologies, and particularly to a video playing method, an electronic device, and a computer-readable medium. Background Art

[0002] In the current live-to-time-shift service based on the DASH (Dynamic Adaptive Streaming over HTTP) protocol, the terminal uses the live URL (Uniform Resource Locator) specified by the platform to send a request to the streaming media server, and the server returns a time-shift MPD (Media Presentation Description) file. In some related technologies, to switch from live to time-shift, it is necessary to first stop the live broadcast and then start the time-shift broadcast.

[0003] However, this will cause an obvious black screen phenomenon during the switching process and the switching is relatively slow. The target time-shift time point is calculated based on the current system time of the client. The current system time of the client is not the current live time of the server, and there is also a delay in DASH live broadcast, and the delay will change continuously. Therefore, there will be situations where the pictures of time-shifting at the same time point are inconsistent after dragging multiple times and the pictures of the live broadcast pause and resume playback are not coherent. Summary of the Invention

[0004] Embodiments of the present disclosure provide a video playing method, an electronic device, and a computer-readable medium.

[0005] In a first aspect, embodiments of the present disclosure provide a video playing method, which includes:

[0006] In response to a time-shift operation instruction of a user, determining a target time-shift uniform resource locator URL; wherein, the time-shift operation instruction indicates starting to play a video from the video picture corresponding to the presentation timestamp PTS of the target time-shift point, and the target time-shift URL points to the time-shift relative time npt between the PTS of the target time-shift point and the current system time point of the server;

[0007] Determining an updated live URL according to the target time-shift URL;

[0008] Playing a video according to the updated live URL.

[0009] In a second aspect, embodiments of the present disclosure provide an electronic device, including:

[0010] One or more processors;

[0011] A memory stores one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the video playback method described in the first aspect of the embodiments of the present disclosure.

[0012] In a third aspect, embodiments of the present disclosure provide a computer-readable medium storing a computer program, which, when executed by a processor, implements the video playback method described in the first aspect of the embodiments of the present disclosure.

[0013] The video playback method provided by the embodiments of the present disclosure uses a live URL and a target time-shifted URL in a unified format, so that the target time-shifted URL can be used to update the live URL. When switching between the live mode and the time-shifted mode, there is no need to stop playing and restart, ensuring a fast and seamless switch of the screen, and there is no black screen phenomenon during the switch, improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of an application scenario of a video playback method provided by the embodiments of the present disclosure;

[0015] Figure 2 It is a flowchart of a video playback method provided by the embodiments of the present disclosure;

[0016] Figure 3 It is a flowchart of a specific implementation method of step S1 in the embodiments of the present disclosure;

[0017] Figure 4 It is a schematic diagram of the structure of an electronic device provided by the embodiments of the present disclosure;

[0018] Figure 5 It is a schematic diagram of the structure of a computer-readable medium provided by the embodiments of the present disclosure;

[0019] Figure 6 It is a schematic flowchart of the video playback method corresponding to Embodiment 1 in the embodiments of the present disclosure;

[0020] Figure 7 It is a schematic flowchart of the video playback method for a client corresponding to Embodiment 2 in the embodiments of the present disclosure;

[0021] Figure 8 It is a schematic flowchart of the video playback method for a player corresponding to Embodiment 2 in the embodiments of the present disclosure;

[0022] Figure 9 It is a schematic flowchart of the video playback method for a streaming media server corresponding to Embodiment 2 in the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0023] To enable those skilled in the art to better understand the technical solutions of the present disclosure, the control method, electronic device, and computer-readable medium of the control provided by the present disclosure will be described in detail below with reference to the accompanying drawings.

[0024] In the following, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0025] In the case of no conflict, the various embodiments of the present disclosure and the features in the embodiments may be combined with each other.

[0026] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0027] The terms used herein are only for the purpose of describing particular embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include the plural forms unless the context clearly indicates otherwise. It will also be understood that when the terms "comprises" and / or "consists of" are used in this specification, it specifies the presence of the stated features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0028] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.

[0029] Figure 1 FIG. is a schematic diagram of an application scenario of a video playing method provided for an embodiment of the present disclosure. Refer to Figure 1 , during the video playing process, the client sends a request to the streaming media server to obtain an index file and video fragments. The streaming media server returns the index file and video fragments according to the request of the client. In some embodiments, the player is built into the client, and the present disclosure is not limited thereto. The player is used to perform video rendering according to the received index file and video fragments.

[0030] In some related technologies, the client and the server interact through the DASH protocol. The DASH protocol is a widely used open standard for video streaming. It adopts segmented downloading and adaptive bitrate technologies, and can dynamically adjust the bitrate and resolution of the video according to factors such as network conditions and device performance to achieve a more stable and smooth viewing experience.

[0031] Among them, the DASH protocol divides the video stream into several small segments (i.e., video fragments). The length of each video fragment is usually 2 to 10 seconds, and each video fragment corresponds to multiple versions with different bitrates and resolutions. When the user requests a video, the client sends a request to the server and obtains the corresponding MPD file (i.e., the index file). This file is a description file that describes the content of video broadcasts and on-demand services, and contains information about all available video versions. The client can select the most suitable video version for playback according to its own network conditions and device performance.

[0032] The DASH protocol can provide an efficient, stable, and flexible video streaming transmission solution. On the one hand, through the adaptive bitrate technology, the DASH protocol can dynamically adjust the bitrate and resolution of the video according to factors such as the user's bandwidth and device performance to ensure smooth playback in different network environments. On the other hand, the DASH protocol can also improve the video loading speed and caching effect by dividing the video into several small segments for downloading, and avoid problems such as video stuttering and interruption.

[0033] In addition, since the DASH protocol is an open standard and is transmitted based on the HTTP (Hypertext Transfer Protocol), it can be freely used and implemented, and can also be used on various platforms and devices, including PCs (Personal Computers), mobile phones, tablets, etc.

[0034] Figure 2 This is a flowchart of a video playback method provided by an embodiment of the present disclosure. In a first aspect, referring to Figure 2 , an embodiment of the present disclosure provides a video playback method, including:

[0035] S1. In response to a time-shift operation instruction of a user, determine a target time-shift uniform resource locator (URL); wherein, the time-shift operation instruction indicates starting to play the video from the video frame corresponding to the presentation timestamp (PTS) of the target time-shift point, and the target time-shift URL points to the time-shift relative time (npt) between the PTS of the target time-shift point and the current system time point of the server;

[0036] S2. Determine an updated live URL according to the target time-shift URL;

[0037] S3. Play the video according to the updated live URL.

[0038] In an embodiment of the present disclosure, the video playing method is applied to a client, which may be a client integrated with a player or having a player function module (such as a mobile phone, a tablet, a PC, etc.), or a client capable of interacting with a player. The present disclosure is not limited thereto.

[0039] The time-shifting operation instruction is a moving operation of the current playing time triggered by the user through the client, indicating that the current video starts playing from the video frame corresponding to the PTS of the target time-shifting point. The target time-shifting URL and the live URL are in the same format. Therefore, after determining the target time-shifting URL, the live URL can be updated according to the target time-shifting URL, and the video frame corresponding to the target time-shifting point can be played according to the updated live URL, ensuring that the video frames in the live mode and the time-shifting mode can be switched quickly and seamlessly without a black screen phenomenon during the switching process.

[0040] In some embodiments, the time-shifting operation instruction may be moving the playing time point in the time progress bar corresponding to the video, inputting the playing time point for specifying video playing, clicking on the thumbnail corresponding to the playing time point, and resuming playing after the video is paused, etc. The present disclosure is not limited thereto. The embodiments of the present disclosure do not make special limitations on the way the user triggers the time-shifting operation either. It may be that the user slides the touch screen corresponding to the client to trigger the time-shifting operation, or the user controls the client through other peripherals to trigger the time-shifting operation, etc. The time-shifting relative time npt is the time of the PTS of the target time-shifting point relative to the current system time point of the server. In some embodiments, the time unit of the time-shifting relative time npt is the same as the time unit of the video segment.

[0041] In some related technologies, a URL (Uniform Resource Locator) is a standardized address for locating and retrieving network information, which is a unified locator of Internet resources and can point to web pages, as well as various types of network resources such as images, videos, and downloaded files. In an embodiment of the present disclosure, the target time-shifting URL points to the time-shifting relative time npt between the target time-shifting point and the current system time point of the server, that is, the target time-shifting URL is used to locate a specific time point (i.e., the target time-shifting point).

[0042] Correspondingly, Figure 3 is a specific implementation method flowchart of step S1 in an embodiment of the present disclosure. Referring to Figure 3 , in some embodiments, S1 includes:

[0043] S11. Determine the display timestamp PTS of the target time-shifting point according to the time-shifting operation instruction;

[0044] S12. According to the current playback mode, compare the PTS of the target time-shifted point with the live window corresponding to the current system time point to obtain the npt. The live window is the time range covered by the live index file of the server at the current system time point. The live index file includes multiple video segments. The first boundary value of the live window is the start time of the earliest video segment in the live index file, and the second boundary value of the live window is the end time of the latest video segment in the live index file.

[0045] S13. Add the npt to the live url corresponding to the current system time point to obtain the target time-shifted url.

[0046] In the embodiments of the present disclosure, PTS is the time difference between each video frame and the actual start time of playback, and is used to measure the time when the video segment corresponding to it is decoded and displayed. Therefore, the PTS corresponding to the target time-shifted point is the time when the video frame is actually played according to the target time-shifted point after the time-shift operation instruction is executed. The PTS corresponding to the target time-shifted point is based on the server system clock.

[0047] Compare the PTS of the target time-shifted point with the live window corresponding to the current system time point. Here, the current system time point refers to the time point corresponding to the video frame being live-streamed by the server, and this time point is based on the server's system time. The live window refers to the time range covered by the live index file when the current video is in the live mode. The live index file includes multiple video segments, and these video segments are continuous in time. The first boundary value of the live window is the start time of the earliest video segment in the live index file, and the first boundary value can also be called the left boundary of the live window. The second boundary value of the live window is the end time of the latest video segment in the live index file. In some embodiments, the live index file is an MPD file, and the comparison between the PTS of the target time-shifted point and the live window can be the comparison between the PTS of the target time-shifted point and the first boundary value and the second boundary value.

[0048] In this embodiment, the determination process of the first boundary value and the second boundary value of the live window is related to the playback mode corresponding to the current system time point. The playback mode includes the live mode and the time-shift mode. The live mode means that the video segment being played is any video segment in the live index file, and the time-shift mode means that the video segment being played is earlier than the start time of the earliest video segment in the live index file.

[0049] In some embodiments, in the live mode, the first boundary value (leftTimeMs) of the live window, the second boundary value (rightTimeMs), and the duration (segmentDurationsMs) corresponding to each video segment in the live index file can be directly obtained according to the description in the live index file.

[0050] The time-shift mode means that the video currently being played by the player corresponding to the client is not the content of the video segment corresponding to the live index file. At this time, the index file received by the player is not the live index file but a non-live index file. Therefore, it is necessary to calculate the live index file corresponding to the current system time point according to the non-live index file. Here, the second boundary value (rightTimeMs) is equal to the sum of the start time of the earliest video segment in the non-live index file and the absolute value of the npt value, that is, rightTimeMs = T1 + Math.abs(npt), where T1 is the start time of the earliest video segment in the non-live index file, and Math.abs(npt) is the absolute value of the npt value; the first boundary value (leftTimeMs) is equal to the second boundary value minus the time playback range (timeShiftBufferDepth) covered by all video segments in the live index file, that is, leftTimeMs = rightTimeMs - timeShiftBufferDepth.

[0051] It should be noted that in some embodiments, the video is live, that is, the video is played with post-processing and broadcast simultaneously. Therefore, the value of npt can be negative or zero. A negative value indicates that the target time-shift point is earlier than the current system time point, and zero indicates that the target time-shift point is equal to the current system time point. That is, the operation of moving the current playback time triggered by the user through the client indicates that the current video starts playing earlier than or equal to the current system time point.

[0052] The embodiments of the present disclosure do not make special limitations on the way of adding npt to the live url. In some embodiments, npt is added to the live url by splicing.

[0053] As an example, npt = 21600, and the live url corresponding to the current system time point is:

[0054] "http: / / IP:6910 / CPID / 2 / ChannelID?virtualDomain=CPID.live_hls.zte.com&NeedJITP=1&JITPMediaType=DASH&JITPDRMType=NO";

[0055] After splicing the npt with the live broadcast URL, the obtained target time-shifted URL is:

[0056] "http: / / IP:6910 / CPID / 2 / ChannelID?virtualDomain=CPID.live_hls.zte.com&NeedJITP=1&JITPMediaType=DASH&JITPDRMType=NO&npt=-21600".

[0057] In some embodiments, S11 includes at least one of the following:

[0058] When the time-shifting operation instruction is to move the playback time point in the time progress bar corresponding to the video, the sum of the time-shifting deviation amount generated after the movement and the PTS corresponding to the video frame being played is determined as the PTS of the target time-shifting point;

[0059] When the time-shifting operation instruction is to input the playback time point for specifying the video playback, the playback time point is converted into the first standard time point corresponding to the Coordinated Universal Time (UTC), and the difference between the first standard time point and the server reference time is determined as the PTS of the target time-shifting point;

[0060] When the time-shifting operation instruction is to click the thumbnail corresponding to the playback time point, the PTS corresponding to the thumbnail is determined as the PTS of the target time-shifting point;

[0061] When the time-shifting operation instruction is to resume the playback after the video is paused, the PTS of the video frame when the video is paused is determined as the PTS of the target time-shifting point.

[0062] In the embodiments of the present disclosure, the calculation of the PTS of the target time-shifting point is based on the time standard of the server, that is, the difference between the current Coordinated Universal Time (UTC) time and the reference time (availabilityStartTimeMs) of the server, without using the Electronic Program Guide (EPG) or the local time of the client, ensuring fast and seamless switching of the video frames.

[0063] When the time-shift operation instruction is that the user moves the playback time point in the time progress bar corresponding to the video, the client can directly obtain the time-shift offset of the playback time point moved by the user. It should be noted that the playback time point moved by the user is based on the local system time standard of the client, rather than that of the server. Therefore, the playback time point is not used as the PTS of the target time-shift point, but the sum of the time-shift deviation and the PTS corresponding to the video frame being played on the server is used as the PTS of the target time-shift point. Among them, the time-shift deviation is the width of time, which is the same under different system time standards, and can ensure that there is no picture jump after time-shift.

[0064] When the time-shift operation instruction is to input the playback time point for specifying video playback, the playback time point is converted to UTC time (i.e., the first standard time point), and then the first standard time point is subtracted from the server reference time (availabilityStartTimeMs) to obtain the PTS of the target time-shift point. Among them, the server reference time is a reference point for the server to unify time conversion. The server reference time can be obtained through the index file.

[0065] When the time-shift operation instruction is to click on the thumbnail corresponding to the playback time point, and the thumbnail is a scaled-down image of one of the video frames in the video, and each thumbnail corresponds to picture information, then the time point in the picture information corresponding to the thumbnail is used as the PTS of the target time-shift point.

[0066] When the time-shift operation instruction is that the video resumes playback after pausing, the PTS of the video frame when the video pauses is used as the PTS of the target time-shift point.

[0067] It should be noted that in the embodiments of the present disclosure, the time-shift operation instruction and the calculation process of calculating the PTS of the target time-shift point based on the time-shift operation instruction are not limited to this. The PTS of the target time-shift point is calculated based on the time of the server.

[0068] In some embodiments, S12 includes:

[0069] When the PTS of the target time-shift point is later than the second boundary value, it is determined that the npt is the first value; where the npt being the first value indicates continuing to play the video segment in the live index file corresponding to the current system time point;

[0070] When the PTS of the target time-shift point is later than or equal to the first boundary value and earlier than or equal to the second boundary value, it is determined that the npt is the second value; where the npt being the second value indicates playing the video from the video segment in the live index file corresponding to the target time-shift point;

[0071] When the PTS of the target time-shifted point is earlier than the first boundary value and does not exceed the preset maximum time-shift amount, the difference between the PTS of the target time-shifted point and the second boundary value is determined as the npt;

[0072] When the PTS of the target time-shifted point is earlier than the first boundary value and exceeds the preset maximum time-shift amount, the difference between zero and the preset maximum time-shift amount is determined as the npt.

[0073] In an embodiment of the present disclosure, after the PTS of the target time-shifted point is determined, the PTS of the target time-shifted point is compared with the first boundary value, the second boundary value, and the preset maximum time-shift amount of the live window to determine the npt. In some embodiments, the relative difference between the PTS of the target time-shifted point and the first boundary value is the first difference, and the relative difference between the PTS of the target time-shifted point and the second boundary value is the second difference. The present disclosure does not impose special restrictions on the time length relationship among the first difference, the second difference, and the preset maximum time-shift amount. Among them, the preset maximum time-shift amount is the maximum time-shift amount that the server can support.

[0074] The following describes several cases when comparing the PTS of the target time-shifted point with the first difference, the second difference, and the preset maximum time-shift amount:

[0075] (1) When the PTS of the target time-shifted point is later than the second boundary value, it means that the time-shift operation instruction is to adjust the target time-shifted point to a time point after the latest video frame. At this time, since the video is played live, the time point after the latest video frame cannot be obtained. Therefore, the npt is determined as the first value (for example, npt = 0), that is, it represents playing the video segment in the live index file corresponding to the current system time point (corresponding to the latest video frame).

[0076] In some embodiments, this case may also be that the PTS of the target time-shifted point is later than the second boundary value minus the total time length of the first preset number of video segments, that is, setting a buffer video segment duration for comparing the second boundary to avoid stuttering caused by untimely reception of the next video segment. In addition, usually the second boundary value is within the range of the preset maximum time-shift amount. Therefore, when the target time-shifted point is time-shifted to a later playback time point, it is only necessary to compare the second boundary value.

[0077] Correspondingly, in some embodiments, when the playback mode is the time-shift mode, after determining that the npt is the first value, it further includes:

[0078] Switching the playback mode to the live mode.

[0079] In one example, the current playback mode is the time-shift mode. When the PTS (seekTimeMs) of the target time-shift point is later than the second boundary value (rightTimeMs) minus the total time length of 3 video segments, i.e., seekTimeMs > rightTimeMs - 3 * segmentDurationsMs, at this time, npt = 0, and the PTS of the target time-shift point corresponding to the time-shift operation instruction is adjusted to: seekTimeMs = rightTimeMs - 3 * segmentDurationsMs. That is, the target time-shift url corresponding to this npt indicates playing from the fourth latest video segment. At the same time, the playback mode is switched from the time-shift mode to the live mode.

[0080] In another example, the current playback mode is the live mode. When the PTS (seekTimeMs) of the target time-shift point is later than the second boundary value (rightTimeMs) minus the total time length of 3 video segments, i.e., seekTimeMs > rightTimeMs - 3 * segmentDurationsMs, at this time, npt = 0, and the PTS of the target time-shift point corresponding to the time-shift operation instruction is adjusted to: seekTimeMs = rightTimeMs - 3 * segmentDurationsMs. At this time, that is, the live video does not support time-shifting to a later time point, only supports time-shifting to an earlier time point. If a request for time-shifting to a later time point is encountered, the time-shift operation is not performed and the live broadcast continues, and the playback mode remains unchanged, that is, the live broadcast continues.

[0081] (2) When the PTS of the target time-shift point is later than or equal to the first boundary value and earlier than or equal to the second boundary value, within the time range covered by all video segments in the live index file corresponding to the current system time point (the corresponding latest video frame) (i.e., within the live window), npt is determined to be the second value (for example, npt = 0), which means playing the video from the video segment corresponding to the target time-shift point in the live index file corresponding to the current system time point (the corresponding latest video frame).

[0082] In some embodiments, this situation can also be that the PTS of the target time-shift point is later than or equal to the first boundary value and earlier than the second boundary value minus the total time length of the second preset number of video segments, that is, the comparison of the second boundary sets the buffered video segment duration to avoid stuttering caused by untimely reception of the next video segment.

[0083] Correspondingly, in some embodiments, when the playback mode is the time-shift mode, after determining that npt is the second value, it further includes:

[0084] Switch the playback mode to the live broadcast mode.

[0085] In one example, the current playback mode is the live broadcast mode. When the PTS of the target time-shifted point is later than or equal to the first boundary value and earlier than the second boundary value minus the total time length of 3 video segments, it is:

[0086] seekTimeMs >= leftTimeMs && seekTimeMs < rightTimeMs - 3 * segmentDurationsMs;

[0087] where the PTS of the target time-shifted point is seekTimeMs, the first boundary value is leftTimeMs, the second boundary value is rightTimeMs, the length of each video segment is segmentDurationsMs, and && represents AND.

[0088] At this time, npt = 0, and the PTS of the target time-shifted point corresponding to the time-shifting operation instruction is adjusted to: the video segment corresponding to the target time-shifted point in the live broadcast index file starts playing. That is, the playback mode remains the live broadcast mode, and the live broadcast index file is continued to be used to adjust the played video segments.

[0089] In another example, the current playback mode is the time-shifting mode. When the PTS of the target time-shifted point is later than or equal to the first boundary value and earlier than the second boundary value minus the total time length of 3 video segments, it is:

[0090] seekTimeMs >= leftTimeMs && seekTimeMs < rightTimeMs - 3 * segmentDurationsMs;

[0091] where the PTS of the target time-shifted point is seekTimeMs, the first boundary value is leftTimeMs, the second boundary value is rightTimeMs, the length of each video segment is segmentDurationsMs, and && represents AND. At this time, the target time-shifted url corresponding to this npt indicates to start playing the video segment corresponding to it in the live broadcast index file. At the same time, the playback mode is switched from the time-shifting mode to the live broadcast mode

[0092] (3) When the PTS of the target time-shifted point is earlier than the first boundary value and does not exceed the preset maximum time-shifting amount, the difference between the PTS of the target time-shifted point and the second boundary value is determined as npt. In some embodiments, in this case, npt can also be the difference between the target time-shifted point and the second boundary value, minus the total time length of the third preset number of video segments, to avoid stuttering.

[0093] Correspondingly, in some embodiments, when the playback mode is the live broadcast mode, after determining the difference between the target time shift point and the second boundary value as the npt, the method further includes:

[0094] Switching the playback mode to the time shift mode.

[0095] In one example, when the current playback mode is the live broadcast mode, and the PTS value (seekTimeMs) of the target time shift time is earlier than the first boundary value (leftTimeMs) of the live broadcast window and does not exceed the configured preset maximum time shift amount (maxSupportTimeS), that is:

[0096] seekTimeMs < leftTimeMs && seekTimeMs >= rightTimeMs - maxSupportTimeS * 1000; where && represents "and", then npt = seekTimeMs - rightTimeMs - 3 * segmentDurationsMs. At this time, npt is negative, indicating a time shift from the live broadcast mode to an earlier time point, and the live broadcast mode is switched to the time shift mode.

[0097] In another example, when the current playback mode is the time shift mode, and the PTS value (seekTimeMs) of the target time shift time is earlier than the first boundary value (leftTimeMs) of the live broadcast window and does not exceed the configured preset maximum time shift amount (maxSupportTimeS), that is:

[0098] seekTimeMs < leftTimeMs && seekTimeMs >= rightTimeMs - maxSupportTimeS * 1000; where && represents "and", then npt = seekTimeMs - rightTimeMs - 3 * segmentDurationsMs. At this time, since npt is negative, it indicates that it is not within the time range corresponding to the time shift to the live broadcast index file, and the time shift mode is maintained.

[0099] (4) When the PTS of the target time shift point is earlier than the first boundary value and exceeds the preset maximum time shift amount, determine the difference between zero and the preset maximum time shift amount as npt. It is equivalent to that the target time shift point exceeds the limit point for shifting to an earlier time point. At this time, determine the negative value of the preset maximum time shift amount as npt, that is, reset the target time shift point to the difference between the second boundary value and the preset maximum time shift amount.

[0100] Correspondingly, when the playback mode is the live broadcast mode, after determining the difference between zero and the preset maximum time shift amount as the npt, the method further includes:

[0101] Switch the playback mode to the time-shift mode.

[0102] In one example, the current playback mode is the live mode. If the target time-shift point seekTimeMs exceeds the preset maximum time-shift amount (maxSupportTimeS), seekTimeMs is reset to the second boundary value (rightTimeMs) minus maxSupportTimeS, that is:

[0103] seekTimeMs = rightTimeMs - maxSupportTimeS * 1000; npt = -maxSupportTimeS.

[0104] At this time, switch the playback mode to the time-shift mode.

[0105] In the above embodiments of the present disclosure, the npt value can be determined simultaneously through the live window corresponding to the live index file and the preset maximum time-shift amount. Add npt to the live url corresponding to the current system time point, and the target time-shift url can be obtained. The target time-shift url and the live url are in the same format. Therefore, when the playback mode needs to be switched, the client can directly replace the live url corresponding to the player with the target time-shift url without having to pause the playback and then restart it, ensuring that the screen switches quickly, seamlessly, and without black screen when the playback mode is switched. In addition, the npt added to the target time-shift url in the above embodiments of the present disclosure sets the buffered video segment duration, which can ensure that each time-shift can accurately start playing from the PTS of the target time-shift point, so that the screen is consistent every time it is time-shifted to the same time point, greatly improving the accuracy of time-shift.

[0106] In some embodiments, since the target time-shift url and the live url are in the same format, the video can also be time-shifted to an earlier time point without limitation, expanding the time-shift range, thus facilitating the user to watch earlier videos and enhancing the user experience.

[0107] In some embodiments, S3 includes:

[0108] Send an index file request to the server according to the live url, where the index file request includes the npt;

[0109] Receive the time-shift index file fed back by the server;

[0110] Play the video starting from the video frame corresponding to the PTS of the target time-shift point according to the time-shift index file.

[0111] In an embodiment of the present disclosure, an index file is requested from a server. In some embodiments, before the client sends an index file request to the server, it further includes: if the playback mode needs to be switched, the player pauses rendering the video in the current index file, updates the current rendering time to the target time shift point, cancels the refresh of the current index file and the video segment m4s at the same time, and clears the current video data cache.

[0112] After the server receives the index file request from the client, based on the npt in the index file request and its own current system time point, a time shift index file describing the video segments corresponding to the respective npt is generated and sent to the client. In some embodiments, after the server receives the index file request, starting from the moment corresponding to the sum of the server's current system time point and the npt, 10 consecutive segments are described in the MPD file (i.e., the index file), and the MPD file is sent to the client.

[0113] If the entire time range of the time shift index file sent by the server covers the PTS of the target time shift point, the client can play the video starting from the PTS of the target time shift point according to the time shift index file. In some embodiments, if the PTS of the target time shift point is between the start time of the earliest video segment and the end time of the latest video segment in the time shift index file, the player only decodes but does not render the video frame corresponding to the video segment before the PTS of the target time shift point, and then starts rendering from the video frame corresponding to the video segment after the target time shift point, so as to ensure the precise alignment of the played video frame and the target time shift point.

[0114] In some related technologies, after a user performs a time shift operation, the client changes the live broadcast url to a time shift url according to the specification, stops playing first, and then sends a request to the server; after the server receives the client request, it returns a time shift MPD file to the client, and the file contains all segment descriptions within the currently supported time shift range; after the player parses the time shift MPD file, it requests the corresponding segment from the server according to the target time shift point. In this process, the server only supports a two-hour time shift. After the user drags the progress bar, the target time shift time point is calculated based on the client's system time and the time shift range. The live broadcast is paused first and then resumed for time shift. The client system time when the live broadcast is paused is the target time shift point, and the server returns the corresponding segment, and the player starts playing from the start position of the segment.

[0115] Compared with the above related technologies, in the above embodiments of the present disclosure, the live mode and the time-shift mode adopt URLs in a unified format. When switching the playback mode, there is no need to stop the playback and restart it. Instead, the target time-shift URL is directly updated, which can ensure that the video screen during live broadcast and the video screen during time-shift can be switched quickly and seamlessly without black screen. The NPT spliced in the live URL also undergoes redundancy processing, which can prevent playback jamming problems and ensure that each time-shift can accurately start playing from the target time-shift point, so that the corresponding video screens are the same every time when time-shifted to the same time point, greatly improving the accuracy of time-shifting. In addition, the embodiments of the present disclosure can achieve time-shifting to earlier time points without limitation, and the range of video playback available for time-shifting is larger, thus facilitating users to watch missed video programs.

[0116] In a second aspect, referring to Figure 4 , an embodiment of the present disclosure provides an electronic device, which includes:

[0117] One or more processors 401;

[0118] A memory 402, on which one or more programs are stored. When the one or more programs are executed by the one or more processors, the one or more processors implement the video playback method of any one of the above;

[0119] One or more I / O interfaces 403, connected between the processor and the memory, configured to implement information interaction between the processor and the memory.

[0120] Among them, the processor 401 is a device with data processing capabilities, which includes but is not limited to a central processing unit (CPU), etc.; the memory 402 is a device with data storage capabilities, which includes but is not limited to a random access memory (RAM, more specifically such as SDRAM, DDR, etc.), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory (FLASH); the I / O interface (read-write interface) 403 is connected between the processor 401 and the memory 402 and can implement information interaction between the processor 401 and the memory 402, which includes but is not limited to a data bus (Bus), etc.

[0121] In a third aspect, referring to Figure 5 , an embodiment of the present disclosure provides a computer-readable medium, on which a computer program is stored. When the program is executed by a processor, the above-mentioned any video playback method is implemented.

[0122] In order to enable those skilled in the art to more clearly understand the technical solutions provided by the embodiments of the present disclosure, the technical solutions provided by the embodiments of the present disclosure will be described in detail through specific embodiments below:

[0123] Embodiment 1: Figure 6This is a schematic flowchart of the video playback method corresponding to Embodiment 1 in the present disclosure. Refer to Figure 6 , a player is integrated in the client. When the current playback mode of the video is the live broadcast mode, the user adjusts the played video picture by clicking on the thumbnail corresponding to the playback time point on the client touch screen as follows:

[0124] Step 601, in response to the time shift operation instruction, obtain the PTS value seekTimeMs of the target time shift point.

[0125] Step 602, based on the PTS of the target time shift point, the first boundary value and the second boundary value of the live window, and the preset maximum time shift amount supported by the streaming media server, determine the relative time npt of the time shift, and splice the npt to the end of the live url to obtain the target time shift url. Here, since the PTS of the target time shift point is not within the time range of the current live index file, the live broadcast mode is adjusted to the time shift mode.

[0126] Step 603, pause rendering inside the player, update the current rendering time to the PTS value seekTimeMs of the target time shift point, and at the same time stop the refresh process of the current MPD file and the video segment m4s, and clear the cache.

[0127] Step 604, the player directly replaces and updates the original live url with the target time shift url spliced with npt, and continues to request the corresponding MPD file from the server according to the replaced live url.

[0128] Step 605, after receiving the request, the streaming media server starts from the nearest moment of the server current time point + the relative time npt of the time shift, describes 10 consecutive segments in the MPD file, and sends the MPD file to the client.

[0129] Step 606, the client requests the corresponding video segment based on the PTS value of the target time shift point and the MPD file (i.e., the time shift index file) fed back by the server, and starts playing from the PTS of the target time shift point. At this time, if the PTS of the target time shift point is between the start time of the earliest video segment and the end time of the latest video segment in the time shift index file, the frames before the PTS of the target time shift point are only decoded and not rendered, and rendering starts from the PTS of the target time shift point.

[0130] Embodiment 2: Figure 7 This is a schematic flowchart of the video playback method for the client corresponding to Embodiment 2 in the present disclosure. Refer to Figure 7, the client, the player, and the streaming media server are distributed. When the current playback mode of the video is the live broadcast mode, the user touches the touch screen of the client to move the playback time point in the video playback progress bar. Among them, the video playback method for the client is as follows:

[0131] Step 701, the client obtains the PTS value seekTimeMs of the target time shift point according to the time shift operation instruction.

[0132] Step 702, based on the PTS of the target time shift point, the first boundary value and the second boundary value of the live window, and the preset maximum time shift amount supported by the streaming media server, determine the relative time npt of the time shift.

[0133] Step 703, splice the npt to the end of the live url to obtain the target time shift url.

[0134] Step 704, the client sends the target time shift url and the PTS value seekTimeMs of the target time shift point to the player.

[0135] Figure 8 This is the flowchart of the video playback method for the second embodiment in the embodiments of the present disclosure. Refer to Figure 8 , the video playback method for the player is as follows:

[0136] Step 801, the player internally pauses the rendering of the currently playing video.

[0137] Step 802, the player sets the current rendering time to the PTS of the target time shift point.

[0138] Step 803, the player cancels the refresh of the current MPD file and the shard m4s, and clears the video data cache.

[0139] Step 804, the player replaces the live url with the target time shift url and sends an index file request to the streaming media server to obtain the time shift index file.

[0140] Step 805, the player determines the video shard corresponding to the PTS of the target time shift point in the time shift index file based on the PTS of the target time shift point and the obtained time shift index file, and starts playing from the PTS of the target time shift point.

[0141] Figure 9 This is the flowchart of the video playback method for the second embodiment in the embodiments of the present disclosure. Refer to Figure 9 , the video playback method for the streaming media server is as follows:

[0142] Step 901: The streaming media server receives an index file request from the player, and determines the time-shifted absolute time based on the time-shifted relative time npt in the index file request.

[0143] Step 902: Starting from the time-shifted absolute time, the streaming media server describes 10 consecutive shards in the time-shifted index file, and sends the time-shifted index file to the client.

[0144] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations. In the hardware implementation, the division of the functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component can have multiple functions, or a function or step can be executed by several physical components in cooperation. Some or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, a communication medium typically contains computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium.

[0145] Example embodiments have been disclosed herein, and although specific terms have been employed, they are used for and should be construed solely for general illustrative purposes and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly stated, features, characteristics, and / or elements described in connection with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in connection with other embodiments. Accordingly, those skilled in the art will understand that various forms and details may be changed without departing from the scope of the present disclosure as set forth by the appended claims.

Claims

1. A video playback method, wherein: include: In response to a time-shift operation instruction from a user, a target time-shift uniform resource locator url is determined; wherein the time-shift operation instruction indicates to start playing a video from a video picture corresponding to a display timestamp PTS of a target time-shift point, and the target time-shift url points to a time-shift relative time npt between the PTS of the target time-shift point and a current system time point of a server; Determine an updated live broadcast URL according to the target time-shift URL; Play the video according to the updated live broadcast URL.

2. The video playback method according to claim 1, wherein: The step of determining a target time-shift uniform resource locator (URL) in response to a user's time-shift operation instruction includes: Determine the PTS of the target time-shift point according to the time-shift operation instruction; According to the current playback mode, the PTS of the target time-shift point is compared with the live broadcast window corresponding to the current system time point to obtain the npt, wherein the live broadcast window is the time range covered by the live broadcast index file of the server at the current system time point, the live broadcast index file includes multiple video segments, the first boundary value of the live broadcast window is the start time of the earliest video segment in the live broadcast index file, and the second boundary value of the live broadcast window is the end time of the latest video segment in the live broadcast index file; Add the npt to the live broadcast URL corresponding to the current system time point to obtain the target time-shifted URL.

3. The video playback method according to claim 2, wherein: Determining the PTS of the target time-shift point according to the time-shift operation instruction includes at least one of the following: When the time-shift operation instruction is to move the playback time point in the time progress bar corresponding to the video, the sum of the time-shift deviation amount generated after the movement and the PTS corresponding to the video picture being played is determined as the PTS of the target time-shift point; In the case where the time-shift operation instruction is input for specifying a playback time point of the video playback, the playback time point is converted into a first standard time point corresponding to the world standard time, and the difference between the first standard time point and the server reference time is determined as the PTS of the target time-shift point; In a case where the time-shift operation instruction is to click on a thumbnail corresponding to the playback time point, determining the PTS corresponding to the thumbnail as the PTS of the target time-shift point; In the case where the time-shift operation instruction is to resume playing the video after pausing it, the PTS of the video picture when the video is paused is determined as the PTS of the target time-shift point.

4. The video playback method according to claim 2, wherein: Comparing the PTS of the target time-shift point with the live broadcast window corresponding to the current system time point to obtain the npt, including: In the case where the PTS of the target time-shift point is later than the second boundary value, determining that npt is a first value; wherein npt being the first value represents continuing to play the video segment in the live broadcast index file corresponding to the current system time point; When the PTS of the target time-shift point is later than or equal to the first boundary value and earlier than or equal to the second boundary value, the npt is determined to be a second value; wherein the npt being the second value indicates that the video is played from the video segment corresponding to the target time-shift point in the live broadcast index file; When the PTS of the target time-shift point is earlier than the first boundary value and does not exceed the preset maximum time-shift amount, the difference between the PTS of the target time-shift point and the second boundary value is determined as the npt; When the PTS of the target time-shift point is earlier than the first boundary value and exceeds a preset maximum time-shift amount, the difference between zero and the preset maximum time-shift amount is determined as the npt.

5. The video playback method according to claim 4, wherein: The playback mode includes a live broadcast mode and a time-shift mode; the live broadcast mode means that the video segment being played is any video segment in the live broadcast index file, and the time-shift mode means that the video segment being played is earlier than the start time of the earliest video segment in the live broadcast index file.

6. The video playback method according to claim 5, wherein: In the case where the playback mode is the time-shift mode, after determining that the npt is the first value, or determining that the npt is the second value, the method further includes: The play mode is switched to a live broadcast mode.

7. The video playback method according to claim 5, wherein: In the case where the playback mode is a live broadcast mode, after determining the difference between the PTS of the target time shift point and the second boundary value as the npt, or determining the difference between zero and the preset maximum time shift amount as the npt, the method further includes: The playback mode is switched to a time-shift mode.

8. The video playback method according to claim 5, wherein: Playing the video according to the updated live broadcast URL includes: Sending an index file request to a server according to the live broadcast URL, wherein the index file request includes the npt; Receiving the time-shift index file fed back by the server; The video is played starting from the video picture corresponding to the PTS of the target time-shift point according to the time-shift index file.

9. An electronic device, comprising: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the video playback method according to any one of claims 1 to 8.

10. A computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the video playback method according to any one of claims 1 to 8.