Background
With the development of network communication, more and more users choose to make friends and entertain through network platforms, which include a one-to-one chat making friend platform, an anchor chat room platform, a forum making friend platform, and the like, wherein the one-to-one chat making friend platform and the anchor chat room platform are more favored by users due to real-time video communication. However, in the existing webcast, only one view of the live view is presented to the watching user, and thus the existing webcast has the technical problem of single live view.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present invention provide a live video broadcasting method and apparatus, which overcome or at least partially solve the above problems.
In a first aspect, an embodiment of the present invention provides a video live broadcasting method, where the video live broadcasting method includes:
if the currently entered live broadcast room is a multi-angle video live broadcast room, sending a multi-angle live broadcast request to a data server;
receiving N video stream data addresses returned by the data server aiming at the multi-angle live broadcast request, wherein the N video stream data addresses are used for representing the positions of N video stream files which are live broadcast in the live broadcast room on a video stream server, the N video stream files correspond to N scene angles, and N is an integer greater than 1;
and loading the N video stream files from the video stream server for playing according to the N video stream data addresses.
Preferably, after the receiving N video stream data addresses returned by the data server for the multi-angle live broadcast request, the method further includes:
and setting the volume of N-1 video stream files in the N video stream files to be zero.
Preferably, if the N video stream files include a main video stream file and an auxiliary video stream file, the setting the volume of N-1 video stream files in the N video stream files to zero includes:
determining a main video stream file from the N video stream files;
keeping the current volume value of the main video stream file, or adjusting the volume value of the main video stream file to be larger than a preset volume value, wherein the preset volume value is larger than zero;
adjusting the volume of the secondary video stream file from a current volume value to a zero value.
Preferably, before the sending the multi-angle live broadcast request to the data server, the method further includes:
when entering the live broadcast room, acquiring live broadcast room attribute information of the live broadcast room from the data server, wherein the live broadcast room attribute information is used for representing that the live broadcast room is one of a single-angle video live broadcast room and a multi-angle video live broadcast room;
and identifying the attribute information of the live broadcast room.
Preferably, after the identifying the live-air attribute information, the method further includes:
if the live broadcast room is identified to be a single-angle video live broadcast room, sending a single-angle live broadcast request to the data server;
receiving a single video stream data address returned by the data server for the single-angle live broadcast request, wherein the single video stream data address is used for representing the position of a single video stream file which is live broadcast in the live broadcast room on a video stream server;
establishing a connection with the video streaming server;
and loading the single video stream file from the video stream server according to the single video stream data address.
Preferably, the loading the N video stream files from the video stream server for playing includes:
establishing connection with the video streaming server and creating N streaming objects;
correspondingly receiving the N video stream files from the video stream server through the N stream objects;
correspondingly attaching the received N video stream files to N video objects;
adding the N video objects to the same display container to play the N video stream files in the display container.
Preferably, the adding the N video objects to the same display container to play the N video stream files in the display container includes:
performing hierarchical superposition on the N video objects;
and adding the N superposed video objects to the display container, and correspondingly playing the N video stream files.
Preferably, the receiving N video stream data addresses returned by the data server for the multi-angle live broadcast request includes:
receiving response data returned by the data server aiming at the multi-angle live broadcast request;
resolving a stream address array from the response data, wherein the stream address array comprises N array elements;
and determining the video stream data address corresponding to one array element as the video stream data address of the main scene angle, and determining the N-1 array elements as the video stream data addresses of the auxiliary scene angles.
In a second aspect, an embodiment of the present invention provides a video live broadcasting apparatus, where the video live broadcasting apparatus includes:
the first request sending unit is used for sending a multi-angle live broadcast request to the data server if the currently entered live broadcast room is a multi-angle video live broadcast room;
a first address receiving unit, configured to receive N video stream data addresses returned by the data server for the multi-angle live broadcast request, where the N video stream data addresses are used to represent positions of N video stream files being live broadcast in the live broadcast room on a video stream server, the N video stream files correspond to N scene angles, and N is an integer greater than 1;
and the first loading unit is used for loading the N video stream files from the video stream server for playing according to the N video stream data addresses.
Preferably, the apparatus further comprises:
and the volume setting unit is used for setting the volume of N-1 video stream files in the N video stream files to be zero.
Preferably, if the N video stream files include a main video stream file and a sub video stream file, the volume setting unit includes:
a determining unit, configured to determine a main video stream file from the N video stream files;
the main volume adjusting unit is used for keeping the current volume value of the main video stream file, or adjusting the volume value of the main video stream file to be larger than a preset volume value, wherein the preset volume value is larger than zero;
and the auxiliary volume zero setting unit is used for adjusting the volume of the auxiliary video stream file from the current volume value to a zero value.
Preferably, the apparatus further comprises:
the attribute information acquisition unit is used for acquiring the attribute information of the live broadcast room from the data server when the live broadcast room enters, wherein the attribute information of the live broadcast room is used for representing that the live broadcast room is one of a single-angle video live broadcast room and a multi-angle video live broadcast room;
and the information identification unit is used for identifying the attribute information of the live broadcast room.
Preferably, the apparatus further comprises:
the second request sending unit is used for sending a single-angle live broadcast request to the data server if the live broadcast room is identified to be a single-angle video live broadcast room;
a second address receiving unit, configured to receive a single video stream data address for the single-angle live broadcast request, where the single video stream data address is used to represent a position of a single video stream file being live broadcast in the live broadcast room on a video stream server, where the single video stream data address is returned by the data server;
the connection unit is used for establishing connection with the video streaming server;
a second loading unit, configured to load the single video stream file from the video stream server according to the single video stream data address.
Preferably, the first loading unit includes:
a connection establishing subunit, configured to establish a connection with the video streaming server, and create N streaming objects;
a video stream file receiving unit, configured to correspondingly receive the N video stream files from the video stream server through the N stream objects;
an appending subunit, configured to append the received N video stream files to N video objects correspondingly;
and the video object adding unit is used for adding the N video objects to the same display container so as to play the N video stream files in the display container.
Preferably, the video object adding subunit is specifically configured to:
performing hierarchical superposition on the N video objects;
and adding the N superposed video objects to the display container, and correspondingly playing the N video stream files.
Preferably, the first address receiving unit is specifically configured to:
receiving response data returned by the data server aiming at the multi-angle live broadcast request;
resolving a stream address array from the response data, wherein the stream address array comprises N array elements;
and determining the video stream data address corresponding to one array element as the video stream data address of the main scene angle, and determining the N-1 array elements as the video stream data addresses of the auxiliary scene angles.
One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
when entering a multi-angle video live broadcasting room, sending a multi-angle live broadcasting request to a data server; and N video stream data addresses returned by the data server aiming at the multi-angle live broadcast request are received, and N video stream files are loaded from the video stream server for playing according to the N video stream data addresses, so that the video pictures of the network live broadcast are presented at multiple angles at the same time, the live broadcast room is more comprehensively displayed, and the video effect is better than that of a single video picture at one angle.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Detailed Description
In order to solve the technical problem of single live broadcast picture in the existing network live broadcast, the embodiment of the invention provides a video live broadcast method and a video live broadcast device, and the general idea is as follows:
if the currently entered live broadcast room is a multi-angle video live broadcast room, sending a multi-angle live broadcast request to a data server; and receiving N video stream data addresses returned by the data server aiming at the multi-angle live broadcast request, and loading N video stream files from the video stream server for playing according to the N video stream data addresses.
By the technical scheme, the network live broadcast video pictures can be presented at multiple angles at the same time, the live broadcast room can be more comprehensively presented, and the video effect is better than that of a single video picture at one angle.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a video live broadcast method, which is applied to a network live broadcast client, and referring to fig. 1, the video live broadcast method provided by the embodiment of the present invention includes the following steps:
s101, if the currently entered live broadcast room is a multi-angle video live broadcast room, sending a multi-angle live broadcast request to a data server;
s102, receiving N video stream data addresses returned by a data server aiming at a multi-angle live broadcast request, wherein the N video stream data addresses are used for representing the positions of N video stream files which are live broadcast in a live broadcast room on a video stream server, the N video stream files correspond to N scene angles, and N is an integer greater than 1;
s103, loading N video stream files from the video stream server for playing according to the N video stream data addresses.
It should be noted that the live broadcast client may specifically be an electronic device such as a smart phone, a desktop computer, an all-in-one machine, or a notebook, and is not limited herein.
The following describes in detail the specific implementation steps of the video live broadcast method of the webcast client with reference to fig. 1:
first, S101 is executed: and if the currently entered live broadcast room is the multi-angle video live broadcast room, sending a multi-angle live broadcast request to the data server.
In one embodiment, when the live webcast client enters the live webcast room, the live webcast client acquires live webcast room attribute information of the live webcast room from the data server and identifies the live webcast room attribute information. Specifically, the attribute information of the live broadcast room is used for representing that the live broadcast room is one of a single-angle video live broadcast room and a multi-angle video live broadcast room.
And if the currently entered live broadcast room is identified to be a multi-angle video live broadcast room by identifying the attribute information of the live broadcast room, sending a multi-angle live broadcast request to a data server.
In the embodiment of the present invention, the multi-angle live broadcast request specifically includes: the HTTP request with the parameter "isAngle true" added to the request parameter field characterizes that a video stream data address needs to be requested from the data server.
Specifically, the multi-angle live video broadcast room initiates an HTTP request to the data server by the flash player according to the swf _ api interface (the swf _ api interface provides a video stream data address) provided by the data server, and requests the swf _ api interface.
The network live broadcast client sends a multi-angle live broadcast request to the data server, so that when the data server receives the multi-angle live broadcast request, the data server recognizes the parameter of 'isAngle ═ true' in the multi-angle live broadcast request and returns a stream address array formed by video stream data addresses, wherein elements in the stream address array correspond to the video stream data addresses one to one. The stream address array comprises N elements, and the N elements correspond to N video stream data addresses.
And if the attribute information of the live broadcast room is identified, if the current live broadcast room is identified to be a single-angle video live broadcast room, sending a single-angle live broadcast request to the data server. The single-angle live broadcast request specifically comprises the following steps: the HTTP request with the parameter "isAngle ═ false" added to the request parameter field characterizes that a video stream data address needs to be requested from the data server, that is: a single video stream data address.
The network live broadcast client sends a single-angle live broadcast request to the data server, so that when the data server receives the single-angle live broadcast request, the data server identifies a parameter of 'isAngle ═ true' in the single-angle live broadcast request and returns a single video stream data address.
Receiving a single video stream data address which is returned by a data server and aims at a single-angle live broadcast request, wherein the single video stream data address is used for representing the position of a single video stream file which is live broadcast in a live broadcast room on a video stream server; establishing connection with a video streaming server; and loading the single video stream file from the video stream server according to the single video stream data address.
After S101, S102 is executed next: receiving N video stream data addresses returned by a data server aiming at a multi-angle live broadcast request, wherein the N video stream data addresses are used for representing the positions of N video stream files which are live broadcast in a live broadcast room on a video stream server, the N video stream files correspond to N scene angles, and N is an integer larger than 1.
Specifically, in one embodiment, after receiving N video stream data addresses, the video stream data addresses of the main and sub main scene angles are set. The specific implementation process is as follows: receiving response data returned by the data server aiming at the multi-angle live broadcast request; analyzing a stream address array from the response data, wherein the stream address array comprises N array elements; and determining the video stream data address corresponding to one array element as the video stream data address of the main scene angle, and determining the N-1 array elements as the video stream data addresses of the auxiliary scene angles.
In other embodiments, the video stream data addresses for the primary and secondary primary scene angles may also be defined by the anchor client.
S103, loading N video stream files from the video stream server for playing according to the N video stream data addresses.
In an embodiment, after receiving N video stream data addresses returned by the data server for the multi-angle live broadcast request, setting the volume of N-1 video stream files in the N video stream files to be zero, and keeping the volume value of one video stream file to be greater than zero.
In a specific implementation process, the volume of N-1 video stream files in the N video stream files may be set to zero while the N video stream files are loaded from the video stream server.
For N video stream files including a main video stream file and an auxiliary video stream file, a specific embodiment is given: determining a main video stream file from the N video stream files; keeping the current volume value of the main video stream file, or adjusting the volume value of the main video stream file to be larger than a preset volume value, wherein the preset volume value is larger than zero; and then adjusting the volume of the secondary video stream file from the current volume value to a zero value.
It should be noted that, in the embodiment of the present invention, the preset volume value is greater than zero. For example, if N is 2, and the video stream file is composed of a main video stream file corresponding to a main scene angle and an auxiliary video stream file corresponding to an auxiliary scene angle, the volume value of the auxiliary video stream file is adjusted to zero, the main video stream file is kept as the current volume value, or the volume value of the main video stream file is adjusted to be greater than the preset volume value.
For example, N is 3, and includes a main video stream file corresponding to a main scene angle, an auxiliary video stream file corresponding to a left auxiliary scene angle, and an auxiliary video stream file corresponding to a right auxiliary scene angle. And adjusting the volume values of the two auxiliary video stream files to be zero, keeping the main video stream file as the current volume value, or adjusting the volume value of the main video stream file to be larger than the preset volume value.
In the implementation process, the sound volume values of the main video stream file and the auxiliary video stream file can be adjusted by setting NetStream.
In an embodiment, a specific implementation process for loading N video stream files from a video stream server for playing includes the following steps:
step 1: establishing connection with a video streaming server and creating N streaming objects;
step 2: correspondingly receiving N video stream files from a video stream server through N stream objects;
and step 3: correspondingly adding the received N video stream files to the N video objects; and adding the N video objects to the same display container so as to play the N video stream files in the display container.
In the embodiment of the invention, the network live broadcast client needs to load N video stream files from a video stream server to play by combining a video stream data address and a stream protocol. The streaming Protocol may use an http (HyperText Transfer Protocol) Protocol or an rtmp (Real Time Messaging Protocol) Protocol.
It should be noted that the video stream data address is composed of an address of a video stream server and a live code (live), and the address of the video stream server is a URL (Uniform Resource Locator).
If the stream protocol is http protocol, when the live webcast client enters the live webcast room, the live webcast client creates a connection object (NetConnection), and then the live webcast client establishes a connection with the video streaming server according to the address of the video streaming server by calling the NetConnection object, and the connection establishment is realized in a connection (url). After the network live client is successfully connected with the video streaming server, the network live client respectively creates a streaming object (netStream) and a video object (video) for the N video streaming data addresses, that is: n netStream objects and N video objects are created. Then, the webcast client creates N video streams for the N video stream files by calling the N netStream objects, and simultaneously calls a play (live) method of the N netStream objects to receive the N video stream files, and then the webcast client attaches the N netStream objects to the video object in a one-to-one correspondence manner, so that the N video stream files are correspondingly attached to the N video objects, and adds the N video objects to the same display container (NetConnection), so as to play the N video stream files in the display container, thereby displaying video pictures at N angles on a flash playing interface.
Specifically, in this embodiment, an event handling function for network connection needs to be added, and the network connection state is determined in the event handling function. It should be noted that the successful network connection state is as follows: connection.
If the stream protocol is rtmp protocol, when the live webcast client enters the live webcast room, the live webcast client creates a NetConnection object, calls the NetConnection object to establish a null connection with the video stream server, creates N netStream objects and N video objects, and the live webcast client combines and splices the address (URL) of the video stream server and the live code (live) into a complete address: liveurl. Then, the live webcast client side calls play (live) methods of the N netStream objects at the same time to play the live webcast video of the live webcast client side in the live webcast room. It should be noted that one netStream object corresponds to one play (live) method. Then, the webcast client attaches the N netStream objects to the N video objects in a one-to-one correspondence manner, and adds the N video objects to the same display container (NetConnection) to play the N video stream files in the same display container, so as to display the video frames at the N angles on a flash playing interface.
During the playing process of the live video, various status events (status events) are generated, and each status event is added to the corresponding video object for presentation. In an embodiment of the present invention, the NetConnection object and the NetStream object remain present at all times.
Specifically, a specific implementation manner for playing N video stream files in a display container includes: carrying out level superposition on the N video objects; and correspondingly displaying the N video stream files based on the N superposed video objects. Thereby revealing the N video stream files as a picture-in-picture effect.
In a further technical solution, playing N video stream files in a display container further includes: at least one parameter of the length, the width and the coordinate layout of the N video objects is set, so that better viewing experience is presented.
Based on the same inventive concept, an embodiment of the present invention provides a video live broadcast apparatus, which is applied to a network live broadcast client, and as shown in fig. 2, the video live broadcast apparatus includes:
a first request sending unit 201, configured to send a multi-angle live broadcast request to a data server if a currently entered live broadcast room is a multi-angle video live broadcast room;
a first address receiving unit 202, configured to receive N video stream data addresses returned by the data server for the multi-angle live broadcast request, where the N video stream data addresses are used to represent positions of N video stream files being live broadcast in the live broadcast room on the video stream server, the N video stream files correspond to N scene angles, and N is an integer greater than 1;
a first loading unit 203, configured to load N video stream files from the video stream server for playing according to the N video stream data addresses.
Preferably, the apparatus further comprises:
and the volume setting unit is used for setting the volume of N-1 video stream files in the N video stream files to be zero.
Preferably, if the N video stream files include a main video stream file and a sub video stream file, the volume setting unit includes:
a determining unit, configured to determine a main video stream file from the N video stream files;
the main volume adjusting unit is used for keeping the current volume value of the main video stream file, or adjusting the volume value of the main video stream file to be larger than a preset volume value, wherein the preset volume value is larger than zero;
and the auxiliary volume zero setting unit is used for adjusting the volume of the auxiliary video stream file from the current volume value to a zero value.
Preferably, the apparatus further comprises:
the attribute information acquisition unit is used for acquiring the attribute information of the live broadcast room from the data server when the live broadcast room enters, wherein the attribute information of the live broadcast room is used for representing that the live broadcast room is one of a single-angle video live broadcast room and a multi-angle video live broadcast room;
and the information identification unit is used for identifying the attribute information of the live broadcast room.
Preferably, the apparatus further comprises:
the second request sending unit is used for sending a single-angle live broadcast request to the data server if the live broadcast room is identified to be a single-angle video live broadcast room;
a second address receiving unit, configured to receive a single video stream data address for the single-angle live broadcast request returned by the data server, where the main video stream data address is used to represent a position of a single video stream file being live broadcast in the live broadcast room on the video stream server;
the connection unit is used for establishing connection with the video streaming server;
a second loading unit, configured to load the single video stream file from the video stream server according to the single video stream data address.
Preferably, the first loading unit 203 includes:
a connection establishing subunit, configured to establish a connection with the video streaming server, and create N streaming objects;
a video stream file receiving unit, configured to correspondingly receive the N video stream files from the video stream server through the N stream objects;
an appending subunit, configured to append the received N video stream files to N video objects correspondingly;
and the video object adding unit is used for adding the N video objects to the same display container so as to play the N video stream files in the display container.
Preferably, the video object adding subunit is specifically configured to:
performing hierarchical superposition on the N video objects;
and adding the N superposed video objects to the display container, and correspondingly playing the N video stream files.
Preferably, the first address receiving unit 202 is specifically configured to:
receiving response data returned by the data server aiming at the multi-angle live broadcast request;
resolving a stream address array from the response data, wherein the stream address array comprises N array elements;
and determining the video stream data address corresponding to one array element as the video stream data address of the main scene angle, and determining the N-1 array elements as the video stream data addresses of the auxiliary scene angles.
Since the apparatus described in the embodiment of the present invention is an apparatus used for implementing the embodiment of the video live broadcasting method of the present invention, based on the method described in the embodiment of the video live broadcasting method of the present invention, those skilled in the art can understand the specific structure and deformation of the apparatus, and thus, details are not described herein. All the devices adopted in the embodiment of the video live broadcast method of the invention belong to the protection scope of the invention.
Through one or more technical solutions provided in the embodiments of the present invention, at least the following technical effects or advantages are provided:
when entering a multi-angle video live broadcasting room, sending a multi-angle live broadcasting request to a data server; and N video stream data addresses returned by the data server aiming at the multi-angle live broadcast request are received, and the N video stream files are loaded from the video stream server to be played according to the N video stream data addresses, so that the video live broadcast pictures can be presented at multiple angles at the same time, a live broadcast room can be more comprehensively displayed, and the video effect is better than that of a single video picture at one angle.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description provided above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the intelligent camera system and network cameras according to embodiments of the present invention. The present invention may also be embodied as apparatus or system programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several systems, several of these systems may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.