CN109996117B - Method and device for acquiring streaming media playing time - Google Patents

Method and device for acquiring streaming media playing time Download PDF

Info

Publication number
CN109996117B
CN109996117B CN201910159296.4A CN201910159296A CN109996117B CN 109996117 B CN109996117 B CN 109996117B CN 201910159296 A CN201910159296 A CN 201910159296A CN 109996117 B CN109996117 B CN 109996117B
Authority
CN
China
Prior art keywords
time
playing
streaming media
player
system time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910159296.4A
Other languages
Chinese (zh)
Other versions
CN109996117A (en
Inventor
刘玉琦
武兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Hisense Media Network Technology Co Ltd
Original Assignee
Qingdao Hisense Media Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Hisense Media Network Technology Co Ltd filed Critical Qingdao Hisense Media Network Technology Co Ltd
Priority to CN201910159296.4A priority Critical patent/CN109996117B/en
Publication of CN109996117A publication Critical patent/CN109996117A/en
Application granted granted Critical
Publication of CN109996117B publication Critical patent/CN109996117B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44204Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/4424Monitoring of the internal components or processes of the client device, e.g. CPU or memory load, processing speed, timer, counter or percentage of the hard disk space used

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The embodiment of the application relates to the technical field of streaming media playing, in particular to a method and a device for acquiring the playing time of streaming media, which are used for improving the accuracy of acquiring the playing time of streaming media. Acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time, and the second system time is less than the first system time; determining the playing state of the streaming media of the player in a first time period, wherein the first time period is a time interval between the second system time and the first system time; and then, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in the first time period. Therefore, the accuracy of obtaining the actual playing time length can be improved.

Description

Method and device for acquiring streaming media playing time
Technical Field
The embodiment of the application relates to the technical field of streaming media playing, in particular to a method and a device for acquiring the playing time of streaming media.
Background
In the process of streaming media playing, some applications (e.g., YouTube) require a player to quickly and accurately acquire current playing time (current position), but due to the call overhead limitation of a native player and a related interface, the current playing time returned to an upper layer application by the native player has a certain offset from the actual playing time, so that the current playing time acquired by the upper layer application is inaccurate. Especially, when the network environment is poor, the player frequently generates a buffering condition, and the current playing time acquired by the upper layer application is more inaccurate.
In the existing solutions, some smart television manufacturers can calculate the offset of the current playing time by establishing a timer, and although this scheme makes up the problem of time offset to a certain extent, setting the timer increases the operation overhead of the system, and the deviation of the time point for starting the timer can also cause the calculated result to have a certain deviation.
In summary, a solution for acquiring the streaming media playing duration is needed to improve the accuracy of acquiring the streaming media playing duration.
Disclosure of Invention
The embodiment of the application provides a method and a device for acquiring a streaming media playing time length, which are used for improving the accuracy of acquiring the streaming media playing time length.
In a first aspect, an embodiment of the present application provides a method for obtaining a play duration of a streaming media, where the method includes: acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time, and the second system time is less than or equal to the first system time; determining a streaming media playing state of the player in a first time period, wherein the first time period is a time interval between the second system time and the first system time; and then, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period.
In a second aspect, an embodiment of the present application provides an apparatus for acquiring a playing time of a streaming media, which includes an acquiring unit and a processing unit. Wherein: the acquisition unit is used for acquiring a first playing time length updated by the player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time; the second system time is less than or equal to the first system time; the processing unit is used for determining the streaming media playing state of the player in a first time period; determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period; the first time period is a time interval between the second system time and the first system time.
In a third aspect, an embodiment of the present application provides an apparatus for obtaining a streaming media playing time, where the apparatus includes a memory and a processor, where: the memory is to store instructions; the processor to execute the memory-stored instructions, which when executed by the processor, cause the apparatus to: acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time, and the second system time is less than or equal to the first system time; determining a streaming media playing state of the player in a first time period, wherein the first time period is a time interval between the second system time and the first system time; and then, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period.
In a fourth aspect, embodiments of the present application provide a computer storage medium having instructions stored therein, which when executed on a computer, cause the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In the embodiment of the application, the device for acquiring the playing time length of the streaming media acquires the updated first playing time length of the player at the first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time, and the second system time is less than the first system time; determining the playing state of the streaming media of the player in a first time period, wherein the first time period is a time interval between the second system time and the first system time; and then, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in the first time period. Therefore, the first playing time length is considered when determining the actual playing time length of the streaming media, the deviation between the first system time and the second system time and the playing state of the streaming media in the deviation time period are also considered, instead of directly taking the first playing time length as the actual playing time length in the prior art, so that the accuracy of obtaining the actual playing time length can be improved.
Drawings
Fig. 1 is a schematic structural diagram of a streaming media playing system to which an embodiment of the present invention is applicable;
fig. 2 is a flowchart illustrating a method for obtaining a playing duration of a streaming media according to an embodiment of the present application;
fig. 3 is a schematic view of a normal play scene according to an embodiment of the present application;
fig. 4 is a schematic view of an abnormal playing scene according to an embodiment of the present application;
fig. 5 is a schematic diagram of another abnormal playing scene provided in the embodiment of the present application;
fig. 6 is a schematic diagram of another abnormal playing scene provided in the embodiment of the present application;
fig. 7 is a schematic diagram of another abnormal playing scene provided in the embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for acquiring a streaming media playing time length according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of another apparatus for obtaining a playing duration of a streaming media according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, the present application will be further described in detail with reference to the accompanying drawings. The particular methods of operation in the method embodiments may also be applied to apparatus embodiments or system embodiments.
In the process of streaming media playing, some applications (e.g., YouTube) require the player to quickly and accurately obtain the current playing time. For example, in the YouTube 2019 certification process, a test case is used to test the accuracy of the current playing time (i.e., current time) obtained from the docking layer, and this certification requires that the difference between the current playing time obtained from the docking layer and the current playing time to which the video itself is actually played is less than 32 ms.
Fig. 1 schematically illustrates a structural diagram of a streaming media playing system to which an embodiment of the present application is applicable, and as shown in fig. 1, the system includes an application layer 101, a docking layer 102, and a player 103.
The application layer 101 calls a docking layer interface (such as a getCurPosition interface) at intervals to obtain a current playing time of the streaming media, that is, an actual playing time of the streaming media played by the player. For example, the application layer 101 calls the getCurPosition interface every 2ms, and obtains the actual playing time corresponding to the playing streaming media of the player from the docking layer. For example, taking streaming media as a video with a total duration of 60min as an example, when the video is played for 25min, the application layer 101 calls the actual playing duration 25min that the getCurPosition interface can obtain from the docking layer 102.
The docking layer 102 determines the actual playing time of the streaming media according to the playing information of the streaming media updated by the player. There are various ways for the docking layer 102 to obtain the playing information of the streaming media updated by the player. In one implementation, the docking layer 102 may obtain playing information of the streaming media updated by the player 103 at intervals, such as the playing duration of the streaming media updated by the player last time. In another implementation manner, after the player 103 updates the playing information of the streaming media, the playing information of the streaming media updated by the player 103 is sent to the docking layer 102. In another implementation, when the application layer 101 calls the getcurrposition interface, the docking layer 102 obtains the updated playing information of the streaming media from the player 103.
The player 103 is configured to play the streaming media, and the player 103 calls the UpdateInfo interface at intervals to update the buffer value of the played duration of the streaming media, for example, the player 103 calls the UpdateInfo interface every 200ms, so that the player 103 can obtain the following playing information every 200 ms: current playing position (currposition) information, namely the played duration corresponding to the process of playing the streaming media by the player; information of whether to pause (isPaused), i.e. whether the process of playing the streaming media by the player 103 is in a paused state; the system time (update _ sys _ time) is updated, that is, the second system time t2 corresponding to the current play position (currposition) information acquired by the player 103.
In the embodiment of the present application, the playing duration is taken as an example to represent the current playing position of the streaming media, and of course, bytes may also be taken to represent the current playing position of the streaming media, or other information that may represent the current playing position of the streaming media may be used to implement the method provided in the embodiment of the present application, which is not described herein again.
Based on the system architecture of fig. 1, in order to more clearly describe how to implement the method for obtaining the playing time of the streaming media provided by the embodiment of the present application, the following is described in detail with reference to the normal playing scenario shown in fig. 1.
As shown in fig. 1, the player 103 calls the UpdateInfo interface every 200ms, and updates the buffer value of the played duration of the streaming media. The application layer 101 calls the getCurPosition interface every 2ms to obtain the actual playing time of the streaming media from the docking layer 102. In fig. 3-7, the UpdateInfo interface is also called by the player 103 every 200ms, and the getCurPosition interface is called by the application layer 101 every 2ms as an example, which will not be described again in the following.
In fig. 1, the system time when the application layer 101 calls the getCurPosition interface is t2, and when the docking layer 102 receives the call of the application layer 101, the current system time t2 is recorded; before the time t2, the system time when the player 103 updates the playing information of the streaming media for the last time is t1, the current playing position obtained by updating the player is p1, isPaused is 0, and is UnderFlow is also 0, which indicates that the playing state of the streaming media is normal playing.
If t1 is equal to t2, that is, the updated p1 of the player is the actual playing time when the system time is t 1. Therefore, the application layer 101 calls the getCurPosition interface to obtain the actual playing time p1 of the streaming media at the system time t 2.
If t1 is smaller than t2, the docking layer 102 calculates the actual playing time of the streaming media at the system time t2 according to the updated playing information of the streaming media of the underlying player 1.3. The following is a description of the solutions adopted in the present application and in the prior art, respectively:
in the prior art, the docking layer 102 returns the p1 updated by the player when the system time is t1 as the actual playing time length to the application layer 101, and since the playing state between the system time t1 and the system time t2 is normal playing, that is, the playing time length p1 of the player when the system time is t1 and the actual playing time length of the streaming media in the period from the system time t1 to the system time t2 does not stay at p1, the solution in the prior art may cause the actual playing time length acquired by the application layer 103 to be inaccurate.
In order to solve the problems of the solutions in the prior art, in the embodiment of the present application, the docking layer 102 obtains the actual playing time length according to the playing time length p1 of the player at the system time t1 and the played time length of the period between the system time t1 and the system time t 2. Specifically, the actual playing time of the streaming media can be expressed by the following formula (1):
p=curPosition+playbackRate*(t2–t1)……(1)
in the above formula (1), p is the actual playing time length, and the currposition is the played time length of the player at the system time t1, for example, the currposition in fig. 1 is p 1; the playback rate is the player playing rate, and if the player normally plays at a playing rate of 1 × speed, the playback rate is 1; assuming that the play rate is 2 times, the playbackRate is 2; t2 is the system time at which the application layer 101 calls the getCurPosition interface. t1 is the system time when the player 103 last called the UpdateInfo interface.
According to the method for acquiring the playing time of the streaming media, provided by the embodiment of the application, by acquiring the system time t1 of the playing time updated by the bottom player and the system time t2 of the application layer when the actual playing time is acquired, a difference value between t2 and t1 is obtained, an offset compensation is calculated according to the current playing rate and is superposed with the updated playing time of the bottom player, and the effect of quickly and accurately acquiring the current playing time is achieved. It should be noted that the method for obtaining the playing duration of the streaming media provided in the embodiment of the present application is not only applicable to a scenario that the player normally plays in a time period from t1 to t2, but also applicable to a scenario that the player frequently buffers when the network environment is poor, and a fast forward and fast backward (seek) operation scenario, where the seek operation may be a fast forward operation or a fast backward operation.
Based on the foregoing, fig. 2 exemplarily illustrates a method for acquiring a streaming media play duration provided by an embodiment of the present application, where the method is performed by an apparatus for acquiring a streaming media play duration, and as shown in fig. 2, the method includes:
step 201, acquiring a first playing duration updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time.
Here, the second system time may be equal to the first system time, so that it can be determined that the first play time period is the actual play time period. The second system time may also be less than the first system time before steps 202 and 203 are performed.
The first playing duration may be updated by the player calling the UpdateInfo interface any time before the first system time.
For example, the first playing duration is updated by the player calling the UpdateInfo interface last time before the first system time, as shown in fig. 1, the streaming media playing duration updated by the player at the second system time (i.e. t1) is the playing duration of the first system time, the first system time is t2, and taking the playing status of the player in the time period from t1 to t2 as the normal playing status as an example, the first playing duration is the sum of p1 and the playing duration in the first time period (i.e. t1 to t 2). Specifically, the actual playing time of the streaming media can be expressed by the following formula (2):
p=p1+playbackRate*(t2–t1)……(2)
in the above formula (2), p is the actual playing time length, and p1 is the played time length of the player at the system time t 1; playbackRate is the playing rate of the player in the period from t1 to t 2; t2 is the system time at which the application layer 101 calls the getCurPosition interface. t1 is the system time of the last call by the player 103 to the UpdateInfo interface before the system time t 2.
For another example, the first playing duration is updated by calling the UpdateInfo interface by the player the last nth time before the first system time, where N is an integer greater than 1. As shown in fig. 3, for a schematic diagram of a normal play scene provided by the present application, taking N equal to 2 as an example, the played time length of the streaming media updated by the player at the second system time (i.e., t3) is p2, the first system time is t2, and taking the play state of the player in the time period from t3 to t2 as an example of a normal play state, the first play time length is the sum of p2 and the play time length in the first time period (i.e., t3 to t 2). Specifically, the actual playing time of the streaming media can be expressed by the following formula (3):
p=p2+playbackRate*(t2–t3)……(3)
in the above formula (3), p is the actual playing time length, and p2 is the played time length of the player at the system time t 3; playbackRate is the player playing rate; t2 is the system time at which the application layer 101 calls the getCurPosition interface. t1 is the system time at which the player 103 calls the UpdateInfo interface the penultimate time before the system time t 2.
Of course, in the scenario shown in fig. 3, N may also be equal to 1 as an example to determine the actual playing time length of the streaming media, that is, the first playing time length is updated by the player calling the UpdateInfo interface last 1 time before the first system time.
Step 202, determining the playing state of the streaming media in a first time period; the first time period is a time interval between the second system time and the first system time.
The first time period is the time interval from t1 to t2, as explained in conjunction with fig. 1 above. The first time period is the time interval from t3 to t2, as explained in conjunction with fig. 3 above.
Step 203, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in the first time period.
Wherein, the streaming media playing state of the player can be represented in the following way: if isPaused is 1 or isUnderFlow is 1, i.e. currently in play pause state (pause) or buffering state (undersflow); if isPaused is 0 and isunflow is 0, i.e. currently in normal play state.
With the embodiment shown in fig. 2, the apparatus for obtaining a playing time length of a streaming media obtains a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time, and the second system time is less than the first system time; determining the playing state of the streaming media of the player in a first time period, wherein the first time period is a time interval between the second system time and the first system time; and then, determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in the first time period. Therefore, the first playing time length is considered when determining the actual playing time length of the streaming media, the deviation between the first system time and the second system time and the playing state of the streaming media in the deviation time period are also considered, instead of directly taking the first playing time length as the actual playing time length in the prior art, so that the accuracy of obtaining the actual playing time length can be improved.
In the step 202, there may be multiple streaming media playing states, where the streaming media playing states of the player in the first time period are different, and the manner of determining the actual playing duration of the streaming media in the first system time through the step 205 is also different. The following cases will be separately described.
In case one, the streaming media playing state of the player in the first time period is a normal playing state.
In this case, the embodiment of the present application provides a way to implement step 205 as described above: and if the playing state of the streaming media in the first time period is determined to be a normal playing state, determining the actual playing time of the streaming media in the first system time to be the sum of the first playing time and the second playing time. The second playing time length is the product of the playing speed and the time length corresponding to the first time length.
By the method, the accuracy of acquiring the actual playing time length can be improved under the condition that the player is in the normal playing state.
In case two, the streaming media playing state of the player in the first time period is as follows: the seek operation is not executed in the first time period, and the playback pause state is in the second time period, wherein the second time period is any time interval in the first time period.
In this case, the embodiment of the present application provides a way to implement step 205 as described above: if it is determined that the player is in the play pause state in the second time period and the seek operation is not executed in the first time period, the actual play time of the streaming media in the first system time is the sum of the first play time and the third play time. The second time period is any time interval in the first time period, and the third playing time length is the product of the playing speed and the time length difference; the time length difference is the difference between the time length corresponding to the first time period and the time length corresponding to the second time period.
Fig. 4 schematically illustrates an abnormal playing scene provided by an embodiment of the present application.
As shown in fig. 4, the application layer 101 calls the getCurPosition interface at the first system time t2, the player 103 calls the UpdateInfo interface at the second system time t3, the first time period is the time interval from t3 to t2, and the player is in the play pause state during the second time period (e.g., the time interval from t4 to t5 in fig. 4), as shown in fig. 4, isPaused is 1 or isUnderFlow is 1. Specifically, the player is in a normal playing state from the second system time t3 to the system time t4, the player is in a playing pause state from the system time t4 to the system time t5 due to insufficient underlying data or decoding pause, and the underlying data is sufficient from the system time t5, so that the player is in a normal playing state again from the system time t5 to the first system time t2, that is, the player is in a normal playing state in the first time period except for the second time period (the duration of the time period is the duration difference). Then, the actual playing time length is the sum of the first playing time length and the third playing time length played within the time length difference. Referring to fig. 4, the actual playing time period p can be expressed by the following formula (4):
p=p2+playbackRate*[(t2–t3)-(t5-t4)]……(4)
in the above formula (4), p is the actual playing time length, and p2 is the played time length of the player at the system time t 3; playbackRate is the player playing rate; t2 is the first system time at which the application layer 101 calls the getCurPosition interface. t4 is the system time when the player starts to be in the play pause state, and t5 is the system time when the player starts to be in the normal play state.
It should be noted that, in the second case, the actual playing time length may also be determined according to the playing state of the player in the time interval between the latest updated system time of the player and the first system time, and the first playing time length, and details are not repeated.
By the method, for the scene in the play pause state of the player, the second system time updated by the player is not directly used as the actual play time of the player as in the prior art, so that the accuracy of obtaining the actual play time of the player can be improved.
And in case three, the streaming media playing state of the player in the first time period is as follows: and the player executes seek operation at a third system time and is in a playing pause state within a third time period, wherein the third time period is a time interval between the third system time and the first system time.
In this case, the embodiment of the present application provides a way to implement step 205 as described above: if the seek operation is executed at the third system time and the player is in the playing pause state in the third time period, determining the actual playing time length of the streaming media at the first system time as a fourth playing time length; wherein the seek operation is used to adjust the played time length of the streaming media to the fourth playing time length.
Fig. 5 schematically illustrates another abnormal playing scene provided in an embodiment of the present application.
As shown in fig. 5, the application layer 101 calls the getCurPosition interface at the first system time t2, and the player 103 calls the UpdateInfo interface at the second system time t3, i.e. the first time period is the time interval from t3 to t 2. When the seek operation is performed at the third system time tseek, the playing duration of the player is dragged to st, and then in the time interval from the second system time t3 to the third system time tseek, the player is in a pause playing state because there is not enough underlying data yet, and the user can visually see that the player is in the data buffer until there is enough underlying data to continue playing. That is, if there is not enough data up to the first system time t2, the third time period (t)seekTo t2) the underlying player has insufficient data, the actual playing time duration of the player is st.
And in case four, the playing state of the streaming media in the first time period by the player is as follows: the player performs a seek operation at a third system time and the player is in a play pause state for a fourth period of time.
In this case, the embodiment of the present application provides a way to implement step 205 as described above: if it is determined that seek operation is executed at a third system time, the player is in a play pause state within a fourth time period, and the player is in a normal play state within a fifth time period, determining that an actual play time of the streaming media at the first system time is a sum of the fourth play time and a fifth play time;
and the fifth playing time length is the product of the playing speed and the time length corresponding to the fifth time period.
Based on fig. 5, fig. 6 exemplarily shows another abnormal playing scene schematic diagram provided by the embodiment of the present application.
As shown in fig. 6, the application layer 101 calls the getCurPosition interface at the first system time t2, and the player 103 calls the UpdateInfo interface at the second system time t3, i.e. the first time period is the time interval from t3 to t 2. When the seek operation is performed at the third system time tseek, and the playing time length of the player is dragged to the fourth playing time length st, in the time interval from the second system time t3 to the third system time tseek, the player is in a pause playing state because there is not enough underlying data yet, and the user can visually see that the player is in the data buffer until there is enough underlying data to continue playing. If there is enough data from the system time t4, the player is in the normal play state during the fifth time period (i.e., the time interval from t4 to t2), and the actual play time period of the player is the sum of the fourth play time period st and the fifth play time period during the time interval from t4 to t 2. The actual play-out time period p can be expressed by the following equation (5):
p=st+playbackRate*(t2–t4)……(5)
in the formula (5), p is the actual playing time length, and st is the played time length reached by the player executing seek operation at the system time tseek; playbackRate is the player playing rate; t2 is the system time at which the application layer 101 calls the getCurPosition interface. t4 is the system time at which the player 103 starts normal play after seek operation.
Based on the above four cases, a specific callback interface may be further added to the player 101, where the callback interface is used to notify the upper layer of the state of the player in the bottom layer in time, for example, when the player is in the buffer state, the callback interface notifies the docking layer 102 of the buffer state of the player, so that the docking layer 102 accurately obtains the actual playing duration when the buffer state occurs by calculating the time difference compensation value.
In an example, when the application layer executes a Seek operation, such as Seek to time st, the current playing time length is updated to be st, and at this time, if isunflow in the information returned by the underlying player is 1, that is, at this time, the underlying data is insufficient, the application layer is in an under flow state. In this process, the current playing time acquired by the getCurPosition interface of the application layer is the time point of the application to be Seek, referring to the third case, that is, the actual playing time length is st. And after the bottom layer data is enough, starting playing, wherein the isUnderFlow updated through the UpdateInfo is 0, and referring to the fourth case, the actual playing time length acquired by the application layer at this time is formula (5).
In another example, during normal playing, if the network environment is poor, during normal playing of the application layer, it may happen that the data of the underlying player (player) is insufficient, resulting in that the player is in an Under Flow state, and a video display download (loading) screen cannot continue playing, at this time, the underlying player returns isunflow to 1 through a separate callback interface, see fig. 7, and the system time when the underlying player returns to the Under Flow state is t 4; the system time for updating the play time p2 of the bottom player before the occurrence of the Under Flow state is t3, that is, the player is in the normal play state in the period from the system time t3 to t4, and the player is in the buffer state in the period from the system time t4 to t2, so that when the getCurPosition is frequently called by the upper layer, the obtained actual play time is referred to the following formula (6):
p=p2+playRate*(t4–t3)……(6)
in the above formula (6), p is the actual playing duration, and playbackRate is the playing rate of the player; t2 is the system time at which the application layer 101 calls the getCurPosition interface. t4 is the system time at which the player 103 starts to be in the buffer state.
Through the embodiment, when the actual playing time length of the streaming media is determined, not only the first playing time length, but also the deviation between the first system time and the second system time and the playing state of the streaming media in the deviation time period are considered, rather than directly taking the first playing time length as the actual playing time length as in the prior art, so that the accuracy of obtaining the actual playing time length can be improved.
Based on the same conception, fig. 8 illustrates a schematic structural diagram of an apparatus for acquiring a streaming media playing time length according to an embodiment of the present application, and as shown in fig. 8, this apparatus 800 may be used to implement any of the schemes shown in fig. 2. The apparatus 800 comprises an acquisition unit 801 and a processing unit 802.
An obtaining unit 801, configured to obtain a first playing duration updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time; the second system time is less than the first system time;
a processing unit 802, configured to determine a streaming media playing state of the player in a first time period; determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period; the first time period is a time interval between the second system time and the first system time.
In an optional implementation manner, the processing unit 802 is specifically configured to: if the streaming media playing state of the player in a first time period is determined to be a normal playing state, determining that the actual playing time of the streaming media in the first system time is the sum of the first playing time and a second playing time; the second playing time length is the product of the playing speed and the time length corresponding to the first time period.
In an optional implementation manner, the processing unit 802 is specifically configured to: if it is determined that the player is in a play pause state in a second time period and the seek operation is not executed in the first time period, the actual play time of the streaming media in the first system time is the sum of the first play time and a third play time; wherein the second time period is any time interval in the first time period; the third playing time length is the product of the playing speed and the time length difference; the time length difference is the difference between the time length corresponding to the first time period and the time length corresponding to the second time period.
In an optional implementation manner, the processing unit 802 is specifically configured to: if it is determined that seek operation is executed at a third system time and the player is in a play pause state within a third time period, determining that the actual play time of the streaming media at the first system time is the fourth play time; wherein the seek operation is used to adjust the played time length of the streaming media to a fourth playing time length; the third time period is a time interval between the third system time and the first system time.
In an optional implementation manner, the processing unit 802 is specifically configured to: if it is determined that seek operation is executed at a third system time, and the player is in a play pause state within a fourth time period and in a normal play state within a fifth time period, determining that an actual play time of the streaming media at the first system time is a sum of the fourth play time and a fifth play time; and the fifth playing time length is the product of the playing speed and the time length corresponding to the fifth time period.
It should be understood that the above division of the units is only a division of logical functions, and the actual implementation may be wholly or partially integrated into one physical entity, or may be physically separated. In this embodiment of the application, the obtaining unit 801 and the processing unit 802 may be implemented by the processor 903 in fig. 9 described below.
Based on the same conception, fig. 9 schematically illustrates a structural schematic diagram of another apparatus for acquiring a streaming media playing time length according to an embodiment of the present application, and as shown in fig. 9, the apparatus 900 may be configured to perform any one of the schemes shown in fig. 2. The apparatus 900 includes a memory 902 and a processor 903.
Memory 902 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory 902 may also comprise a combination of the above-described types of memory.
The processor 903 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP. The processor 903 may further comprise a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof. Optionally, the memory 902 and the processor 903 may be integrated.
Optionally, the memory 902 may be used for storing program instructions, and the processor 903 may call the instructions stored in the memory 902, may execute one or more steps in the embodiment shown in the above scheme (such as the method shown in fig. 2), or an optional implementation thereof, so that the apparatus 900 implements the function of the above method for obtaining the streaming media playing time length apparatus.
A processor 903 to execute the memory-stored instructions, which when executed by the processor 903, causes the apparatus 900 to:
acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time; the second system time is less than the first system time; determining the streaming media playing state of the player in a first time period; determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period; the first time period is a time interval between the second system time and the first system time.
In an alternative implementation, the processor 903 is specifically configured to cause the apparatus to perform the following operations: if the streaming media playing state of the player in a first time period is determined to be a normal playing state, determining that the actual playing time of the streaming media in the first system time is the sum of the first playing time and a second playing time; the second playing time length is the product of the playing speed and the time length corresponding to the first time period.
In an alternative implementation, the processor 903 is specifically configured to cause the apparatus to perform the following operations: if it is determined that the player is in a play pause state in a second time period and the seek operation is not executed in the first time period, the actual play time of the streaming media in the first system time is the sum of the first play time and a third play time; wherein the second time period is any time interval in the first time period; the third playing time length is the product of the playing speed and the time length difference; the time length difference is the difference between the time length corresponding to the first time period and the time length corresponding to the second time period.
In an alternative implementation, the processor 903 is specifically configured to cause the apparatus to perform the following operations: if it is determined that seek operation is executed at a third system time and the player is in a play pause state within a third time period, determining that the actual play time of the streaming media at the first system time is the fourth play time; wherein the seek operation is used to adjust the played time length of the streaming media to a fourth playing time length; the third time period is a time interval between the third system time and the first system time.
In an alternative implementation, the processor 903 is specifically configured to cause the apparatus to perform the following operations: if it is determined that seek operation is executed at a third system time, and the player is in a play pause state within a fourth time period and in a normal play state within a fifth time period, determining that an actual play time of the streaming media at the first system time is a sum of the fourth play time and a fifth play time; and the fifth playing time length is the product of the playing speed and the time length corresponding to the fifth time period.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any combination thereof, and when the implementation is realized by a software program, all or part of the implementation may be realized in the form of a computer program product. The computer program product includes one or more instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The instructions may be stored in a computer storage medium or transmitted from one computer storage medium to another, e.g., from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optics, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer storage media may be any available media that can be accessed by a computer or a data storage device, such as a server, data center, etc., that incorporates one or more available media. The usable medium may be a magnetic medium (e.g., a flexible Disk, a hard Disk, a magnetic tape, a magneto-optical Disk (MO), etc.), an optical medium (e.g., a CD, a DVD, a BD, an HVD, etc.), or a semiconductor medium (e.g., a ROM, an EPROM, an EEPROM, a nonvolatile memory (NAND FLASH), a Solid State Disk (SSD)), etc.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by instructions. These instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.

Claims (10)

1. A method for obtaining a playing duration of a streaming media is characterized by comprising the following steps:
acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time; the second system time is less than the first system time;
determining the streaming media playing state of the player in a first time period; the first time period is a time interval between the second system time and the first system time;
and determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period.
2. The method of claim 1, wherein the determining the actual playing time duration of the streaming media at the first system time according to the first playing time duration and the playing state of the streaming media of the player in the first time period comprises:
if the streaming media playing state of the player in a first time period is determined to be a normal playing state, determining that the actual playing time of the streaming media in the first system time is the sum of the first playing time and a second playing time; the second playing time length is the product of the playing speed and the time length corresponding to the first time period.
3. The method of claim 1, wherein the determining the actual playing time duration of the streaming media at the first system time according to the first playing time duration and the playing state of the streaming media of the player in the first time period comprises:
if it is determined that the player is in a play pause state in a second time period and the seek operation is not executed in the first time period, the actual play time of the streaming media in the first system time is the sum of the first play time and a third play time;
wherein the second time period is any time interval in the first time period; the third playing time length is the product of the playing speed and the time length difference; the time length difference is the difference between the time length corresponding to the first time period and the time length corresponding to the second time period.
4. The method of claim 1, wherein the determining the actual playing time duration of the streaming media at the first system time according to the first playing time duration and the playing state of the streaming media of the player in the first time period comprises:
if it is determined that the fast forward/fast reverse seek operation is executed at the third system time and the player is in the play pause state within the third time period, determining that the actual play time of the streaming media at the first system time is a fourth play time;
wherein the third system time is greater than the second system time and less than the first system time; the seek operation is used for adjusting the played time length of the streaming media to a fourth playing time length; the third time period is a time interval between the third system time and the first system time.
5. The method of claim 1, wherein the determining the actual playing time duration of the streaming media at the first system time according to the first playing time duration and the playing state of the streaming media of the player in the first time period comprises:
if it is determined that seek operation is executed at a third system time, the player is in a play pause state within a fourth time period, and the player is in a normal play state within a fifth time period, determining that an actual play time of the streaming media at the first system time is a sum of a fourth play time and a fifth play time; the fourth playing time length is the played time length which is reached when the player executes the seek operation at the third system time;
wherein the seek operation is used to adjust the played time length of the streaming media to the fourth playing time length; the third system time is the system time for starting to execute the seek operation, the fourth time period is the time interval between the third system time and the system time for starting normal playing after executing the seek operation, and the fifth time period is the time interval between the system time for starting normal playing after executing the seek operation and the first system time; the third system time is greater than the second system time and less than the first system time; the fifth playing time length is the product of the playing speed and the time length corresponding to the fifth time period.
6. An apparatus for acquiring a streaming media playing time length, comprising a memory and a processor;
the memory is to store instructions;
the processor is to execute the memory-stored instructions, which when executed by the processor, cause the apparatus to:
acquiring a first playing time length updated by a player at a first system time; the first playing time length is the time length of the stream media which is updated by the player in the second system time; the second system time is less than the first system time;
determining the streaming media playing state of the player in a first time period; determining the actual playing time length of the streaming media in the first system time according to the first playing time length and the streaming media playing state of the player in a first time period; the first time period is a time interval between the second system time and the first system time.
7. The apparatus for obtaining a streaming media play-out time as recited in claim 6, wherein the processor is specifically configured to cause the apparatus to:
if the streaming media playing state of the player in a first time period is determined to be a normal playing state, determining that the actual playing time of the streaming media in the first system time is the sum of the first playing time and a second playing time; the second playing time length is the product of the playing speed and the time length corresponding to the first time period.
8. The apparatus for obtaining a streaming media play-out time as recited in claim 6, wherein the processor is specifically configured to cause the apparatus to:
if it is determined that the player is in a play pause state in a second time period and the fast forward/fast rewind seek operation is not executed in the first time period, the actual play time of the streaming media in the first system time is the sum of the first play time and a third play time;
wherein the second time period is any time interval in the first time period; the third playing time length is the product of the playing speed and the time length difference; the time length difference is the difference between the time length corresponding to the first time period and the time length corresponding to the second time period.
9. The apparatus for obtaining a streaming media play-out time as recited in claim 6, wherein the processor is specifically configured to cause the apparatus to:
if it is determined that seek operation is executed at a third system time and the player is in a play pause state within a third time period, determining that the actual play time of the streaming media at the first system time is a fourth play time;
wherein the third system time is greater than the second system time and less than the first system time; the seek operation is used for adjusting the played time length of the streaming media to the fourth playing time length; the third time period is a time interval between the third system time and the first system time.
10. The apparatus for obtaining a streaming media play-out time as recited in claim 6, wherein the processor is specifically configured to cause the apparatus to:
if it is determined that seek operation is executed at a third system time, and the player is in a play pause state within a fourth time period and in a normal play state within a fifth time period, determining that an actual play time of the streaming media at the first system time is the sum of a fourth play time and a fifth play time; the fourth playing time length is the played time length which is reached when the player executes the seek operation at the third system time;
the third system time is the system time for starting to execute the seek operation, and the seek operation is used for adjusting the played time length of the streaming media to the fourth playing time length; the fourth time period is a time interval between the third system time and the system time for starting normal playing after the seek operation is executed, and the fifth time period is a time interval between the system time for starting normal playing after the seek operation is executed and the first system time; the third system time is greater than the second system time and less than the first system time; the fifth playing time length is the product of the playing speed and the time length corresponding to the fifth time period.
CN201910159296.4A 2019-03-04 2019-03-04 Method and device for acquiring streaming media playing time Active CN109996117B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910159296.4A CN109996117B (en) 2019-03-04 2019-03-04 Method and device for acquiring streaming media playing time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910159296.4A CN109996117B (en) 2019-03-04 2019-03-04 Method and device for acquiring streaming media playing time

Publications (2)

Publication Number Publication Date
CN109996117A CN109996117A (en) 2019-07-09
CN109996117B true CN109996117B (en) 2021-08-24

Family

ID=67129275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910159296.4A Active CN109996117B (en) 2019-03-04 2019-03-04 Method and device for acquiring streaming media playing time

Country Status (1)

Country Link
CN (1) CN109996117B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112995762A (en) * 2019-12-02 2021-06-18 海信视像科技股份有限公司 Display device and network state synchronization method
CN110933384A (en) * 2019-12-17 2020-03-27 深圳爱克莱特科技股份有限公司 Offline play synchronous control device and control method of LED play system
CN114173195B (en) * 2021-12-10 2024-04-12 聚好看科技股份有限公司 Display equipment and method for counting effective playing time of media assets
CN114339397B (en) * 2021-12-23 2023-08-11 北京百度网讯科技有限公司 Method, device, equipment and storage medium for determining multimedia editing information

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7412371B2 (en) * 2004-06-08 2008-08-12 Northrop Grumman Corporation Time synchronized playback and control of dissimilar data files
US20090249222A1 (en) * 2008-03-25 2009-10-01 Square Products Corporation System and method for simultaneous media presentation
CN101436915B (en) * 2008-12-12 2012-04-18 中兴通讯股份有限公司 Method and apparatus for receiving and playing multimedia program by mobile terminal
US20150071043A1 (en) * 2012-05-07 2015-03-12 convex corporation, ltd. Relative Clock Time Display Device and Relative Clock Time Display Program
TWI507022B (en) * 2012-12-05 2015-11-01 Ind Tech Res Inst Buffer output method for multimedia stream and multimedia stream buffer module
CN104702563B (en) * 2013-12-06 2019-09-03 乐视网信息技术(北京)股份有限公司 The acquisition methods and device of streaming media playing duration
KR101600891B1 (en) * 2014-10-17 2016-03-09 쿨사인 주식회사 Synchronization method and system for audio and video of a plurality terminal
CN105763949A (en) * 2014-12-18 2016-07-13 乐视移动智能信息技术(北京)有限公司 Audio video file playing method and device
CN106658227B (en) * 2015-10-29 2020-01-21 阿里巴巴集团控股有限公司 Method and device for compressing video playing length
CN105653456B (en) * 2015-12-31 2018-09-11 网易(杭州)网络有限公司 Application program capacity test method, device and system
CN106599165B (en) * 2016-12-08 2020-01-31 腾讯科技(深圳)有限公司 content recommendation method and server based on playing behavior
CN107608651A (en) * 2017-07-19 2018-01-19 肇庆市广应科通用航空研究院 Player fast forwarding and fast rewinding control method, system, storage medium and intelligent terminal

Also Published As

Publication number Publication date
CN109996117A (en) 2019-07-09

Similar Documents

Publication Publication Date Title
CN109996117B (en) Method and device for acquiring streaming media playing time
CN109688473B (en) Multi-video playing method, storage medium and computer equipment
CN108966012B (en) Video playing rate determining method and device and electronic equipment
CN108076377B (en) Video storage and playing method and device, electronic equipment and storage medium
RU2627039C1 (en) Method and device for visual presentation of preliminary data downloading
CN108076317B (en) Video data storage method and system, video access method and node
CN111436004B (en) Video playing method, device and equipment and computer readable storage medium
CN106534952A (en) Method for continuingly playing film source after source switching and smart television
CN113424553A (en) Techniques for facilitating playback of interactive media items in response to user selections
US20240155171A1 (en) Methods and systems for managing content quality in a storage medium
CN114501134B (en) iOS cross-page video playing method, device, equipment and storage medium
CN108632552A (en) Recording device, control method and storage medium
US10674188B2 (en) Playback apparatus, method of controlling playback apparatus, playback method and server apparatus
US8937780B2 (en) Error recovery procedure (ERP) using estimated best setting in first run
CN111372117B (en) Video playing method and device, electronic equipment and storage medium
JP4325194B2 (en) Apparatus and method for managing access to storage medium
CN110971857B (en) Video playback method and device and computer readable storage medium
CN110113389A (en) A kind of video broadcasting method, device, electronic equipment and storage medium
CN112689165B (en) Video playing method and device
KR20100135727A (en) Method and apparatus for recording digital multimedia based on buffering states of the multimedia service
CN109819310B (en) Streaming media data playing method and device
CN106328174A (en) Method and device for processing recording data
US20200145470A1 (en) Method and apparatus for playing media file
CN109426589B (en) File repair method and device
CN108345431A (en) A kind of method and device of digital independent

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant