Disclosure of Invention
Aiming at the defects in the prior art, the invention solves the technical problems that: how to smoothly play the dual-screen video stream in 1 video player. The method and the device can realize smooth switching from playing the single-screen video stream to playing the double-screen video stream, and remarkably improve user experience.
In order to achieve the above object, the present invention provides a method for displaying a dual-screen video stream, comprising the steps of:
step A: the video streaming module of the client pre-loads the double-screen video streaming according to the double-screen video streaming address sent by the server; after the loading is finished, the video streaming module sends a loading completion notification to the client, and the client confirms to receive the loading completion notification and turns to the step B;
and B: the client detects whether the double-screen video stream address exists or not, if so, the step C is carried out, and if not, the information that the double-screen video stream address does not exist is displayed;
and C: the client sets the hard decoding resolution of the video player, closes the log printing function of the player and goes to step D;
step D: after the client creates a video loading object matched with the double-screen video stream address, controlling the video player to obtain the video loading object, loading the double-screen video stream in the video loading object according to the video stream address, and turning to the step E;
step E: the client displays the video player on the user interface, and the double-screen video stream is played through the video player.
The storage medium provided by the invention is stored with a computer program, and the computer program realizes the display method of the double-screen video stream when being executed by a processor.
The electronic equipment provided by the invention comprises a memory and a processor, wherein a computer program running on the processor is stored in the memory, and the processor realizes the display method of the double-screen video stream when executing the computer program.
The invention provides a display system of double-screen video stream, which comprises a double-screen video stream preloading module, a double-screen video stream detection module, a video player setting module, a double-screen video stream loading module and a double-screen video stream playing module, wherein the double-screen video stream preloading module, the double-screen video stream detection module, the video player setting module, the double-screen video stream loading module and the double-screen video stream playing module are arranged on a client;
the dual-screen video stream preloading module is used for: the video streaming module of the control client pre-loads the double-screen video streaming according to the double-screen video streaming address sent by the server; after the loading is finished, controlling the video stream module to send a loading completion notice to the client, confirming to receive the loading completion notice, and sending a double-screen video stream detection signal to the double-screen video stream detection module;
the double-screen video stream detection module is used for: after receiving the double-screen video stream detection signal, detecting whether a double-screen video stream address exists or not, if so, sending a video player setting signal to a video player setting module, and otherwise, displaying information that the double-screen video stream address does not exist;
the video player setting module is used for: after receiving a video player setting signal, setting the hard decoding resolution of the video player, closing the log printing function of the player, and sending a double-screen video stream loading signal to a double-screen video stream loading module;
the double-screen video stream loading module is used for: after receiving the double-screen video stream loading signal, creating a video loading object matched with the double-screen video stream address, controlling a video player to acquire the video loading object, loading the double-screen video stream in the video loading object according to the video stream address, and sending a double-screen video stream playing signal to a double-screen video stream playing module;
the double-screen video stream playing module is used for: and after receiving the double-screen video stream playing signal, displaying a video player on the user interface, and playing the double-screen video stream through the video player.
Compared with the prior art, the invention has the advantages that:
it can be known from S1 to S7 of the present invention that, after acquiring the address of the dual-screen video stream, the present invention does not immediately load the dual-screen video stream, but pre-loads the dual-screen video stream through the video stream module, and the dual-screen video stream is loaded through the player only after the pre-loading is completed; the preloading can make the loading when the double-spelling video stream is more smooth, and then make the player switch from playing the single screen video stream to playing the double screen video stream, can perfectly transition, the situation that can not appear blocking and not smooth. Therefore, the method and the device can realize smooth switching from playing the single-screen video stream to playing the double-screen video stream, and remarkably improve user experience.
Meanwhile, the invention can play the double-screen video stream only by 1 video player, thereby obviously reducing the bandwidth, memory occupancy rate and network speed requirements of the client and further improving the user experience.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Referring to fig. 1, a method for displaying a dual-screen video stream according to an embodiment of the present invention includes the following steps:
s1: and after the client acquires the video definition variable according to the video definition of the live broadcast room, the client sends the video definition variable to the server and goes to S2.
S2: the server sends the double-screen video stream address matched with the video definition variable to the client (so as to perfectly adapt to the configuration of the client), the double-screen video stream address is 2 video stream addresses, each video stream address corresponds to the live broadcast content of one anchor, and the process goes to S3.
S3: the client acquires the existing video stream module by using the function operationPlayerBy, the video stream module preloads the double-screen video stream according to the address of the double-screen video stream, after the loading is completed (the loading completion standard is that the video stream module detects that the resolution of the video stream changes), the video stream module sends a loading completion notification to the client, and the client confirms that the loading completion notification is received and goes to S4.
In S3, the video streaming module sends a loading completion notification to the client, and the process of receiving the loading completion notification by the client includes: the client acquires a monitoring notice by using an addObserver function in the notification center, acquires the notification center, registers the monitoring notice in the notification center, the name of the monitoring notice is the same as that of the loading completion notice, and confirms to receive the loading completion notice when the monitoring notice monitors that the notice with the same name is sent out.
S4: and in order to ensure that the double-screen video stream can be normally played, the client needs to detect whether the double-screen video stream address exists, if so, the S5 is turned to, otherwise, the information of the double-screen video stream address does not exist is displayed, and the operation is finished.
S5: the client sets the hard decoding resolution (typically 1920 pixels) of the video player using the setplaylayerontionvalue function, and in order to improve the performance of the video player, the client turns off the journaling print function of the player, and goes to S6.
S6: after the client creates a video loading object matched with the address of the double-screen video stream, controlling a video player to pull the video stream by using a function applyPlayerBy: and acquiring a video loading object, loading the double-screen video stream in the video loading object according to the video stream address, and turning to S7.
S7: after the background color and the scaling mode (a scaling mode, generally an adaptive mode mpmoviescalingmeaspectfill) of the video player are set by the client, the video player is displayed on the user interface, and the dual-screen video stream is played through the video player.
As can be seen from S1 to S7, after the address of the dual-screen video stream is obtained, the dual-screen video stream is not immediately loaded, but the dual-screen video stream is preloaded by the video stream module, and the dual-screen video stream is loaded by the player only after the preloading is completed; because the double-screen video stream is preloaded before loading, the situation of blocking and unsmooth playing of the double-screen video stream can be avoided when the player switches from playing the single-screen video stream to playing the double-screen video stream. Therefore, the embodiment of the invention can realize smooth switching from playing the single-screen video stream to playing the double-screen video stream, and remarkably improve the user experience.
Meanwhile, the embodiment of the invention can play the double-screen video stream only by 1 video player, thereby obviously reducing the bandwidth, memory occupancy rate and network speed requirements of the client and further improving the user experience.
The embodiment of the invention also provides a storage medium, wherein a computer program is stored on the storage medium, and when being executed by a processor, the computer program realizes the display method of the double-screen video stream. The storage medium includes various media capable of storing program codes, such as a usb disk, a removable hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk.
Referring to fig. 2, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program running on the processor, and the processor executes the computer program to implement the above-mentioned method for displaying a dual-screen video stream.
The invention provides a display system of double-screen video stream, which comprises a double-screen video stream address acquisition module, a double-screen video stream preloading module, a double-screen video stream detection module, a video player setting module, a double-screen video stream loading module and a double-screen video stream playing module which are arranged on a client.
The double-screen video stream address acquisition module is used for: before the double-screen video stream preloading module works, after a video definition variable is obtained according to the video definition of a live broadcast room, the video definition variable is sent to a server side; and acquiring a double-screen video stream address which is returned by the server and matched with the video definition variable.
The dual-screen video stream preloading module is used for: the video streaming module of the control client pre-loads the double-screen video streaming according to the double-screen video streaming address sent by the server; after the loading is finished (the loading finishing standard is that the video streaming module detects that the resolution ratio of the video streaming changes), the video streaming module is controlled to send a loading finishing notice to the client, the loading finishing notice is confirmed to be received, and a double-screen video streaming detection signal is sent to the double-screen video streaming detection module;
the double-screen video stream detection module is used for: after receiving the double-screen video stream detection signal, detecting whether a double-screen video stream address exists or not, if so, sending a video player setting signal to a video player setting module, and otherwise, displaying information that the double-screen video stream address does not exist;
the video player setting module is used for: after receiving a video player setting signal, setting the hard decoding resolution of the video player, closing the log printing function of the player, and sending a double-screen video stream loading signal to a double-screen video stream loading module;
the double-screen video stream loading module is used for: after receiving the double-screen video stream loading signal, creating a video loading object matched with the double-screen video stream address, controlling a video player to acquire the video loading object, loading the double-screen video stream in the video loading object according to the video stream address, and sending a double-screen video stream playing signal to a double-screen video stream playing module;
the double-screen video stream playing module is used for: after receiving a double-screen video stream playing signal, setting the background color and the expansion mode of a video player; and displaying the video player on the user interface, and playing the double-screen video stream through the video player.
It should be noted that: in the system provided in the embodiment of the present invention, when performing inter-module communication, only the division of each functional module is illustrated, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the system is divided into different functional modules to complete all or part of the above described functions.
Further, the present invention is not limited to the above-mentioned embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements are also considered to be within the scope of the present invention. Those not described in detail in this specification are within the skill of the art.