Video playback method, device, electronic device and storage medium
By reusing the player and configuration files of previous videos, the time-consuming problem of video player creation is solved, the video loading efficiency and playback speed are improved, and the playback effect is improved.
Patent Information
- Application Number
- CN202111395942.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-11-23
AI Technical Summary
The existing video playback technology takes a long time to create a player, resulting in low video loading efficiency and long start time, affecting the playback effect.
Reuse the initial player of the video that has been played before, and combine the video configuration file to directly play the video to avoid repeated creation of the player.
It reduces the waiting time for video playback, reduces page resource consumption, improves video loading efficiency and starting speed, and improves playback effect.
Smart Images

Figure CN114125560B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video playback technology, and in particular to a video playback method, device, electronic device and storage medium. Background Art
[0002] At present, with the advancement and development of multimedia technology, browsing videos has gradually become a way for users to relax and unwind in their daily lives. Users can watch videos through various smart terminal devices. The video playlist of the user's client is often composed of multiple video cards arranged vertically or horizontally. Each video card generally includes content such as a title and a cover.
[0003] When users are watching videos, they can usually switch video playback by clicking or sliding on video cards. When a video card is clicked to play a video, it is usually necessary to first create a player, initialize the player, and then add configuration files and video data to the player before starting to play the video. However, the creation of a player is time-consuming, and the process of creating a player consumes page resources, resulting in low video loading efficiency and a long time for the video to start playing, which may cause a long wait and affect the video playback effect. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a video playback method, device, electronic device and storage medium.
[0005] The present disclosure provides a video playback method, the method comprising:
[0006] When the first video meets the start playing condition, obtaining an initial player recovered from the second video and used when the second video is played, wherein the second video is a video played before the first video;
[0007] Obtain a first configuration file of the first video;
[0008] Based on the first configuration file and the initial player, the first video is played.
[0009] In an optional implementation manner, determining whether the first video meets the playback start condition is performed by the following steps:
[0010] When it is detected that the third video has finished playing, it is determined that the first video meets the start playing condition, and the third video is located before the first video and is adjacent to the first video; or
[0011] When receiving a play operation of the user for the first video, determining that the first video meets the start play condition;
[0012] The third video and the second video are the same video, or the second video is a video located before the third video.
[0013] In an optional implementation manner, playing the first video based on the first configuration file and the initial player includes:
[0014] Determine a plurality of first playback components of the first video based on the configuration data read from the first configuration file;
[0015] Adding the first playback component to the initial player to obtain a first player for the first video;
[0016] Use the first player to play the first video.
[0017] In an optional implementation manner, using the first player to play the first video includes:
[0018] In the case of acquiring the first player, setting the title and video stream address parameters of the first video for the first player and the player engine of the first player respectively;
[0019] When the parameter setting is completed, taking over the player engine of the first player;
[0020] The player engine is controlled to retrieve the video data of the first video, and the first player is driven to load the video data to play the first video.
[0021] In an optional implementation manner, when the first video meets the playback start condition, before obtaining the initial player recovered from the second video and used when the second video is played, the method includes:
[0022] When the second video changes from a playing state to a stopped playing state, reclaiming a second video player used for playing the second video;
[0023] Initialize the second video player to obtain an initial player.
[0024] In an optional implementation manner, the initializing the second video player to obtain an initial player includes:
[0025] Taking over the second video player used for playing the second video;
[0026] Clear multiple second playback components of the second video added in the second video player to obtain an initial player.
[0027] In an optional implementation, the method includes:
[0028] In the case where the first video meets the start playing condition, if the initial player of the second video cannot be obtained, a blank player is created, wherein the playing component is not added to the blank player;
[0029] The blank player is used as the initial player recovered from the second video and used to play the first video.
[0030] The present disclosure also provides a video playback device, the device comprising:
[0031] A first acquisition module is used to acquire an initial player recovered from a second video and used when the second video is played when the first video meets a condition for starting to play, wherein the second video is a video played before the first video;
[0032] A second acquisition module, used to acquire a first configuration file of the first video;
[0033] A playing module is used to play the first video based on the first configuration file and the initial player.
[0034] In an optional implementation manner, the first acquisition module determines whether the first video meets a condition for starting to play by performing the following steps:
[0035] When it is detected that the third video has finished playing, it is determined that the first video meets the start playing condition, and the third video is located before the first video and is adjacent to the first video; or
[0036] When receiving a play operation of the user for the first video, determining that the first video meets the start play condition;
[0037] The third video and the second video are the same video, or the second video is a video located before the third video.
[0038] In an optional implementation manner, the playback module is specifically used to:
[0039] Determine a plurality of first playback components of the first video based on the configuration data read from the first configuration file;
[0040] Adding the first playback component to the initial player to obtain a first player for the first video;
[0041] Use the first player to play the first video.
[0042] In an optional implementation manner, when the playing module is used to play the first video using the first player, it is specifically used to:
[0043] In the case of acquiring the first player, setting the title and video stream address parameters of the first video for the first player and the player engine of the first player respectively;
[0044] When the parameter setting is completed, taking over the player engine of the first player;
[0045] The player engine is controlled to retrieve the video data of the first video, and the first player is driven to load the video data to play the first video.
[0046] In an optional embodiment, the device further comprises a recovery module, wherein the recovery module is used to:
[0047] When the second video changes from a playing state to a stopped playing state, reclaiming a second video player used for playing the second video;
[0048] Initialize the second video player to obtain an initial player.
[0049] In an optional implementation manner, when the recycling module is used to initially generate the second video player to obtain the initial player, it is specifically used to:
[0050] Taking over the second video player used for playing the second video;
[0051] Clear multiple second playback components of the second video added in the second video player to obtain an initial player.
[0052] In an optional implementation manner, the device further includes a creation module, wherein the creation module is configured to:
[0053] In the case where the first video meets the start playing condition, if the initial player of the second video cannot be obtained, a blank player is created, wherein the playing component is not added to the blank player;
[0054] The blank player is used as the initial player recovered from the second video and used to play the first video.
[0055] An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned video playback method are performed.
[0056] The embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned video playback method are executed.
[0057] The video playback method, device, electronic device and storage medium provided by the embodiments of the present disclosure obtain an initial player recovered from a second video and used when the second video is played when the first video meets a condition for starting playback, wherein the second video is a video played before the first video; obtain a first configuration file for the first video; and play the first video based on the first configuration file and the initial player.
[0058] In this way, through the reuse of players, the creation of players during the video playback stage can be omitted, thereby greatly reducing the waiting time during video playback, reducing the consumption of page resources, helping to improve the efficiency of video loading, reducing the video start time, quickly realizing video playback, and improving the effect of video playback.
[0059] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0061] Figure 1 A flow chart of a video playback method provided by an embodiment of the present disclosure is shown;
[0062] Figure 2 One of the video playback schematic diagrams provided by the embodiment of the present disclosure is shown;
[0063] Figure 3 A second schematic diagram of video playback provided by an embodiment of the present disclosure is shown;
[0064] Figure 4 A flowchart of another video playback method provided by an embodiment of the present disclosure is shown;
[0065] Figure 5A flow chart of a video playback method provided by an embodiment of the present disclosure is shown;
[0066] Figure 6 One of the schematic diagrams of a video playback device provided by an embodiment of the present disclosure is shown;
[0067] Figure 7 A second schematic diagram of a video playback device provided by an embodiment of the present disclosure is shown;
[0068] Figure 8 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0070] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0071] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.
[0072] Research has found that when users are watching videos, they can mostly switch video playback by clicking or sliding on video cards. When a video card is clicked to play a video, it is usually necessary to first create a player, initialize the player, and then add configuration files and video data to the player before starting to play the video. However, the creation of a player is time-consuming, and the process of creating a player consumes page resources, resulting in low video loading efficiency and a long time for the video to start playing, which may cause a long wait and affect the video playback effect.
[0073] Based on the above research, the present disclosure provides a video playback method, which can obtain a player that is recovered from a second video that was played before the first video and is used when the second video is played, as an initial player when the first video meets the conditions for starting playback, and then obtain a first configuration file for the first video. Based on the first configuration file and the initial player, the first video can be played. In this way, through the reuse of the player, the creation of the player in the video playback stage can be omitted, thereby greatly reducing the waiting time during video playback, reducing the consumption of page resources, helping to improve the loading efficiency of the video, reducing the video start time, quickly realizing the video playback, and improving the video playback effect.
[0074] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0075] To facilitate understanding of this embodiment, a video playback method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the video playback method provided in the embodiment of the present disclosure is generally an electronic device with certain computing capabilities, and the electronic device includes, for example, a terminal device or a server or other processing device. In some possible implementations, the video playback method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0076] See also Figure 1 , Figure 1 Flow chart of a video playback method provided by an embodiment of the present disclosure. Figure 1 As shown in , the video playback method provided by the embodiment of the present disclosure includes:
[0077] S101: When a first video meets a condition for starting to play, an initial player recovered from a second video and used when playing the second video is obtained, wherein the second video is a video played before the first video.
[0078] In this step, when the first video meets the conditions for starting to play, a player is required to play the first video. Therefore, the second video that was played before the first video can be obtained, and the player used when playing the second video can be recovered as the initial player.
[0079] The initial player is a blank, brand new player that has been initialized.
[0080] Please also see Figure 2 and Figure 3 , Figure 2 This is one of the video playback diagrams. Figure 3 This is the second schematic diagram of video playback. In the actual application scenario of using the video playback method, the device terminal that plays the video includes but is not limited to: wearable smart electronic devices, non-wearable smart terminals and visualization devices, and the device terminal is installed with an application that can play videos. During the running of the application, users can use smart phones, tablets, wearable devices and other terminals to watch videos. Figure 2 and Figure 3 As shown in , the video play list of the terminal is composed of a plurality of video cards arranged in an array. For example, video 1 is currently being played, and when the user clicks on video 2, the play interface switches to display video 2, and video 2 is played.
[0081] The video playback interface of the double-row video is only an example, and there may also be a single-row video, which is not limited in any way. For example, the user may play the target video by sliding or clicking.
[0082] The first video is any one of multiple videos displayed on the terminal.
[0083] Specifically, the following steps may be used to determine whether the first video meets the conditions for starting to play:
[0084] When it is detected that the third video has finished playing, it is determined that the first video meets the start playing condition, and the third video is located before the first video and is adjacent to the first video; or
[0085] When receiving a play operation of the user for the first video, determining that the first video meets the start play condition;
[0086] The third video and the second video are the same video, or the second video is a video located before the third video.
[0087] Among them, the completion of the playback of the third video can be receiving a notification prompt that the playback of the third video is complete, or it can be detecting that the third video has been played to the last frame of the video, or it can be detecting that the progress bar of the third video has moved to the end position of the playback. The progress bar moving to the end position of the playback can be the video naturally playing to the end position, or it can be the user manually dragging the progress bar to the end position of the playback, and no limitation is made here.
[0088] The completion of the playback of the third video only indicates the end of the playback of the third video, but does not mean that the third video cannot be played again.
[0089] Among them, the user's playback operation for the first video, referring to the above-mentioned video playback diagram, can be the user clicking on the first video, or the user sliding the first video until the first video appears on the playback interface, or the user sliding the first video to the playback position, or selecting the first video through gesture control, and no limitation is made here.
[0090] Among them, the third video and the second video can be the same video. Specifically, in order to reduce the processing and storage amount of resources, thereby reducing resource occupation, it can be set to recycle only one player. When the first video needs to be played, it is necessary to call the player from the system background, and it is necessary to recycle the player used by the video played before the first video, that is, the player used when the third video is played. In this way, the circular recycling and use of a single player is realized. According to the above, the second video is the video played before the first video. Therefore, the third video and the second video can be the same video.
[0091] In another case, the second video is a video that is located before the third video. Specifically, in order to reduce the time before the video is played, thereby reducing the time occupied, it can be set to allow multiple players to be recycled at the same time. When the first video needs to be played, it is necessary to call the player from the system background. At this time, a player can be randomly selected from the multiple players stored in the background, that is, the player used when the third video is played can be obtained, and the players can be used sequentially, or the player used when the second video is played can be obtained, and the players can be used at intervals. In this way, repeated recycling and use of multiple players can be achieved. Therefore, the second video cannot be the same video as the third video, and the second video is the video that is located before the third video.
[0092] For example, when the application software for playing videos has a limit on the number of players that can exist at the same time, such as an application software only allows three players to be used in the application background, then when playing video A, player a is used. After video A is finished playing, player a is recycled. When playing video B, player b is used. After video B is finished playing, player b is recycled. When playing video C, player c is used. After video C is finished playing, player c is recycled. Furthermore, when playing video D, player a is used. After video D is finished playing, player a is recycled. When playing video E, player b is used. That is, only players a, b, and c are recycled and used repeatedly.
[0093] S102: Obtain a first configuration file of the first video.
[0094] In this step, a data packet of the first video is retrieved from a background data terminal, the data packet of the first video is parsed, and a first configuration file of the first video is obtained therefrom.
[0095] The first configuration file is a data packet file related to the first video and stored in the background of the application, including but not limited to configuration data that needs to be configured during the playback of the first video.
[0096] S103: Play the first video based on the first configuration file and the initial player.
[0097] In this step, the first video can be played only when the first configuration file and the initial player are obtained.
[0098] Before playing the first video, it is necessary to monitor whether the status of the application software playing the first video is entering the foreground or exiting the foreground. Only when the status of the application software is entering the foreground can the first video be played.
[0099] The video playback method provided by the embodiment of the present disclosure obtains an initial player recovered from a second video and used when the second video is played when the first video meets a condition for starting playback, wherein the second video is a video played before the first video; obtains a first configuration file for the first video; and plays the first video based on the first configuration file and the initial player.
[0100] In this way, through the reuse of players, the creation of players during the video playback stage can be omitted, thereby greatly reducing the waiting time during video playback, reducing the consumption of page resources, helping to improve the efficiency of video loading, reducing the video start time, quickly realizing video playback, and improving the effect of video playback.
[0101] Please also see Figure 4 , Figure 4 FIG. 1 is a flow chart of another video playback method provided by an embodiment of the present disclosure. Figure 4 As shown in , the video playback method provided by the embodiment of the present disclosure includes:
[0102] S401: When the second video changes from a playing state to a stopped playing state, reclaiming a second video player used for playing the second video.
[0103] In this step, when the second video changes from a playing state to a stopped playing state, the playing process of the second video is traced back to recover the second video player used to play the second video.
[0104] The situation where the second video changes from a playing state to a stopped playing state may be that the second video ends naturally, or that the second video ends under a user operation, or that the user swipes away the second video before the second video ends, or that the user slides other videos to the playing position, and no limitation is made here.
[0105] Among them, the recycling of the second video player can be done immediately after the second video is played, or it can be recycled after a period of time after the second video is played, or it can be recycled when the number of players to be recycled meets the set number of application software that plays the video. There is no limitation here.
[0106] For example, there are five players to be recycled in the background of an application software. If only two videos need to be played at this time, only two players need to be recycled, and the other three players can be recycled when there is a subsequent demand to play videos.
[0107] S402: Initialize the second video player to obtain an initial player.
[0108] In this step, after the second video player is recycled, the second video player may be initialized, so that the initialized second video player is used as the initial player.
[0109] S403: When the first video meets the condition for starting to play, obtain an initial player recovered from the second video and used when playing the second video, wherein the second video is a video played before the first video.
[0110] S404: Obtain a first configuration file of the first video.
[0111] S405: Play the first video based on the first configuration file and the initial player.
[0112] Among them, the description of step S403 to step S405 can refer to the description of step S101 to step S103, and can achieve the same technical effects and solve the same technical problems, so they are not repeated here.
[0113] Next, this embodiment will be further described in conjunction with some specific implementation methods.
[0114] In some possible implementations, step S402 includes:
[0115] Taking over the second video player used for playing the second video;
[0116] Clear multiple second playback components of the second video added in the second video player to obtain an initial player.
[0117] In this step, after the second video player is recycled, the second video player used in the process of playing the second video is taken over, and multiple second playback components of the second video added in the second video player are determined, and then the multiple second playback components are cleared, thereby obtaining the second player with the second playback components cleared. In this way, the second player with the second playback components cleared can be used as the initial player.
[0118] The determination of the multiple second playback components is based on the second configuration file, and configuration data is read from the second configuration file and parsed to determine the multiple second playback components of the second video.
[0119] The multiple second playback components include but are not limited to: a monitoring component, a timer, unnecessary playback data of the second video, and a view control of the video playback interface.
[0120] Among them, the view controls of the video playback interface include but are not limited to: a speed button, a full screen button, a clarity button, a clarity panel, a download button, and a download panel.
[0121] Exemplarily, it is learned from the configuration data read from the second configuration file that a timer is used during the playback of the second video, and therefore the timer is cleared.
[0122] In some possible implementations, step S405 includes:
[0123] Determine a plurality of first playback components of the first video based on the configuration data read from the first configuration file;
[0124] Adding the first playback component to the initial player to obtain a first player for the first video;
[0125] Use the first player to play the first video.
[0126] In this step, based on the first configuration file, configuration data is read from the first configuration file, and the configuration data is parsed to determine multiple first playback components of the first video, and then the first playback components are added to the initial player, and the initial player with the first playback components added is used as the first player of the first video, thereby obtaining the first player. In this way, the first player can be used to play the first video.
[0127] The multiple first playback components include but are not limited to: a monitoring component, a timer, and a view control of a video playback interface.
[0128] Among them, the view controls of the video playback interface include but are not limited to: a speed button, a full screen button, a clarity button, a clarity panel, a download button, and a download panel.
[0129] In some possible implementations, using the first player to play the first video includes:
[0130] In the case of acquiring the first player, setting the title and video stream address parameters of the first video for the first player and the player engine of the first player respectively;
[0131] When the parameter setting is completed, taking over the player engine of the first player;
[0132] The player engine is controlled to retrieve the video data of the first video, and the first player is driven to load the video data to play the first video.
[0133] In this step, when the first player is obtained, the title and video stream address parameters of the first video are set in the data of the first player, and then the title and video stream address parameters of the first video are also set in the data of the player engine of the first player. When the parameter settings are completed, the first player and its player engine are associated. In this way, the player engine that takes over the first player can call the video data of the first video through the player engine, and drive the first player to load the video data, and then play the first video.
[0134] Among them, the player engine receives the video data of the first video from the server, and then renders the picture based on the video data of the first video so that the picture of the first video appears on the screen, and loads the audio rendering to synchronize the audio and video, and then plays the first video, so that the user watching the first video can see the picture of the first video and hear the sound of the first video.
[0135] In some possible implementations, the method includes:
[0136] In the case where the first video meets the start playing condition, if the initial player of the second video cannot be obtained, a blank player is created, wherein the playing component is not added to the blank player;
[0137] The blank player is used as the initial player recovered from the second video and used to play the first video.
[0138] In this step, when the first video meets the conditions for starting playback, it can be detected whether the initial player for the second video currently exists. If the initial player for the second video cannot be obtained, a blank player without the playback component added can be created, so that the blank player can be used as the initial player recovered from the second video, and the blank player can be used as the initial player to play the first video later.
[0139] Please also see Figure 5 , Figure 5 FIG. 1 is a flow chart of a video playback method. Figure 5 As shown in , when the first video is clicked or slid, the second video stops playing. When the second video stops playing and / or the second video is finished playing, the second video player is recycled, and the multiple second playback components of the second video added in the second video player are cleared. Then, the second video player is initialized and used as the initial player. At this time, it is detected whether the initial player currently exists. If it exists, the player is directly taken out. If it does not exist, a new blank player is created as the initial player for playing the first video. When the initial player is obtained, the first configuration file of the first video is obtained, and multiple first playback components are determined therefrom. Then, the multiple first playback components are added to the initial player to obtain the first player. Next, the title and video stream address parameters of the first video are set, and the player engine of the first player is taken over, so as to retrieve the video data of the first video and play the first video.
[0140] The video playback method provided by the embodiment of the present disclosure can, when the first video meets the condition for starting playback, obtain a player that is recovered from a second video that has been played before the first video and is used when the second video is played, as an initial player, and then obtain a first configuration file for the first video. Based on the first configuration file and the initial player, the first video can be played. In this way, through the reuse of the player, the creation of the player in the video playback stage can be omitted, thereby greatly reducing the waiting time during video playback, reducing the consumption of page resources, helping to improve the loading efficiency of the video, reducing the video start time, quickly realizing the video playback, and improving the video playback effect.
[0141] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0142] Based on the same inventive concept, a video playback device corresponding to the video playback method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned video playback method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0143] See also Figure 6 and Figure 7 , Figure 6 This is one of the schematic diagrams of a video playback device provided in an embodiment of the present disclosure, Figure 7 The second schematic diagram of a video playback device provided in an embodiment of the present disclosure.
[0144] like Figure 6 As shown in , the video playback device 600 provided in the embodiment of the present disclosure includes:
[0145] The first acquisition module 610 is used to acquire an initial player recovered from a second video and used when the second video is played when the first video meets a condition for starting to play, wherein the second video is a video played before the first video.
[0146] The second acquisition module 620 is configured to acquire a first configuration file of the first video.
[0147] The playing module 630 is configured to play the first video based on the first configuration file and the initial player.
[0148] In an optional implementation manner, the first acquisition module 610 determines whether the first video meets the start playing condition by the following steps:
[0149] When it is detected that the third video has finished playing, it is determined that the first video meets the start playing condition, and the third video is located before the first video and is adjacent to the first video; or
[0150] When receiving a play operation of the user for the first video, determining that the first video meets the start play condition;
[0151] The third video and the second video are the same video, or the second video is a video located before the third video.
[0152] In an optional implementation manner, the playback module 630 is specifically used for:
[0153] Determine a plurality of first playback components of the first video based on the configuration data read from the first configuration file;
[0154] Adding the first playback component to the initial player to obtain a first player for the first video;
[0155] Use the first player to play the first video.
[0156] In an optional implementation manner, when the playing module 630 is used to play the first video using the first player, it is specifically used to:
[0157] In the case of acquiring the first player, setting the title and video stream address parameters of the first video for the first player and the player engine of the first player respectively;
[0158] When the parameter setting is completed, taking over the player engine of the first player;
[0159] The player engine is controlled to retrieve the video data of the first video, and the first player is driven to load the video data to play the first video.
[0160] In an optional implementation, if Figure 7 As shown in , the video playback device further includes a recycling module 640 and a creation module 650 .
[0161] The recovery module 640 is used for:
[0162] When the second video changes from a playing state to a stopped playing state, reclaiming a second video player used for playing the second video;
[0163] Initialize the second video player to obtain an initial player.
[0164] The creation module 650 is used to:
[0165] In the case where the first video meets the start playing condition, if the initial player of the second video cannot be obtained, a blank player is created, wherein the playing component is not added to the blank player;
[0166] The blank player is used as the initial player recovered from the second video and used to play the first video.
[0167] In an optional implementation manner, when the recycling module 640 is used to initially generate the second video player and obtain the initial player, it is specifically used to:
[0168] Taking over the second video player used for playing the second video;
[0169] Clear multiple second playback components of the second video added in the second video player to obtain an initial player.
[0170] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0171] The video playback device provided by the embodiment of the present disclosure can, when the first video meets the condition for starting playback, obtain a player that is recovered from a second video that has been played before the first video and is used when the second video is played, as an initial player, and then obtain a first configuration file for the first video. Based on the first configuration file and the initial player, the first video can be played. In this way, through the reuse of the player, the creation of the player in the video playback stage can be omitted, thereby greatly reducing the waiting time during video playback, reducing the consumption of page resources, helping to improve the loading efficiency of the video, reducing the video start time, quickly realizing the video playback, and improving the video playback effect.
[0172] Corresponding to the above-mentioned video playing method, the embodiment of the present disclosure further provides an electronic device 800, such as Figure 8 FIG. 8 is a schematic diagram of the structure of an electronic device 800 provided in an embodiment of the present disclosure, including:
[0173] Processor 810, memory 820, and bus 830; memory 820 is used to store execution instructions, including internal memory 821 and external memory 822; the internal memory 821 here is also called internal memory, which is used to temporarily store the operation data in the processor 810, as well as the data exchanged with the external memory 822 such as a hard disk. The processor 810 exchanges data with the external memory 822 through the internal memory 821. When the electronic device 800 is running, the processor 810 communicates with the memory 820 through the bus 830, so that the processor 810 can execute the steps of the above-mentioned video playback method.
[0174] The specific execution process of the above instructions can refer to the steps of the video playback method described in the embodiment of the present disclosure, which will not be repeated here.
[0175] The present disclosure also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of the video playback method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0176] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, the steps of the video playback method described in the above method embodiment can be executed. For details, please refer to the above method embodiment, which will not be repeated here.
[0177] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0178] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment and devices can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0179] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0181] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0182] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A video playback method, characterized in that: The method comprises: When the first video meets the playback start condition, obtaining an initial player recovered from the second video and used when the second video is played after being initialized, wherein the second video is a video played before the first video, and the initial player used when the second video is played is recycled when the number of players to be recycled meets the set number of application software that plays the video; Obtain a first configuration file of the first video; Based on the first configuration file and the initial player, the first video is played.
2. The method according to claim 1, characterized in that Determine that the first video meets the start playback condition by the following steps: When it is detected that the third video has finished playing, it is determined that the first video meets the start playing condition, and the third video is located before the first video and is adjacent to the first video; or When receiving a play operation of the user for the first video, determining that the first video meets the start play condition; The third video and the second video are the same video, or the second video is a video located before the third video.
3. The method according to claim 1, characterized in that The step of playing the first video based on the first configuration file and the initial player includes: Determine a plurality of first playback components of the first video based on the configuration data read from the first configuration file; Adding the first playback component to the initial player to obtain a first player for the first video; Use the first player to play the first video.
4. The method according to claim 3, characterized in that The using the first player to play the first video includes: In the case of acquiring the first player, setting the title and video stream address parameters of the first video for the first player and the player engine of the first player respectively; When the parameter setting is completed, taking over the player engine of the first player; The player engine is controlled to retrieve the video data of the first video, and the first player is driven to load the video data to play the first video.
5. The method according to claim 1, characterized in that When the first video meets the playback start condition, before obtaining the initialized initial player recovered from the second video and used when the second video is played, the method includes: When the second video changes from a playing state to a stopped playing state, reclaiming a second video player used for playing the second video; Initialize the second video player to obtain an initial player.
6. The method according to claim 5, characterized in that The initializing the second video player to obtain an initial player includes: Taking over the second video player used for playing the second video; Clear multiple second playback components of the second video added in the second video player to obtain an initial player.
7. The method according to claim 1, characterized in that The method comprises: When the first video meets the start playing condition, if the initial player of the second video cannot be obtained, a blank player is created, wherein no playing component is added to the blank player; The blank player is used as the initial player recovered from the second video and used to play the first video.
8. A video playback device, characterized in that: The device comprises: A first acquisition module is used to acquire, when a first video meets a condition for starting to play, an initialized initial player that is recycled from a second video and used when the second video is played, wherein the second video is a video that has been played before the first video, and wherein the initial player used when the second video is played is recycled when the number of players to be recycled meets the set number of application software that plays the video; A second acquisition module, used to acquire a first configuration file of the first video; A playing module is used to play the first video based on the first configuration file and the initial player.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the video playback method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the video playing method as claimed in any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Multi-video playing method, storage medium and computer equipment
CN109688473A