Disclosure of Invention
The embodiment of the application provides a method, a device and a system for determining the watching duration of a user, and can solve the problem that the live broadcasting watching duration recorded by a server is not accurate enough due to the fact that a third-party program maliciously modifies the time of a terminal. The technical scheme is as follows:
in one aspect, a method for determining a live viewing time duration is provided, where the method includes:
when the trigger operation of joining the target live broadcast room is detected, a joining request corresponding to the target live broadcast room is sent to a server;
receiving and playing the live broadcast video stream of the target live broadcast room sent by the server, and sending a watching notification to the server according to a preset period;
and when the triggering operation of exiting the target live broadcast room is detected, sending an exiting notification corresponding to the target live broadcast room to the server, and exiting the target live broadcast room.
Optionally, in the process of receiving and playing the live video stream of the target live broadcast room, sending a viewing notification to the server according to a preset period includes:
in the process of receiving and playing the live broadcast video stream of the target live broadcast room, determining a first time length for playing the live broadcast video stream of the target live broadcast room when a preset period is reached, determining a notification sequence identifier corresponding to the current period, and sending a watching notification carrying the first time length and the notification sequence identifier to the server;
when the trigger operation of quitting the target live broadcast room is detected, the step of sending a quit notification corresponding to the target live broadcast room to the server comprises the following steps:
when the trigger operation of exiting the target live broadcast room is detected, determining a second time length for playing the live broadcast video stream of the target live broadcast room, determining a current notification sequence identifier based on a notification sequence identifier in a watching notification sent last time, and sending an exiting notification carrying the second time length and the current notification sequence identifier to the server.
In another aspect, a method for determining a user viewing duration is provided, the method comprising:
receiving a joining request corresponding to the target live broadcast room sent by a terminal, joining a login account of the terminal into the target live broadcast room, and sending a live broadcast video stream of the target live broadcast room to the terminal;
receiving a watching notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room;
when receiving an exit notification sent by the terminal, determining the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the exit notification;
and when no other watching notification or quit notification is received within a preset time after the watching notification is received, determining the live watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last.
Optionally, the watching notification carries a first duration and a notification sequence identifier, and the quitting notification carries a second duration and a notification sequence identifier;
determining the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the quitting notification, wherein the determining comprises the following steps:
determining live broadcast watching time length based on the second time length, the notification sequence identification in the quit notification, the period and a third time length between the receiving time of the joining request and the receiving time of the quit notification;
determining a live broadcast watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last comprises the following steps:
and determining the live broadcast watching time length based on the first time length, the notification sequence identifier in the watching notification, the period and a fourth time length between the receiving time of the joining request and the receiving time of the watching notification received last.
Optionally, the determining a live broadcast watching duration based on the second duration, the notification sequence identifier in the exit notification, the period, and a third duration between the receiving time of the join request and the receiving time of the exit notification includes:
determining a first product of a notification order identification in the exit notification and the period;
if the absolute value of the difference between the first product and the second time length is smaller than the period, and the absolute value of the difference between the second time length and the third time length is smaller than a preset threshold, determining the second time length as a live broadcast watching time length;
and if the absolute value of the difference between the first product and the second time length is greater than the period, or the absolute value of the difference between the second time length and the third time length is greater than a preset threshold, determining the third time length as the live broadcast watching time length.
Optionally, the determining, based on the first duration, the notification sequence identifier in the viewing notification, the period, and a fourth duration between the receiving time of the join request and the receiving time of the last received viewing notification, a live viewing duration includes:
determining a second product of a notification order identification in the viewing notification and the period;
if the absolute value of the difference between the second product and the fourth time length is smaller than the period, and the absolute value of the difference between the first time length and the fourth time length is smaller than the preset threshold, determining the first time length as the live broadcast watching time length;
and if the absolute value of the difference between the second product and the fourth time length is greater than the period, or the absolute value of the difference between the first time length and the fourth time length is greater than the preset threshold, determining the fourth time length as the live broadcast watching time length.
In another aspect, an apparatus for determining a live viewing duration is provided, the apparatus including:
the device comprises a first sending module, a second sending module and a third sending module, wherein the first sending module is configured to send a joining request corresponding to a target live broadcast room to a server when a triggering operation of joining the target live broadcast room is detected;
the second sending module is configured to receive and play the live video stream of the target live broadcast room sent by the server, and send a watching notification to the server according to a preset period;
and the third sending module is configured to send a quit notification corresponding to the target live broadcast room to the server and quit the target live broadcast room when the triggering operation of quitting the target live broadcast room is detected.
Optionally, the second sending module is configured to:
in the process of receiving and playing the live broadcast video stream of the target live broadcast room, determining a first time length for playing the live broadcast video stream of the target live broadcast room when a preset period is reached, determining a notification sequence identifier corresponding to the current period, and sending a watching notification carrying the first time length and the notification sequence identifier to the server;
the third sending module configured to:
when the trigger operation of exiting the target live broadcast room is detected, determining a second time length for playing the live broadcast video stream of the target live broadcast room, determining a current notification sequence identifier based on a notification sequence identifier in a watching notification sent last time, and sending an exiting notification carrying the second time length and the current notification sequence identifier to the server.
In another aspect, an apparatus for determining a viewing duration of a user is provided, the apparatus comprising:
the first receiving module is configured to receive a joining request which is sent by a terminal and corresponds to the target live broadcast room, join a login account of the terminal into the target live broadcast room, and send a live broadcast video stream of the target live broadcast room to the terminal;
the second receiving module is configured to receive a watching notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room;
the first determination module is configured to determine live broadcast watching time length based on the receiving time of the joining request and the receiving time of the quitting notification when the quitting notification sent by the terminal is received;
a second determination module configured to determine a viewing live time period based on a reception time of the join request and a reception time of a last received viewing notification when no other viewing notification or exit notification is received within a preset time period after the viewing notification is received.
Optionally, the watching notification carries a first duration and a notification sequence identifier, and the quitting notification carries a second duration and a notification sequence identifier;
the first determination module configured to:
determining live broadcast watching time length based on the second time length, the notification sequence identification in the quit notification, the period and a third time length between the receiving time of the joining request and the receiving time of the quit notification;
the second determination module configured to:
and determining the live broadcast watching time length based on the first time length, the notification sequence identifier in the watching notification, the period and a fourth time length between the receiving time of the joining request and the receiving time of the watching notification received last.
Optionally, the first determining module is configured to:
determining a first product of a notification order identification in the exit notification and the period;
if the absolute value of the difference between the first product and the second time length is smaller than the period, and the absolute value of the difference between the second time length and the third time length is smaller than a preset threshold, determining the second time length as a live broadcast watching time length;
and if the absolute value of the difference between the first product and the second time length is greater than the period, or the absolute value of the difference between the second time length and the third time length is greater than a preset threshold, determining the third time length as the live broadcast watching time length.
Optionally, the second determining module is configured to:
determining a second product of a notification order identification in the viewing notification and the period;
if the absolute value of the difference between the second product and the fourth time length is smaller than the period, and the absolute value of the difference between the first time length and the fourth time length is smaller than the preset threshold, determining the first time length as the live broadcast watching time length;
and if the absolute value of the difference between the second product and the fourth time length is greater than the period, or the absolute value of the difference between the first time length and the fourth time length is greater than the preset threshold, determining the fourth time length as the live broadcast watching time length.
In another aspect, a system for determining a viewing duration of a user is provided, where the system includes a terminal and a server, and where:
the terminal sends a joining request corresponding to the target live broadcast room to the server when detecting a triggering operation of joining the target live broadcast room; receiving and playing the live broadcast video stream of the target live broadcast room sent by the server, and sending a watching notification to the server according to a preset period; and when the triggering operation of exiting the target live broadcast room is detected, sending an exiting notification corresponding to the target live broadcast room to the server, and exiting the target live broadcast room.
The server receives a joining request corresponding to the target live broadcast room sent by the terminal, joins a login account of the terminal to the target live broadcast room, and sends a live broadcast video stream of the target live broadcast room to the terminal; receiving a watching notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room; when receiving an exit notification sent by the terminal, determining the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the exit notification; and when no other watching notification or quit notification is received within a preset time after the watching notification is received, determining the live watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last.
In yet another aspect, a computer device is provided and includes a processor and a memory, where at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for determining a viewing live time length as described above.
In yet another aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the method for determining the viewing live time length as described above.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
the method comprises the steps that a watching notice is sent to a server according to a preset period all the time in the process of playing a live video of an anchor broadcast through a terminal, an exit notice is sent to the server when the live video exits from a live broadcast room of the anchor broadcast, the server can record the time of receiving the watching notice and the exit notice each time, then the time for watching the live broadcast by a user is determined through the receiving time of receiving the watching notice or the exit notice, the time provided by the terminal is not needed, therefore, the time for a third-party program to modify the terminal maliciously can be prevented, and the accuracy of the time for the server to record the time for the user to watch the live broadcast is improved.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The method for acquiring the live broadcast watching time length of the user can be realized by the terminal and the server together. The terminal can operate the application that has the live function, and the terminal can possess parts such as microphone, earphone, speaker, camera, and the terminal has communication function, can insert the internet, and the terminal can be cell-phone, panel computer, intelligent wearing equipment, desktop computer, notebook computer etc.. The server can be a background server of the application program, and the server can be communicated with the terminal. The server may be a single server or a server group, and if the server is a single server, the server may be responsible for all processing in the following scheme, and if the server is a server group, different servers in the server group may be respectively responsible for different processing in the following scheme, and the specific processing allocation condition may be arbitrarily set by a technician according to actual needs, and is not described herein again.
Watching live is now a very common way of entertainment. The anchor and the user can apply for accounts in the network live broadcast platform, and log the accounts in corresponding live broadcast application programs at the terminal. The anchor can gather own live broadcast video through equipment such as the camera of terminal, microphone to upload the live broadcast video to the server. The user can log in own account in the live broadcast application program, and can click a live broadcast room corresponding to a live broadcast in the live broadcast application program, and then the server sends the live broadcast video of the live broadcast to a terminal logged in by the live broadcast account according to the account of the current live broadcast room for watching the live broadcast. The user can then watch the live video of the anchor through the terminal. In addition, the live broadcast platform can also calculate the live time of each account for watching the anchor live broadcast, and the intimacy between the anchor and the user can be increased by calculating the time, so that the interaction between the anchor and the user is increased. The method and the device for determining the watching duration of the user can judge the watching duration preventing the user from modifying the report through the third-party malicious program, and can calculate the watching duration of the user watching the live broadcast of the anchor broadcast more accurately. The method for acquiring the live broadcast watching time length of the user can accurately acquire the live broadcast watching time length of the user each time,
fig. 1 is a flowchart of a method for determining a live viewing time length according to an embodiment of the present application. This embodiment can be used for watching a terminal of a main broadcast, and referring to fig. 1, the embodiment includes:
step 101, when detecting a trigger operation of joining a target live broadcast room, sending a joining request corresponding to the target live broadcast room to a server.
And 102, receiving and playing a live video stream of a target live broadcast room sent by a server, and sending a watching notification to the server according to a preset period.
And 103, when detecting the triggering operation of exiting the target live broadcast room, sending an exiting notification corresponding to the target live broadcast room to the server, and exiting the target live broadcast room.
Fig. 2 is a flowchart of a method for determining a live viewing time length according to an embodiment of the present application. This embodiment may be used for the server corresponding to the terminal, and referring to fig. 2, the embodiment includes:
step 201, receiving a join request of a corresponding target live broadcast room sent by a terminal, joining a login account of the terminal into the target live broadcast room, and sending a live broadcast video stream of the target live broadcast room to the terminal.
Step 202, receiving a watching notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room.
And step 203, when receiving the quit notification sent by the terminal, determining the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the quit notification.
And step 204, when no other watching notification or quit notification is received within the preset time after the watching notification is received, determining the live watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last.
Fig. 3 is a flowchart of a method for determining a live viewing time duration according to an embodiment of the present application. In this embodiment, referring to fig. 1, the interaction between a terminal for watching a main broadcast and a corresponding server includes:
step 301, when the terminal detects the trigger operation of joining the target live broadcast room, sending a joining request corresponding to the target live broadcast room to the server.
In implementation, a user can operate the terminal to open a live application program and log in an account of the user, and a live room cover of a plurality of live anchor programs can be displayed in the live application program. The trigger operation of joining the target live broadcast room can be that a user selects and clicks one of the anchor live broadcast room covers, or clicks a corresponding live broadcast room entering control in a live broadcast application program. When detecting a trigger operation of a user for joining the target live broadcast room, the terminal may send a joining request corresponding to the target live broadcast room to the server, where the joining request carries an account identifier of the user. In addition, when the terminal sends the join request to the server, a random identifier can be randomly generated and carried in the join request to be sent to the server. And then the server sends the data information of the target live broadcast room to a terminal of the user, and the user can watch the anchor live broadcast in the corresponding live broadcast room.
Step 302, the server adds the login account of the terminal into the target live broadcast room.
In implementation, when the server receives a join request sent by the terminal, the server may join the corresponding account in the anchor live broadcast room according to the account identifier carried in the join request and the account identifier corresponding to the anchor, and may correspondingly record the account identifier, the random identifier and the time when the join request is received according to the account identifier and the random identifier carried in the join request. The account is different in random identification when entering the live broadcast room every time, and the random identification can be used for distinguishing that a user enters the same live broadcast room for multiple times.
And step 303, the server sends the live video stream of the target live broadcast room to the terminal.
After the server adds the login account of the terminal into the target live broadcast room, the live broadcast video stream of the anchor live broadcast room can be sent to the terminal logged in by the corresponding account.
And step 304, the terminal sends a watching notice to the server according to a preset period.
In implementation, the terminal may receive a live video stream of a target live broadcast room sent by the server, and play the live video stream. When the terminal plays the live broadcast video stream of the target live broadcast room, a watching notification can be sent to the server according to a preset period so as to remind the server that the account currently logged in by the terminal is still watching the main broadcast live broadcast in the current live broadcast room.
Optionally, in the process of receiving and playing the live video stream of the target live broadcast room, when a preset period is reached, a first time length for playing the live video stream of the target live broadcast room is determined, a notification sequence identifier corresponding to the current period is determined, and a viewing notification carrying the first time length and the notification sequence identifier is sent to the server.
In implementation, in the process of receiving and playing the live video stream of the target live broadcast room, when a preset period is reached, the terminal watching the anchor live broadcast can calculate a first time length of the live video stream of the target live broadcast room, and the first time length can be determined by a difference value between the time when the terminal sends the join request and the time when the terminal sends the watching notification currently. In addition, a notification sequence identifier corresponding to the current period can be determined, and the sequence identifier can be a number, namely the number of times that the terminal sends the watching notification to the server in the process of playing the live video stream of the target live broadcast room. And then, carrying the determined first time length and the notification sequence identifier in the viewing notification, and sending the viewing notification to the server. Correspondingly, the server may receive a viewing notification sent by the terminal of the user according to a preset period. In addition, the time of receiving the viewing notification sent by the user terminal, the account identifier and the random identifier can be correspondingly recorded.
And 305, when detecting the triggering operation of exiting the target live broadcast room, the terminal sends an exiting notification corresponding to the target live broadcast room to the server, and exits the target live broadcast room.
In implementation, when the user does not watch the live broadcast of the anchor, the user can click a corresponding control for exiting the live broadcast room, or trigger a return control of the terminal to exit the target live broadcast room. When the terminal detects that the user exits the triggering operation of the target live broadcast room, an exit notification corresponding to the target live broadcast room can be sent to the server, the exit notification can carry an account identifier of the current login terminal of the user and a random identifier generated by the terminal and used for the user to watch live broadcast, and the exit notification can be used for notifying the server that the corresponding account exits the target live broadcast room.
Optionally, when detecting a trigger operation of exiting the target live broadcast room, determining a second time length for playing a live broadcast video stream of the target live broadcast room, determining a current notification sequence identifier based on a notification sequence identifier in the viewing notification sent last time, and sending an exit notification carrying the second time length and the current notification sequence identifier to the server.
In implementation, when the terminal detects that the user exits the trigger operation of the target live broadcast room, a total second duration for watching the target live broadcast by the current account may be determined. The second duration may be determined by a difference between a time when the terminal starts to transmit the join request and a time when the terminal transmits the exit notification. In addition, a notification sequence identifier corresponding to the quit notification may also be determined, where the notification sequence identifier corresponding to the quit notification may be obtained by accumulating the notification sequence identifiers carried in the viewing notification that is sent by the terminal to the server last time. For example, before the terminal sends the quit notification to the server, the notification sequence identifier carried in the last watching notification sent is 100, and then the notification sequence identifier carried in the quit notification sent by the terminal to the server may be 101. And then the terminal carries the determined second time length and the notification sequence identifier corresponding to the quit notification in the quit notification and sends the quit notification to the server.
Step 306, the server determines the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the quitting notification.
In implementation, when the server receives a quit notification sent by the user terminal, it can be determined that the user quits from the corresponding live broadcast room according to the account identifier of the user and the account identifier of the anchor broadcast carried in the quit notification of the user, and the time when the quit notification is received is recorded. And then calculating the live broadcast watching duration of the user according to the moment of receiving the quit notification and the moment of receiving the joining time.
Optionally, the duration of the user watching the live broadcast may be determined according to the second duration and the notification sequence identifier carried in the exit notification. The corresponding processing may be as follows: the exit notification carries a second duration and a notification sequence identifier; and determining the live broadcast watching time length based on the second time length, the notification sequence identification and the period in the quit notification and a third time length between the receiving time of the joining request and the receiving time of the quit notification.
In implementation, the quit notification may carry a second time length and a notification sequence identifier, where the second time length is a time for the terminal to calculate and watch the anchor live broadcast, and the notification sequence identifier carried in the quit notification is obtained by accumulating the notification sequence identifiers carried in the last time the terminal sends the watching notification. The rough watching duration of the user watching the live broadcast can be obtained by multiplying the notification sequence identifier carried in the exit notification by the preset sending period. And the third time length is the time length of the user watching the live broadcast of the anchor broadcast, which is calculated by the server through the receiving time of the joining request and the receiving time of the quitting notification.
Optionally, whether the viewing duration uploaded by the terminal is abnormal or not may be verified through the viewing duration obtained by the server, the calculated rough viewing duration and the third duration, and the corresponding processing is as follows: determining a first product of the notification order identification and the period in the exit notification; if the absolute value of the difference between the first product and the second time length is less than the period, and the absolute value of the difference between the second time length and the third time length is less than a preset threshold, determining the second time length as the live broadcast watching time length; and if the absolute value of the difference between the first product and the second time length is greater than the period, or the absolute value of the difference between the second time length and the third time length is greater than a preset threshold, determining the third time length as the live broadcast watching time length.
In implementation, a general third-party malicious program can modify the time of the terminal so as to modify the live broadcast watching time uploaded by the terminal, but cannot directly modify the watching notification sent each time by the terminal or the notification sequence identifier carried in the quit notification, so that a first product can be obtained by multiplying the notification sequence identifier in the quit notification by a preset sending period, and the first product is the rough watching time of the user. If the absolute value of the difference between the rough watching time length of the user and the watching time length uploaded by the terminal, namely the second time length, is less than the preset period, the time length uploaded by the terminal is not abnormal, and the second time length uploaded by the terminal can be used as the time length of the live broadcast watched by the user. And if the absolute value of the difference between the rough watching time length of the user and the watching time length uploaded by the terminal is greater than a preset period, or the absolute value of the difference between the watching time length uploaded by the terminal and the third time length calculated by the server is greater than a preset threshold, determining the third time length calculated by the server as the live watching time length of the user.
And 307, when the server does not receive other watching notifications or quit notifications within the preset time after receiving the watching notifications, determining the live watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last.
In implementation, the terminal of the user may not be able to view the live broadcast due to sudden network disconnection, power failure, termination of the live broadcast application, and the like, and the terminal may not be able to send a corresponding viewing notification or quit notification to the server. Therefore, within the preset time length after receiving the watching notification each time, if no other watching notification or quit notification is received again, the server can think that the user does not watch the anchor live broadcast any more or cannot watch the anchor live broadcast continuously, and the time length for watching the anchor live broadcast by the user can be calculated according to the receiving time of the joining request and the receiving time of the watching notification received at last.
Optionally, the viewing notification carries a first duration and a notification sequence identifier, and the live viewing duration may be determined based on the first duration, the notification sequence identifier and the period in the viewing notification, and a fourth duration between the receiving time of the join request and the receiving time of the last received viewing notification.
In implementation, the first duration and the notification sequence identifier may be carried in the last viewing notification of the server. The first duration is duration for the terminal to calculate and watch the anchor live broadcast. The server can obtain a rough watching duration by watching the notification sequence identifier in the notification and the preset sending period. The fourth time length is the live broadcast watching time length calculated by the server according to the receiving time of the joining request and the receiving time of the watching notification received at last.
Optionally, when the quit notification sent by the terminal is not received, whether the first duration is abnormal may be verified according to the fourth duration and the rough trial production, and the corresponding processing may be as follows: determining a second product of the notification order identification and the period in the viewing notification; if the absolute value of the difference between the second product and the fourth time length is smaller than the period, and the absolute value of the difference between the first time length and the fourth time length is smaller than a preset threshold, determining the first time length as the live broadcast watching time length; and if the absolute value of the difference between the second product and the fourth time length is greater than the period, or the absolute value of the difference between the first time length and the fourth time length is greater than a preset threshold, determining the fourth time length as the live broadcast watching time length.
In implementation, if the absolute value of the difference between the rough watching duration of the user and the watching duration uploaded by the terminal, that is, the first duration, is less than the preset period, the duration uploaded by the terminal is not an abnormal duration, and the first duration uploaded by the terminal can be used as the duration for the user to watch live broadcast. And if the absolute value of the difference between the rough watching time length of the user and the watching time length uploaded by the terminal is greater than a preset period, or the absolute value of the difference between the watching time length uploaded by the terminal and the fourth time length calculated by the server is greater than a preset threshold, determining the fourth time length calculated by the server as the live watching time length of the user.
According to the method and the device, the watching notice is sent to the server according to the preset period all the time in the process of playing the live video of the anchor broadcast through the terminal, the quitting notice is sent to the server when the live broadcast room of the anchor broadcast quits, the server can record the time of receiving the watching notice and the quitting notice each time, then the time of watching the live broadcast by the user is determined through the receiving time of receiving the watching notice or the quitting notice, the time provided by the terminal is not needed, therefore, the time of maliciously modifying the terminal by a third-party program can be prevented, and the accuracy of the time of watching the live broadcast by the user is improved through recording of the server.
All the above optional technical solutions may be combined arbitrarily to form the optional embodiments of the present disclosure, and are not described herein again.
Fig. 4 is a schematic structural diagram of an apparatus for determining a live broadcast viewing time according to an embodiment of the present application, where the apparatus may be a terminal in the foregoing embodiment. As shown in fig. 4, the apparatus includes:
afirst sending module 410, configured to send, to a server, a join request corresponding to a target live broadcast room when a trigger operation of joining the target live broadcast room is detected;
asecond sending module 420, configured to receive and play a live video stream of the target live broadcast room sent by the server, and send a viewing notification to the server according to a preset period;
athird sending module 430, configured to send, when detecting a trigger operation of exiting a target live broadcast room, an exit notification corresponding to the target live broadcast room to the server, and exit the target live broadcast room.
Optionally, thesecond sending module 420 is configured to:
in the process of receiving and playing the live broadcast video stream of the target live broadcast room, determining a first time length for playing the live broadcast video stream of the target live broadcast room when a preset period is reached, determining a notification sequence identifier corresponding to the current period, and sending a watching notification carrying the first time length and the notification sequence identifier to the server;
thethird sending module 430 is configured to:
when the trigger operation of exiting the target live broadcast room is detected, determining a second time length for playing the live broadcast video stream of the target live broadcast room, determining a current notification sequence identifier based on a notification sequence identifier in a watching notification sent last time, and sending an exiting notification carrying the second time length and the current notification sequence identifier to the server.
Fig. 5 is a schematic structural diagram of an apparatus for determining a live viewing time according to an embodiment of the present application, where the apparatus may be a server according to the foregoing embodiment. As shown in fig. 5, the apparatus includes:
afirst receiving module 510, configured to receive a join request sent by a terminal and corresponding to the target live broadcast room, join a login account of the terminal into the target live broadcast room, and send a live broadcast video stream of the target live broadcast room to the terminal;
asecond receiving module 520, configured to receive a viewing notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room;
a first determiningmodule 530, configured to determine a live broadcast watching time length based on a receiving time of the join request and a receiving time of the quit notification when the quit notification sent by the terminal is received;
a second determiningmodule 540 configured to determine a viewing live time period based on a reception time of the join request and a reception time of a last received viewing notification when no other viewing notification or no exit notification is received within a preset time period after the viewing notification is received.
Optionally, the watching notification carries a first duration and a notification sequence identifier, and the quitting notification carries a second duration and a notification sequence identifier;
the first determiningmodule 530 configured to:
determining live broadcast watching time length based on the second time length, the notification sequence identification in the quit notification, the period and a third time length between the receiving time of the joining request and the receiving time of the quit notification;
the second determiningmodule 540, configured to:
and determining the live broadcast watching time length based on the first time length, the notification sequence identifier in the watching notification, the period and a fourth time length between the receiving time of the joining request and the receiving time of the watching notification received last.
Optionally, the first determiningmodule 530 is configured to:
determining a first product of a notification order identification in the exit notification and the period;
if the absolute value of the difference between the first product and the second time length is smaller than the period, and the absolute value of the difference between the second time length and the third time length is smaller than a preset threshold, determining the second time length as a live broadcast watching time length;
and if the absolute value of the difference between the first product and the second time length is greater than the period, or the absolute value of the difference between the second time length and the third time length is greater than a preset threshold, determining the third time length as the live broadcast watching time length.
Optionally, the second determiningmodule 540 is configured to:
determining a second product of a notification order identification in the viewing notification and the period;
if the absolute value of the difference between the second product and the fourth time length is smaller than the period, and the absolute value of the difference between the first time length and the fourth time length is smaller than the preset threshold, determining the first time length as the live broadcast watching time length;
and if the absolute value of the difference between the second product and the fourth time length is greater than the period, or the absolute value of the difference between the first time length and the fourth time length is greater than the preset threshold, determining the fourth time length as the live broadcast watching time length.
It should be noted that: in the apparatus for determining a live broadcast watching time length provided in the foregoing embodiment, when determining the live broadcast watching time length, only the division of the functional modules is used as an example, in practical applications, the function distribution may be completed by different functional modules according to needs, that is, an internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the apparatus for determining live broadcast watching time duration and the method for determining live broadcast watching time duration provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
The embodiment of the present application further provides a system for determining a viewing duration of a user, where the system includes a terminal and a server, where:
the terminal sends a joining request corresponding to the target live broadcast room to the server when detecting a triggering operation of joining the target live broadcast room; receiving and playing the live broadcast video stream of the target live broadcast room sent by the server, and sending a watching notification to the server according to a preset period; and when the triggering operation of exiting the target live broadcast room is detected, sending an exiting notification corresponding to the target live broadcast room to the server, and exiting the target live broadcast room.
The server receives a joining request corresponding to the target live broadcast room sent by the terminal, joins a login account of the terminal to the target live broadcast room, and sends a live broadcast video stream of the target live broadcast room to the terminal; receiving a watching notification sent by the terminal according to a preset period in the process of playing the live video stream of the target live broadcast room; when receiving an exit notification sent by the terminal, determining the live broadcast watching time length based on the receiving time of the joining request and the receiving time of the exit notification; and when no other watching notification or quit notification is received within a preset time after the watching notification is received, determining the live watching time length based on the receiving time of the joining request and the receiving time of the watching notification received last.
Fig. 6 shows a block diagram of a terminal 600 according to an exemplary embodiment of the present application. The terminal 600 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The terminal 600 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
In general, the terminal 600 includes: aprocessor 601 and amemory 602.
Theprocessor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. Theprocessor 601 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). Theprocessor 601 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, theprocessor 601 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments,processor 601 may also include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
Thememory 602 may include one or more computer-readable storage media, which may be non-transitory. Thememory 602 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium inmemory 602 is used to store at least one instruction for execution byprocessor 601 to implement the method of determining a viewing live time provided by the method embodiments herein.
In some embodiments, the terminal 600 may further optionally include: aperipheral interface 603 and at least one peripheral. Theprocessor 601,memory 602, andperipheral interface 603 may be connected by buses or signal lines. Various peripheral devices may be connected to theperipheral interface 603 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of aradio frequency circuit 604, atouch screen display 605, acamera 606, anaudio circuit 607, apositioning component 608, and apower supply 609.
Theperipheral interface 603 may be used to connect at least one peripheral related to I/O (Input/Output) to theprocessor 601 and thememory 602. In some embodiments, theprocessor 601,memory 602, andperipheral interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of theprocessor 601, thememory 602, and theperipheral interface 603 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
TheRadio Frequency circuit 604 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. Theradio frequency circuitry 604 communicates with communication networks and other communication devices via electromagnetic signals. Therf circuit 604 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, theradio frequency circuit 604 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. Theradio frequency circuitry 604 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, therf circuit 604 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
Thedisplay 605 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When thedisplay screen 605 is a touch display screen, thedisplay screen 605 also has the ability to capture touch signals on or over the surface of thedisplay screen 605. The touch signal may be input to theprocessor 601 as a control signal for processing. At this point, thedisplay 605 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, thedisplay 605 may be one, providing the front panel of the terminal 600; in other embodiments, thedisplay 605 may be at least two, respectively disposed on different surfaces of the terminal 600 or in a folded design; in still other embodiments, thedisplay 605 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 600. Even more, thedisplay 605 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. TheDisplay 605 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and the like.
Thecamera assembly 606 is used to capture images or video. Optionally,camera assembly 606 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments,camera assembly 606 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuitry 607 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to theprocessor 601 for processing or inputting the electric signals to theradio frequency circuit 604 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 600. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from theprocessor 601 or theradio frequency circuit 604 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments,audio circuitry 607 may also include a headphone jack.
Thepositioning component 608 is used for positioning the current geographic Location of the terminal 600 to implement navigation or LBS (Location Based Service). ThePositioning component 608 can be a Positioning component based on the united states GPS (Global Positioning System), the chinese beidou System, the russian graves System, or the european union's galileo System.
Power supply 609 is used to provide power to the various components interminal 600. Thepower supply 609 may be ac, dc, disposable or rechargeable. When thepower supply 609 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal 600 also includes one or more sensors 610. The one or more sensors 610 include, but are not limited to: acceleration sensor 611, gyro sensor 612, pressure sensor 613, fingerprint sensor 614, optical sensor 615, and proximity sensor 616.
The acceleration sensor 611 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 600. For example, the acceleration sensor 611 may be used to detect components of the gravitational acceleration in three coordinate axes. Theprocessor 601 may control thetouch screen display 605 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 611. The acceleration sensor 611 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 612 may detect a body direction and a rotation angle of the terminal 600, and the gyro sensor 612 and the acceleration sensor 611 may cooperate to acquire a 3D motion of the user on theterminal 600. Theprocessor 601 may implement the following functions according to the data collected by the gyro sensor 612: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 613 may be disposed on a side frame of the terminal 600 and/or on a lower layer of thetouch display screen 605. When the pressure sensor 613 is disposed on the side frame of the terminal 600, a user's holding signal of the terminal 600 can be detected, and theprocessor 601 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 613. When the pressure sensor 613 is disposed at the lower layer of thetouch display screen 605, theprocessor 601 controls the operability control on the UI interface according to the pressure operation of the user on thetouch display screen 605. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 614 is used for collecting a fingerprint of a user, and theprocessor 601 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 614, or the fingerprint sensor 614 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, theprocessor 601 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 614 may be disposed on the front, back, or side of the terminal 600. When a physical button or vendor Logo is provided on the terminal 600, the fingerprint sensor 614 may be integrated with the physical button or vendor Logo.
The optical sensor 615 is used to collect the ambient light intensity. In one embodiment,processor 601 may control the display brightness oftouch display 605 based on the ambient light intensity collected by optical sensor 615. Specifically, when the ambient light intensity is high, the display brightness of thetouch display screen 605 is increased; when the ambient light intensity is low, the display brightness of thetouch display screen 605 is turned down. In another embodiment, theprocessor 601 may also dynamically adjust the shooting parameters of thecamera assembly 606 according to the ambient light intensity collected by the optical sensor 615.
A proximity sensor 616, also known as a distance sensor, is typically disposed on the front panel of the terminal 600. The proximity sensor 616 is used to collect the distance between the user and the front surface of the terminal 600. In one embodiment, when the proximity sensor 616 detects that the distance between the user and the front surface of the terminal 600 gradually decreases, theprocessor 601 controls thetouch display 605 to switch from the bright screen state to the dark screen state; when the proximity sensor 616 detects that the distance between the user and the front surface of the terminal 600 gradually becomes larger, theprocessor 601 controls thetouch display 605 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 6 is not intended to be limiting ofterminal 600 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Fig. 7 is a schematic structural diagram of aserver 700 according to an embodiment of the present application, where theserver 700 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 701 and one ormore memories 702, where thememory 702 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 1001 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, a computer-readable storage medium, such as a memory, including instructions executable by a processor in a terminal to perform the method of determining a viewing live time duration in the above embodiments is also provided. The computer readable storage medium may be non-transitory. For example, the computer-readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is intended to be exemplary only, and not to limit the present application, and any modifications, equivalents, improvements, etc. made within the spirit and scope of the present application are intended to be included therein.