WO2022237744A1 - 视频的展示方法、装置、设备及介质 - Google Patents

视频的展示方法、装置、设备及介质 Download PDF

Info

Publication number
WO2022237744A1
WO2022237744A1 PCT/CN2022/091825 CN2022091825W WO2022237744A1 WO 2022237744 A1 WO2022237744 A1 WO 2022237744A1 CN 2022091825 W CN2022091825 W CN 2022091825W WO 2022237744 A1 WO2022237744 A1 WO 2022237744A1
Authority
WO
WIPO (PCT)
Prior art keywords
video data
playback
thread
instance
target video
Prior art date
Application number
PCT/CN2022/091825
Other languages
English (en)
French (fr)
Inventor
姜建华
王辉
严冰
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2022237744A1 publication Critical patent/WO2022237744A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations
    • H04N21/4316Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations for displaying supplemental content in a region of the screen, e.g. an advertisement in a separate window
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/20Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/4424Monitoring of the internal components or processes of the client device, e.g. CPU or memory load, processing speed, timer, counter or percentage of the hard disk space used
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • Embodiments of the present disclosure relate to the technical field of computer data processing, for example, to a video display method, device, device, and medium.
  • short videos are displayed in the same way as long videos, but since the playback duration of short videos (for example, less than a minute or a few minutes) is much shorter than that of long videos (for example, dozens of minutes or more than an hour), based on Due to the display characteristics of short videos, when quickly sliding and switching between short videos, the waiting before each short video takes up a lot of time.
  • Embodiments of the present disclosure provide a video display method, device, equipment, and medium, so as to realize rapid display of videos.
  • an embodiment of the present disclosure provides a method for displaying a video, the method including:
  • An idle playback thread is invoked in a preset thread pool, and the playback instance is run on the idle playback thread to display the target video data.
  • the embodiment of the present disclosure also provides a video display device, which includes:
  • the video data acquisition module is configured to obtain the switched target video data when a video switching instruction is detected
  • the playback instance calling module is set to determine the playback instance corresponding to the encoding method based on the encoding method of the target video data, and calls the playback instance from the preset instance pool, wherein the playback instance is used to process the target video data;
  • the thread calling module is set to call an idle playback thread in the preset thread pool
  • the first video data display module is configured to run the playback instance on the idle playback thread to display the target video data.
  • an embodiment of the present disclosure further provides an electronic device, and the electronic device includes:
  • storage means configured to store at least one program
  • the at least one processor When the at least one program is executed by the at least one processor, the at least one processor is made to implement the video presentation method described in any one of the embodiments of the present disclosure.
  • the embodiments of the present disclosure further provide a storage medium containing computer-executable instructions, the computer-executable instructions are used to execute the video as described in any one of the embodiments of the present disclosure when executed by a computer processor. Show method.
  • FIG. 1 is a flowchart of a video display process provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of a video display method provided in Embodiment 1 of the present disclosure
  • FIG. 3 is a schematic diagram of a video presentation process provided by Embodiment 1 of the present disclosure.
  • FIG. 4 is a frame diagram for displaying a video provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of a video display device provided in Embodiment 2 of the present disclosure.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by Embodiment 3 of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • Video data is displayed through an electronic device with a display screen such as a mobile phone, a tablet computer, or a computer.
  • the above-mentioned electronic device communicates with a server, loads video data from the server, and displays it locally.
  • real-time monitoring of the user's operation on the electronic device such as touch operation on the display screen, selection operation input through the button on the electronic device, or operation input through keyboard, mouse and other input devices, etc., according to the above operations, the displayed video data
  • the above operations can be comments, data uploads, and switching.
  • the video switching operation can be realized by sliding operation detected on the display screen, or by pressing the up and down buttons on the electronic device, which can be input according to the implementation methods of different electronic devices, and is not limited thereto.
  • FIG. 1 is a flowchart of a video presentation process provided by an embodiment of the present disclosure.
  • the user interface (User Interface, UI) thread when detecting that any video is selected to play, sends a preparation instruction and a start instruction to the playback thread, and the selected video data is displayed by the playback thread.
  • the UI thread can send pause and stop instructions to the playback thread according to the user's operation, so as to control the presentation of the video data by the playback thread.
  • a stop playback instruction is sent to the playback thread, or when a stop playback operation is detected, a stop playback instruction is sent to the playback thread, and an instruction to release the playback thread is detected; when a switching operation of video data is detected, it is sent to the playback thread Stop playing instruction, or when detecting the switching operation of video data, send stop playing instruction to playing thread, and the instruction of releasing playing thread, wherein, playing thread executes above-mentioned stopping playing instruction and the instruction of releasing playing thread all have waiting time length.
  • the released playback thread is used to display the next video data corresponding to the switching operation, that is, there is a period of waiting for the end of the previous video data before the next video data is displayed, which blocks the start of the next video data.
  • the switching operation that is, there is a period of waiting for the end of the previous video data before the next video data is displayed, which blocks the start of the next video data.
  • multiple video data are frequently switched, and each switching operation has a waiting time.
  • the present disclosure provides a video display method.
  • Fig. 2 is a schematic flow chart of a video display method provided by Embodiment 1 of the present disclosure.
  • This embodiment of the present disclosure is applicable to the situation of quickly switching and displaying video data during the video display process.
  • This method can be determined by the video display
  • the apparatus may be implemented by means of software and/or hardware, optionally, by electronic equipment, and the electronic equipment may be a mobile terminal or a personal computer (Personal computer, PC) terminal or the like.
  • the method of the present embodiment includes:
  • a preset number of video data adjacent to the current video being displayed is obtained by preloading, wherein the first number of video data before the current video data may be preloaded. video data, and a second amount of video data following the current video data.
  • the order of the video data may be determined according to the order of the video data recommended by the server.
  • the quantity of preloaded video data can be determined according to the current network status, and different network statuses can correspond to different preloading quantities.
  • the current network status is related to the current network speed. The higher the current network speed, the smoother the current network status.
  • the number of preloads is negatively correlated with the current network speed, that is, the higher the current network speed, the smaller the number of preloads.
  • the switching instruction can be generated by checking the sliding operation (such as sliding up and down or sliding left and right, etc.) to switch the video data, or it can be performed according to the switching instruction generated by the end instruction of the current video data playback
  • the switching instruction may include a switching direction, or a video identifier of the target video data to be switched. Determine the target video data to be switched according to the switching operation. For example, if the sliding operation is sliding up, the next video data of the current video data is determined as the target video data; if the sliding operation is sliding down, the current video data is The previous video data of is determined as the target video data.
  • the determination of the target video data is related to the function of the sliding operation, and the target video data may be determined according to the preset function of the sliding operation, which is not limited.
  • the target video data is obtained from the preloaded local video library according to the identification information of the target video data.
  • maintain a video identification list including the video identification of the preloaded video data and the storage location of the preloaded video data in the video identification list.
  • the sequence of the video identifiers in the video identifier list may be the same as the switching sequence of the video data.
  • the switching operation is an upward slide, then It is determined to switch to the next video data, and the video ID next to the video ID of the current video data is determined as the video ID of the target video data. According to the storage location corresponding to the video identifier of the target video data, the target video data is acquired.
  • the switched video data is obtained by preloading, without real-time loading when the video is switched, which saves the loading process of the video data and improves the display efficiency of the first frame of the video.
  • the encoding method may include but not limited to H.265 encoding and H.264 encoding.
  • the preset instance pool includes multiple encoding forms corresponding to For the playback instance, when displaying the target video data, the required playback instance is called from the preset instance pool, which reduces the instantiation process during the display of the target video data.
  • the playback instances in the preset instance pool can be expanded as needed. For example, if there is video data with a newly added encoding method, the playback instance corresponding to the newly added encoding will be added to the preset instance pool, so that it can be displayed later. Called when the video data of the new encoding method is added, which improves the applicability and compatibility of the preset instance pool.
  • a flag bit is set in the preloaded video data, and an encoding identifier is set on the flag bit, and the encoding mode of the video data is determined by reading the encoding identifier.
  • the encoding identifier of the flag in the target video data is read, the encoding mode of the target video data is determined, and the corresponding playback instance is invoked based on the encoding mode of the target video data.
  • the playback instance is used to process the target video data, for example, decode the target video data and so on.
  • calling the playback instance from the preset instance pool includes: if the encoding method of the target video data is different from the encoding method of the current video data before switching, calling the playback instance from the preset instance pool Call the playback instance corresponding to the encoding method of the target video data; if the encoding method of the target video data is the same as the encoding method of the current video data before switching, multiplex the playback instance corresponding to the current video data before switching instance without repeatedly calling the play instance being called.
  • the playback instance corresponding to the current video data before switching is released.
  • the preset instance pool is recycled, and the creation process of the playback instance is reduced.
  • a preset thread pool is preset, and the preset thread pool includes at least two playback threads, which can be recycled.
  • the playback threads are used to display video data.
  • Each playback thread in the preset thread pool can be provided with a state flag, which can be used to quickly determine whether it is called.
  • the state identifier may be an invoking state identifier, for example, 1; when not called, that is, in an idle state, the state identifier may be an idle state identifier, for example, 0.
  • an idle playback thread in the preset thread pool that is, a playback thread identified in an idle state
  • this idle playback thread is any idle thread other than the thread used to display the current video data in the preset thread pool state of the thread.
  • an idle playback thread in the preset thread pool while calling an idle playback thread in the preset thread pool, it also includes: releasing the playback thread corresponding to the current video data before switching, and setting the released playback thread as an idle playback thread.
  • two video data before and after switching are processed through different threads, and an idle playback thread shows the target video data of switching, and the currently called thread ends the current video data being displayed, and the above two processes can be executed synchronously , the two are independent of each other, there is no mutual interference, and the problem of blocking the display of the target video data during the end process of the current video data before switching is avoided.
  • the idle playback thread can be used to display video data when it is called next time, and realize the cycle of the preset thread pool Use, reducing the frequency of creating threads.
  • Fig. 3 is a schematic diagram of a video presentation process provided by Embodiment 1 of the present disclosure.
  • the preset thread pool includes playback thread 0, playback thread 1, and playback thread 2.
  • the number of threads is not limited to that shown in FIG. 3, and may be two, four, etc.
  • Playing thread 0 is used to display the current video data.
  • the UI thread detects the switching command, it calls the playing thread 1 to play the switched target video data.
  • playing thread 0 executes the stop command and the release command.
  • the target video data played by playback thread 1 overlaps with the time when playback thread 0 executes the stop instruction and release instruction, and does not interfere with each other.
  • the above playback thread 0 executes the stop instruction and release instruction in the background. , there is no object waiting process on the display screen, the non-perceptual switching of video data is realized, and the switching speed and switching efficiency of video data are improved.
  • the UI thread can be the main thread, and the UI thread is used to manage the playback thread and execute the display method of the video in this embodiment, for example, receiving a user operation to generate an instruction to the playback thread, and sending the instruction to the playback thread. thread to control the playback thread.
  • control of the playback thread is implemented in the following manner: detecting user operations, and sending control instructions to the message queues of at least one corresponding playback thread according to the user operations, so that each playback thread executes in turn the messages in the corresponding message queues.
  • Control instruction is respectively configured with a message queue, which stores and caches control instructions to be executed, and a plurality of control instructions are first-in, first-out in the message queue to realize the control of the playing thread, and the at least one playing thread interacts with each other. Do not interfere.
  • invoking an idle playback thread in a preset thread pool, and displaying the target video data based on the idle playback thread may be to send a video playback instruction to a message queue corresponding to the idle playback thread called, and the video playback instruction where may be a video identifier configured with target video data.
  • releasing the playback thread corresponding to the current video data before switching may be sending a release instruction to the message queue corresponding to the playback thread corresponding to the current video data before switching.
  • control instructions for controlling the playback thread include but not limited to start instructions, cache instructions, pause instructions, stop instructions and release instructions.
  • the UI thread sequentially sends a prepare instruction, a start instruction, a pause instruction, a stop instruction, and a release instruction to the message queue of the playback thread 0, and sends a prepare instruction and a start instruction to the playback thread 1.
  • At least two playback threads are maintained by setting a preset thread pool, and when any thread is called, the preset thread pool also includes idle playback threads that have not been called.
  • the preset thread pool also includes idle playback threads that have not been called.
  • an idle playback thread is called in the preset thread pool, and the target video data is displayed based on the idle playback thread, without waiting for the called playback thread, and the idle playback thread displays the target
  • the video data and the called playback thread are released without interfering with each other and can be executed synchronously, which reduces the waiting time before the target video data is displayed, realizes non-perceptual switching of video data, and improves the switching speed and switching efficiency of video data.
  • the matching playback instance can be called from the preset instance pool according to the target video data, reducing the process of creating playback instances and instantiation, and improving The switching speed and switching efficiency of video data.
  • FIG. 4 is a frame diagram for displaying videos provided by an embodiment of the present disclosure.
  • the framework includes main thread PlaySessionManager, preset thread pool playThread pool, play session PlaySession, message queue PlayHandler, play session configuration PlaySessionconfig, this framework is used for play session and play thread management, wherein a play instance is called a play session PlaySession.
  • multiple playback sessions PlaySession can run on one playback thread playThread, or each can run on independent playback thread playThread.
  • the default thread pool playThread pool includes at least two playback threads playThread.
  • the subsequent playback session Sessions all run on one playback thread PlayThread. Only one playback session Session is allowed at a time in the Active (no release) state, which is not thread-safe. The preset thread pool is created, recycled, and will call back to the main thread onSessionRelease after the playback thread Play Thread executes the release.
  • FIG. 5 is a schematic structural diagram of a video display device provided in Embodiment 2 of the present disclosure. As shown in FIG. 5 , the device includes: a video data acquisition module 210 , a playback instance calling module 220 , a thread calling module 230 and a first video data display module 240 .
  • the video data acquisition module 210 is configured to obtain the switched target video data when a video switching instruction is detected;
  • the playback instance calling module 220 is configured to determine the playback instance corresponding to the encoding method based on the encoding method of the target video data, and call the playback instance from the preset instance pool;
  • the thread calling module 230 is configured to call an idle playing thread in a preset thread pool
  • the first video data display module 240 is configured to run the playback instance on the idle playback thread to display the target video data.
  • At least two playback threads are maintained by setting a preset thread pool, and when any thread is called, the preset thread pool also includes idle playback threads that have not been called.
  • the preset thread pool also includes idle playback threads that have not been called.
  • an idle playback thread is called in the preset thread pool, and the target video data is displayed based on the idle playback thread, without waiting for the called playback thread, and the idle playback thread displays the target
  • the video data and the called playback thread are released without interfering with each other and can be executed synchronously, which reduces the waiting time before the target video data is displayed, realizes non-perceptual switching of video data, and improves the switching speed and switching efficiency of video data.
  • the device also includes:
  • the thread release module is configured to release the corresponding playback thread of the current video data before switching, and sets the released playback thread as an idle playback thread.
  • the device also includes:
  • the thread control module is configured to detect user operations, and send control instructions to the message queue of at least one corresponding playback thread according to the user operations, so that each playback thread sequentially executes the control instructions in the corresponding message queue, wherein the control Commands include start commands and stop commands.
  • the device also includes:
  • the second video data display module is configured to multiplex the previously called play thread to display the target video data if there is no idle play thread in the preset thread pool.
  • the playback instance calling module is set as:
  • the coding method of the target video data is the same as the coding method of the current video data before switching, multiplex the playback instance corresponding to the current video data before switching.
  • the device also includes:
  • the instance pool update module is configured to release the playback instance corresponding to the current video data before switching if the coding method of the target video data is different from the coding method of the current video data before switching.
  • the switched target video data is obtained by preloading.
  • the device provided in the embodiment of the present disclosure can execute the method provided in any embodiment of the present disclosure, and has corresponding functional modules for executing the method.
  • FIG. 6 it shows a schematic structural diagram of an electronic device (such as the terminal device or server in FIG. 6 ) 400 suitable for implementing the embodiments of the present disclosure.
  • the terminal equipment in the embodiment of the present disclosure may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, personal digital assistant (Personal Digital Assistant, PDA), PAD (tablet computer), portable multimedia player (Portable Media Player) , PMP), mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital televisions (Television, TV), desktop computers, and the like.
  • PDA Personal Digital Assistant
  • PAD portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals)
  • fixed terminals such as digital televisions (Television, TV), desktop computers, and the like.
  • the electronic device shown in FIG. 6 is only an example, and should not limit the functions and scope of use of the embodiments of the present
  • an electronic device 400 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 408 is loaded into the program in the random access memory (Random Access Memory, RAM) 403 to execute various appropriate actions and processes.
  • a processing device such as a central processing unit, a graphics processing unit, etc.
  • RAM Random Access Memory
  • various programs and data necessary for the operation of the electronic device 400 are also stored.
  • the processing device 401, ROM 402, and RAM 403 are connected to each other through a bus 404.
  • An input/output (Input/Output, I/O) interface 405 is also connected to the bus 404 .
  • an input device 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; including, for example, a liquid crystal display (Liquid Crystal Display, LCD) , an output device 407 such as a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409.
  • the communication means 409 may allow the electronic device 400 to perform wireless or wired communication with other devices to exchange data. While FIG. 6 shows electronic device 400 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 409 , or from storage means 408 , or from ROM 402 .
  • the processing device 401 executes the above-mentioned functions defined in the methods of the embodiments of the present disclosure.
  • the electronic device provided in the embodiments of the present disclosure and the video display method provided in the above embodiments belong to the same inventive concept, and technical details not described in detail in this embodiment may refer to the above embodiments.
  • An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method for displaying a video provided in the foregoing embodiment is implemented.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof.
  • Computer-readable storage media may include, but are not limited to, electrical connections having at least one lead, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable Read memory ((Erasable Programmable Read-Only Memory, EPROM) or flash memory), optical fiber, portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or any of the above the right combination.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • the program code contained on the computer readable medium can be transmitted by any appropriate medium, including but not limited to: electric wire, optical cable, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communications (eg, communication networks) are interconnected.
  • Examples of communication networks include local area networks (Local Area Network, LAN), wide area networks (Wide Area Network, WAN), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently existing networks that are known or developed in the future.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries at least one program, and when the above-mentioned at least one program is executed by the electronic device, the electronic device:
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as AT&T, MCI, Sprint, EarthLink, MSN, GTE, etc.
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code that contains at least one programmable logic function for implementing the specified logical function.
  • Execute instructions may also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the unit/module does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Arrays (Field Programmable Gate Arrays, FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (Application Specific Standard Parts, ASSP), System on Chip (System on Chip, SOC), Complex Programmable Logic Device (Complex Programmable Logic Device, CPLD) and so on.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include at least one wire-based electrical connection, a portable computer disk, a hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), or flash memory), optical fiber, compact disc read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • flash memory flash memory
  • optical fiber compact disc read only memory
  • CD-ROM compact disc read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • Example 1 provides a video display method, the method includes:
  • Example 2 provides a video display method, which also includes:
  • Example 3 provides a video display method, which also includes:
  • Detect user operations and send control instructions to the message queue of at least one corresponding playback thread according to the user operations, so that each playback thread sequentially executes the control instructions in the corresponding message queue, wherein the control instructions include a start instruction and a stop instruction. instruction.
  • Example 4 provides a video display method, which also includes:
  • the previously called playback thread is reused to display the target video data.
  • Example 5 provides a video display method, which also includes:
  • calling the playback instance from the preset instance pool includes: if the encoding method of the target video data is different from the encoding method of the current video data before switching, calling the playback instance from the preset instance pool The playback instance corresponding to the coding method of the target video data; if the coding method of the target video data is the same as the coding method of the current video data before switching, then multiplexing the playback instance corresponding to the current video data before switching.
  • Example 6 provides a video display method, which also includes:
  • the method further includes: if the coding method of the target video data is different from the coding method of the current video data before switching, releasing the playback instance corresponding to the current video data before switching.
  • Example 7 provides a video display method, which also includes:
  • the switched target video data is obtained by preloading.
  • Example 8 provides a video display device, which includes:
  • the video data acquisition module is configured to obtain the switched target video data when a video switching instruction is detected
  • the playback instance calling module is set to determine the playback instance corresponding to the encoding method based on the encoding method of the target video data, and calls the playback instance from the preset instance pool, wherein the playback instance is used to process the target video data;
  • the thread calling module is configured to call an idle playing thread in the preset thread pool
  • the first video data display module is configured to display the target video data based on the idle playback thread.

Landscapes

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

Abstract

本公开实施例公开了一种视频的展示方法、装置、存储介质及电子设备,其中方法包括:在检测到视频切换指令时,获取切换后的目标视频数据;基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;在预设线程池中调用一个空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。

Description

视频的展示方法、装置、设备及介质
本申请要求在2021年5月13日提交中国专利局、申请号为202110523090.2的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开实施例涉及计算机数据处理技术领域,例如涉及一种视频的展示方法、装置、设备及介质。
背景技术
随着短视频应用技术的不断发展,越来越多的用户使用或观看短视频。目前,短视频的展示方式和长视频的展示方式相同,但是由于短视频的播放时长(例如小于一分钟或者几分钟)远小于长视频的播放时长(例如几十分钟或一小时以上),基于短视频的展示特性,在各短视频之间的快速滑动切换时,每一个短视频展示之前的等待占用大量时间。
发明内容
本公开实施例提供了一种视频的展示方法、装置、设备及介质,以实现视频的快速展示。
第一方面,本公开实施例提供了一种视频的展示方法,该方法包括:
在检测到视频切换指令时,获取切换后的目标视频数据;
基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;
在预设线程池中调用一个空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
第二方面,本公开实施例还提供了一种视频的展示装置,该装置包括:
视频数据获取模块,设置为在检测到视频切换指令时,获取切换后的目标视频数据;
播放实例调用模块,设置为基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;
线程调用模块,设置为在预设线程池中调用一个空闲播放线程;
第一视频数据展示模块,设置为将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
第三方面,本公开实施例还提供了一种电子设备,所述电子设备包括:
至少一个处理器;
存储装置,设置为存储至少一个程序,
当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如本公开实施例任一所述的视频的展示方法。
第四方面,本公开实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如本公开实施例任一所述的视频的展示方法。
附图说明
贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1是本公开实施例提供的视频展示过程的流程图;
图2为本公开实施例一所提供的一种视频的展示方法流程示意图;
图3是本公开实施例一提供的一种视频展示过程的示意图;
图4是本公开实施例提供的用于进行视频的展示的框架图;
图5是本公开实施例二所提供的一种视频的展示装置结构示意图;
图6为本公开实施例三所提供的一种电子设备结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“至少一个”。
通过诸如手机、平板电脑或计算机等具有显示屏的电子设备展示视频数据,上述电子设备与服务器通信连接,从服务器中加载视频数据,并在本地进行展示。同时实时监测用户对电子设备的操作,例如在显示屏上的触控操作、通过电子设备上按键输入的选择操作或者通过键盘、鼠标等输入设备输入的操作等,根据上述操作对显示的视频数据进行控制,例如上述操作可以是评论、数据上传、以及切换等。对于视频的切换操作,可以是通过在显示屏上检测到的滑动操作,或者通过电子设备上的上下按键的按压操作实现,可根据不同电子设备的实现方式输入,对此不作限定。
参见图1,图1是本公开实施例提供的视频展示过程的流程图。图1中, 当检测到任一视频被选择播放时,用户界面(User Interface,UI)线程向播放线程发送准备指令以及开始指令,由播放线程展示被选择的视频数据。在视频数据的展示过程中,UI线程可根据用户的操作向播放线程发送暂停以及停止播放的指令,以控制播放线程对视频数据的展示。当检测到停止播放操作向播放线程发送停止播放指令,或者当检测到停止播放操作向播放线程发送停止播放指令,以及释放播放线程的指令;当检测到视频数据的切换操作时,向播放线程发送停止播放指令,或者当检测到视频数据的切换操作时,向播放线程发送停止播放指令,以及释放播放线程的指令,其中,播放线程执行上述停止播放指令和释放播放线程的指令均存在等待时长。被释放的播放线程用于展示切换操作对应的下一视频数据,即在下一视频数据展示之前存在等待上一视频数据结束的时长,对下一视频数据的起播形成阻塞。尤其是在短视频的展示场景下,多个视频数据之间频繁切换,且每一个切换操作均存在等待时长。
需要说明的是,图1中使用异步线程,虽不阻塞主线程,当仍会阻塞进行播放的子线程,导致本次播放行为内核其他初始化,包括读取首帧数据等操作,被阻塞,从而增加首帧时长。
针对上述技术问题,本公开提供了一种视频的展示方法。
实施例一
图2为本公开实施例一所提供的一种视频的展示方法流程示意图,本公开实施例适用于在视频的展示过程中,对视频数据进行快速切换展示的情形,该方法可以由视频的展示装置来执行,该装置可以通过软件和/或硬件的形式实现,可选的,通过电子设备来实现,该电子设备可以是移动终端或个人电脑(Personal computer,PC)端等。
如图2,本实施例的方法包括:
S110、在检测到视频切换指令时,获取切换后的目标视频数据。
S120、基于所述目标视频数据的编码方式,确定所述编码方式对应的播放 实例,从预设实例池中调用所述播放实例。
S130、在预设线程池中调用一空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
本实施例中,在视频展示的过程中,通过预加载的方式获取与正在展示的当前视频相邻的预设数量的视频数据,其中,可以是预加载在当前视频数据之前的第一数量的视频数据,以及在当前视频数据之后的第二数量的视频数据。其中,视频数据的顺序可以是根据服务器推荐的视频数据的顺序确定。预加载的视频数据的数量可以是根据当前网络状态确定,不同网络状态可以是对应不同的预加载数量,例如当前网络状态与当前网速相关,当前网速越高,当前网络状态越顺畅。可选的,预加载数量与当前网速负相关,即当前网速越高,预加载数量越少。在当前网速低的情况下,增加预加载的视频数据的数量,避免用户在视频数据的频繁切换时无法保证所切换的视频数据无法及时加载的问题,保证视频数据的快速展示;在当前网速高的情况下,减少预加载的视频数据的数量,在每一个视频数据的展示过程中,可快速对邻近的视频数据进行快速加载,同时避免预加载大量视频数据导致的流量浪费的问题。
在任一视频数据的展示过程中,可以是通过检查到的滑动操作(例如上下滑动或者左右滑动等)生成切换指令进行视频数据的切换,还可以是根据当前视频数据播放结束指令生成的切换指令进行视频数据的切换,该切换指令中可以包括切换方向,或者切换的目标视频数据的视频标识。根据切换操作确定切换的目标视频数据,示例性的,若滑动操作为向上滑动,则将当前视频数据的下一视频数据确定为目标视频数据,若滑动操作为向下滑动,则将当前视频数据的上一视频数据确定为目标视频数据。此处,目标视频数据的确定与滑动操作的功能相关,可根据预先设置的滑动操作的功能确定目标视频数据,对此不作限定。
根据目标视频数据的标识信息在预加载的本地视频库中获取该目标视频数据。可选的,维护一视频标识列表,该视频标识列表中包括预加载的视频数据 的视频标识以及预加载的视频数据的存储位置。该视频标识列表中视频标识的顺序可以是与视频数据的切换顺序相同。在检测到切换操作时,在视频标识列表确定当前视频数据的视频标识,根据切换操作的切换方向以当前视频数据的视频标识为基准确定目标视频数据的视频标识,例如切换操作为向上滑动,则确定切换为下一视频数据,将当前视频数据的视频标识的下一视频标识确定为目标视频数据的视频标识。根据该目标视频数据的视频标识对应的存储位置,获取目标视频数据。
通过预加载方式获取切换的视频数据,无需在视频切换时实时加载,节省了视频数据的加载过程,提高了视频的首帧展示效率。
不同编码形式的视频数据应用不同的播放实例。示例性的,编码方式可以是包括但不限于H.265编码和H.264编码,本实施例中,通过设置并维护一预设实例池,该预设实例池中包括多种编码形式对应的播放实例,在进行目标视频数据的展示时,从预设实例池中调用所需的播放实例,减少了在目标视频数据的展示过程中的实例化过程。
预设实例池中的播放实例可按需扩展,示例性的,若存在新增编码方式的视频数据,则将该新增编码对应的播放实例添加到预设实例池中,便于后续在展示该新增编码方式的视频数据时调用,提高了预设实例池的适用性和兼容性。
其中,预加载的视频数据中均设置有一标志位,该标志位上设置编码标识,通过读取该编码标识确定视频数据的编码方式。相应的,在获取目标视频数据之后,读取目标视频数据中的标志位的编码标识,确定目标视频数据的编码方式,基于该目标视频数据的编码方式调用对应的播放实例。该播放实例用于处理目标视频数据,例如对目标视频数据进行解码处理等。
在上述实施例的基础上,从预设实例池中调用所述播放实例,包括:若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则从预设实例池中调用所述目标视频数据的编码方式对应的播放实例;若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式相同,则复用所述切换 前的当前视频数据所对应的播放实例,无需重复调用正在被调用的播放实例。
在上述实施例的基础上,若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则释放切换前的当前视频数据对应的播放实例。通过对切换前的当前视频数据对应的播放实例进行释放,实现对预设实例池的循环使用,减少了播放实例的创建过程。
本实施例中,预先设置一预设线程池,该预设线程池中包括至少两个播放线程,且可以循环使用,该播放线程用于展示视频数据。预设线程池中每个播放线程中可以是设置有状态标识,可通过状态标识快速确定是否被调用。例如,被调用时,状态标识可以是调用状态标识,例如为1,未被调用即处于空闲状态时,状态标识可以是空闲状态标识,例如为0。在检测到切换指令时,在预设线程池中确定空闲播放线程,即空闲状态标识的播放线程,该空闲播放线程是预设线程池中用于展示当前视频数据的线程以外的任一处于空闲状态的线程。基于该空闲播放线程展示切换的目标视频数据,无需等待切换前的当前视频数据的结束过程,即无需等待用于展示当前视频数据的线程的释放过程,加快了对目标视频数据的展示过程,提高了视频数据切换的效率。
在上述实施例的基础上,在预设线程池中调用一空闲播放线程的同时,还包括:释放切换前的当前视频数据所对应的播放线程,将被释放的播放线程设置为空闲播放线程。本实施例中,通过不同的线程处理切换前后的两个视频数据,一空闲播放线程展示切换的目标视频数据,当前被调用的线程结束正在展示的当前视频数据,上述两个过程可以是同步执行,二者相互独立,不存在相互干扰,避免了切换前的当前视频数据的结束过程阻塞目标视频数据展示的问题。
将被释放的播放线程设置为空闲播放线程,例如可以是将该播放线程的状态标识设置为空闲状态标识,该空闲播放线程可用于在下一次被调用时展示视频数据,实现预设线程池的循环使用,减少了创建线程的频率。
示例性的,参见图3,图3是本公开实施例一提供的一种视频展示过程的 示意图。预设线程池中包括播放线程0、播放线程1和播放线程2,在一些可选实施例中,不局限于图3中线程数量,还可以是两个、四个等。播放线程0用于展示当前视频数据,在UI线程检测到切换指令时,调用播放线程1播放切换的目标视频数据,同时播放线程0执行停止stop指令和释放release指令。由图3可知,播放线程1播放切换的目标视频数据与播放线程0执行停止stop指令和释放release指令的时间重叠,且互不干扰,上述播放线程0执行停止stop指令和释放release指令在后台执行,并不在显示屏上存在对象的等待过程,实现视频数据的无感知切换,提高了视频数据的切换速度和切换效率。
本实施例中,UI线程可以为主线程,UI线程用于进行播放线程的管理,执行本实施例中的视频的展示方法,例如接收用户操作生成对播放线程的指令,并将指令发送至播放线程,以控制播放线程。
可选的,对播放线程的控制通过如下方式实现:检测用户操作,根据所述用户操作向对应的至少一个播放线程的消息队列发送控制指令,以使每个播放线程依次执行对应消息队列中的控制指令。其中,每一个播放线程分别配置有一消息队列,存储缓存待执行的控制指令,多个控制指令在消息队列中先进先出,实现对该播放线程的控制,且所述至少一个播放线程之间互不干扰。示例性的,在预设线程池中调用一空闲播放线程,基于所述空闲播放线程展示所述目标视频数据,可以是向调用的空闲播放线程对应的消息队列发送视频播放指令,该视频播放指令中可以是配置有目标视频数据的视频标识。示例性的,释放切换前的当前视频数据所对应的播放线程可以是向切换前的当前视频数据所对应的播放线程对应的消息队列发送释放指令。
其中,用于控制播放线程的控制指令包括但不限于启动指令、缓存指令、暂停指令、停止指令和释放指令。示例性的,参见图3,UI线程依次向播放线程0的消息队列发送prepare指令、start指令、pause指令、stop指令和release指令,向播放线程1发送prepare指令和start指令。
在上述实施例的基础上,任一播放线程执行stop指令以及执行release指令 慢,导致该播放线程被长时间占用,在预设线程池中空闲播放线程耗尽并不能再扩充线程池(core==max),即预设线程池不存在空闲播放线程,复用前一被调用的播放线程(即最近一次被调用的播放线程)展示所述目标视频数据。
本公开实施例的技术方案,通过设置预设线程池,维护至少两个播放线程,在任一线程被调用时,该预设线程池中还包括未被调用的空闲播放线程。在视频数据的展示过程中,检测到切换指令时,在预设线程池中调用一空闲播放线程,基于空闲播放线程展示目标视频数据,无需等待已被调用的播放线程,且空闲播放线程展示目标视频数据和已被调用的播放线程进行释放互不干预,可同步执行,减少了目标视频数据展示前的等待时长,实现视频数据的无感知切换,提高了视频数据的切换速度和切换效率。同时,通过创建预设实例池,维护多种编码方式对应的播放实例,可根据目标视频数据从预设实例池中调用相匹配的播放实例,减少了创建播放实例以及实例化的过程,提高了视频数据的切换速度和切换效率。
在上述实施例的基础上,还提供了用于进行视频的展示的框架,示例性的,参见图4,图4是本公开实施例提供的用于进行视频的展示的框架图。该框架包括主线程PlaySessionManager、预设线程池playThread pool、播放会话PlaySession、消息队列PlayHandler、播放会话配置PlaySessionconfig,该框架用于播放会话和播放线程管理,其中把一个播放实例称为一次播放会话PlaySession。其中,多个播放会话PlaySession可以运行在一个播放线程playThread上,也可以各自运行在独立的播放线程playThread上。预设线程池playThread pool中包括至少两个播放线程playThread,若播放会话PlaySession超过播放线程的数量Max时,后续播放会话Session都跑在一个播放线程PlayThread上。一次只允许一个播放会话Session在Active(没有release)状态,非线程安全。预设线程池创建、回收以及在播放线程Play Thread执行完release后会回调到主线程onSessionRelease。
实施例二
图5是本公开实施例二所提供的一种视频的展示装置结构示意图。如图5所示,所述装置包括:视频数据获取模块210、播放实例调用模块220、线程调用模块230以及第一视频数据展示模块240。
其中,视频数据获取模块210,设置为在检测到视频切换指令时,获取切换后的目标视频数据;
播放实例调用模块220,设置为基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例;
线程调用模块230,设置为在预设线程池中调用一空闲播放线程;
第一视频数据展示模块240,设置为将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
本公开实施例的技术方案,通过设置预设线程池,维护至少两个播放线程,在任一线程被调用时,该预设线程池中还包括未被调用的空闲播放线程。在视频数据的展示过程中,检测到切换指令时,在预设线程池中调用一空闲播放线程,基于空闲播放线程展示目标视频数据,无需等待已被调用的播放线程,且空闲播放线程展示目标视频数据和已被调用的播放线程进行释放互不干预,可同步执行,减少了目标视频数据展示前的等待时长,实现视频数据的无感知切换,提高了视频数据的切换速度和切换效率。
在上述技术方案的基础上,该装置还包括:
线程释放模块,设置为释放切换前的当前视频数据所对应的播放线程,将被释放的播放线程设置为空闲播放线程。
在上述技术方案的基础上,该装置还包括:
线程控制模块,设置为检测用户操作,根据所述用户操作向对应的至少一个播放线程的消息队列发送控制指令,以使每个播放线程依次执行对应消息队列中的控制指令,其中,所述控制指令包括启动指令和停止指令。
在上述技术方案的基础上,该装置还包括:
第二视频数据展示模块,设置为若所述预设线程池不存在空闲播放线程,则复用前一被调用的播放线程展示所述目标视频数据。
在上述技术方案的基础上,播放实例调用模块设置为:
若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则从预设实例池中调用所述目标视频数据的编码方式对应的播放实例;
若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式相同,则复用所述切换前的当前视频数据所对应的播放实例。
在上述技术方案的基础上,该装置还包括:
实例池更新模块,设置为若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则释放切换前的当前视频数据对应的播放实例。
在上述技术方案的基础上,所述切换后的目标视频数据通过预加载方式获取。
本公开实施例所提供的装置可执行本公开任意实施例所提供的方法,具备执行方法相应的功能模块。
值得注意的是,上述装置所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的名称也只是为了便于相互区分,并不用于限制本公开实施例的保护范围。
实施例三
下面参考图6,其示出了适于用来实现本公开实施例的电子设备(例如图6中的终端设备或服务器)400的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、PAD(平板电脑)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(Television,TV)、台式计算机等等的固定终端。图6示 出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,电子设备400可以包括处理装置(例如中央处理器、图形处理器等)401,其可以根据存储在只读存储器(Read-Only Memory,ROM)402中的程序或者从存储装置408加载到随机访问存储器(Random Access Memory,RAM)403中的程序而执行各种适当的动作和处理。在RAM403中,还存储有电子设备400操作所需的各种程序和数据。处理装置401、ROM 402以及RAM403通过总线404彼此相连。输入/输出(Input/Output,I/O)接口405也连接至总线404。
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置408;以及通信装置409。通信装置409可以允许电子设备400与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置408被安装,或者从ROM402被安装。在该计算机程序被处理装置401执行时,执行本公开实施例的方法中限定的上述功能。
本公开实施例提供的电子设备与上述实施例提供的视频的展示方法属于同一发明构思,未在本实施例中详尽描述的技术细节可参见上述实施例。
实施例四
本公开实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的视频的展示方法。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有至少一个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器((Erasable Programmable Read-Only Memory,EPROM)或闪存)、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc 端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有至少一个程序,当上述至少一个程序被该电子设备执行时,使得该电子设备:
在检测到视频切换指令时,获取切换后的目标视频数据;
基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例;
在预设线程池中调用一空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含至少一个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是, 框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元/模块的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由至少一个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于至少一个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的至少一个实施例,【示例一】提供了一种视频的展示方法,该方法包括:
在检测到视频切换指令时,获取切换后的目标视频数据;
基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例, 从预设实例池中调用所述播放实例;
在预设线程池中调用一空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
根据本公开的至少一个实施例,【示例二】提供了一种视频的展示方法,还包括:
可选的,在预设线程池中调用一空闲播放线程的同时,还包括:
释放切换前的当前视频数据所对应的播放线程,将被释放的播放线程设置为空闲播放线程。
根据本公开的至少一个实施例,【示例三】提供了一种视频的展示方法,还包括:
检测用户操作,根据所述用户操作向对应的至少一个播放线程的消息队列发送控制指令,以使每个播放线程依次执行对应消息队列中的控制指令,其中,所述控制指令包括启动指令和停止指令。
根据本公开的至少一个实施例,【示例四】提供了一种视频的展示方法,还包括:
可选的,若所述预设线程池不存在空闲播放线程,则复用前一被调用的播放线程展示所述目标视频数据。
根据本公开的至少一个实施例,【示例五】提供了一种视频的展示方法,还包括:
可选的,所述从预设实例池中调用所述播放实例,包括:若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则从预设实例池中调用所述目标视频数据的编码方式对应的播放实例;若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式相同,则复用所述切换前的当前视频数据所对应的播放实例。
根据本公开的至少一个实施例,【示例六】提供了一种视频的展示方法,还包括:
可选的,所述方法还包括:若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则释放切换前的当前视频数据对应的播放实例。
根据本公开的至少一个实施例,【示例七】提供了一种视频的展示方法,还包括:
可选的,所述切换后的目标视频数据通过预加载方式获取。
根据本公开的至少一个实施例,【示例八】提供了一种视频的展示装置,该装置包括:
视频数据获取模块,设置为在检测到视频切换指令时,获取切换后的目标视频数据;
播放实例调用模块,设置为基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;
线程调用模块,设置为在预设线程池中调用一空闲播放线程;
第一视频数据展示模块,设置为基于所述空闲播放线程展示所述目标视频数据。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (10)

  1. 一种视频的展示方法,包括:
    在检测到视频切换指令时,获取切换后的目标视频数据;
    基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;
    在预设线程池中调用一个空闲播放线程,将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
  2. 根据权利要求1所述的方法,在预设线程池中调用一个空闲播放线程的同时,还包括:
    释放切换前的当前视频数据所对应的播放线程,将被释放的播放线程设置为空闲播放线程。
  3. 根据权利要求1或2所述的方法,还包括:检测用户操作,根据所述用户操作向对应的至少一个播放线程的消息队列发送控制指令,以使每个播放线程依次执行对应消息队列中的控制指令,其中,所述控制指令包括启动指令和停止指令。
  4. 根据权利要求1所述的方法,其中,若所述预设线程池不存在空闲播放线程,则复用前一被调用的播放线程展示所述目标视频数据。
  5. 根据权利要求1所述的方法,其中,所述从预设实例池中调用所述播放实例,包括:
    若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则从预设实例池中调用所述目标视频数据的编码方式对应的播放实例;
    若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式相同,则复用所述切换前的当前视频数据所对应的播放实例。
  6. 根据权利要求5所述的方法,还包括:
    若所述目标视频数据的编码方式与切换前的当前视频数据的编码方式不同,则释放切换前的当前视频数据对应的播放实例。
  7. 根据权利要求1所述的方法,其中,所述切换后的目标视频数据通过预加载方式获取。
  8. 一种视频的展示装置,包括:
    视频数据获取模块,设置为在检测到视频切换指令时,获取切换后的目标视频数据;
    播放实例调用模块,设置为基于所述目标视频数据的编码方式,确定所述编码方式对应的播放实例,从预设实例池中调用所述播放实例,其中,所述播放实例用于处理目标视频数据;
    线程调用模块,设置为在预设线程池中调用一个空闲播放线程;
    第一视频数据展示模块,设置为将所述播放实例运行在所述空闲播放线程上,以展示所述目标视频数据。
  9. 一种电子设备,包括:
    至少一个处理器;
    存储装置,设置为存储至少一个程序,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-7中任一所述的视频的展示方法。
  10. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-7中任一所述的视频的展示方法。
PCT/CN2022/091825 2021-05-13 2022-05-10 视频的展示方法、装置、设备及介质 WO2022237744A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110523090.2A CN113259744B (zh) 2021-05-13 2021-05-13 视频的展示方法、装置、设备及介质
CN202110523090.2 2021-05-13

Publications (1)

Publication Number Publication Date
WO2022237744A1 true WO2022237744A1 (zh) 2022-11-17

Family

ID=77183272

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/091825 WO2022237744A1 (zh) 2021-05-13 2022-05-10 视频的展示方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN113259744B (zh)
WO (1) WO2022237744A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259744B (zh) * 2021-05-13 2023-08-01 北京字跳网络技术有限公司 视频的展示方法、装置、设备及介质
CN114721800A (zh) * 2022-04-06 2022-07-08 北京字节跳动网络技术有限公司 一种音频线程处理方法、装置、计算机设备和存储介质
CN115460469B (zh) * 2022-08-24 2024-06-11 网易(杭州)网络有限公司 多视频播放的处理方法、装置、计算机设备及存储介质
CN117750108A (zh) * 2023-12-01 2024-03-22 书行科技(北京)有限公司 视频页面切换方法、装置、介质及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688473A (zh) * 2018-12-07 2019-04-26 广州市百果园信息技术有限公司 多视频播放方法及存储介质、计算机设备
WO2019085574A1 (zh) * 2017-10-30 2019-05-09 广州虎牙信息科技有限公司 视频播放控制方法、装置及终端
CN110213659A (zh) * 2019-07-01 2019-09-06 杭州当虹科技股份有限公司 一种可在不同视频流间快速切换播放器的实现方法
CN111935543A (zh) * 2020-09-09 2020-11-13 北京搜狐新动力信息技术有限公司 视频的播放方法、装置、电子设备及计算机存储介质
CN113259744A (zh) * 2021-05-13 2021-08-13 北京字跳网络技术有限公司 视频的展示方法、装置、设备及介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100169892A1 (en) * 2008-12-29 2010-07-01 Advanced Micro Devices, Inc. Processing Acceleration on Multi-Core Processor Platforms
CN107295285B (zh) * 2017-08-11 2018-07-27 腾讯科技(深圳)有限公司 视频数据的处理方法、处理装置及存储介质
CN109992414A (zh) * 2019-03-12 2019-07-09 平安普惠企业管理有限公司 一种基于线程池的任务处理方法及装置
CN112087633B (zh) * 2019-06-12 2022-08-09 腾讯科技(深圳)有限公司 视频解码方法、装置及存储介质
CN110430461A (zh) * 2019-08-28 2019-11-08 腾讯科技(深圳)有限公司 一种控制视频播放的方法、装置及视频播放设备
CN111460211A (zh) * 2020-04-03 2020-07-28 北京字节跳动网络技术有限公司 音频信息播放方法、装置和电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019085574A1 (zh) * 2017-10-30 2019-05-09 广州虎牙信息科技有限公司 视频播放控制方法、装置及终端
CN109688473A (zh) * 2018-12-07 2019-04-26 广州市百果园信息技术有限公司 多视频播放方法及存储介质、计算机设备
CN110213659A (zh) * 2019-07-01 2019-09-06 杭州当虹科技股份有限公司 一种可在不同视频流间快速切换播放器的实现方法
CN111935543A (zh) * 2020-09-09 2020-11-13 北京搜狐新动力信息技术有限公司 视频的播放方法、装置、电子设备及计算机存储介质
CN113259744A (zh) * 2021-05-13 2021-08-13 北京字跳网络技术有限公司 视频的展示方法、装置、设备及介质

Also Published As

Publication number Publication date
CN113259744B (zh) 2023-08-01
CN113259744A (zh) 2021-08-13

Similar Documents

Publication Publication Date Title
WO2022237744A1 (zh) 视频的展示方法、装置、设备及介质
CN109542614B (zh) 资源配置方法、装置、终端及存储介质
WO2022262470A1 (zh) 视频处理方法、装置、存储介质及电子设备
WO2022068488A1 (zh) 消息发送的控制方法、装置、电子设备及计算机可读存储介质
EP4152757A1 (en) Video playback method and apparatus, storage medium, and electronic device
WO2023165370A1 (zh) 一种信息交互方法、装置、显示设备及存储介质
WO2022199426A1 (zh) 视频的展示方法、装置、电子设备和存储介质
EP4333440A1 (en) Video interaction method and apparatus, electronic device, and storage medium
WO2023000888A1 (zh) 云应用的实现方法、装置、电子设备和存储介质
US20220394333A1 (en) Video processing method and apparatus, storage medium, and electronic device
US20240078638A1 (en) Image fusion method and apparatus, electronic device, and storage medium
EP4113985A1 (en) Multimedia conference data processing method and apparatus, and electronic device
CN114201705A (zh) 视频处理方法、装置、电子设备及存储介质
WO2020238241A1 (zh) 媒体对象的播放方法、装置、电子设备及存储介质
US20220269714A1 (en) Multimedia information processing method, apparatus, electronic device, and medium
WO2022148231A1 (zh) 应用程序启动控制方法、装置、电子设备和存储介质
CN111818383A (zh) 视频数据的生成方法、系统、装置、电子设备及存储介质
WO2022037552A1 (zh) 内容展示方法及装置
CN114765691B (zh) 视频直播的功能组件加载方法、数据处理方法及设备
CN110457522B (zh) 信息分享的方法及装置、终端和存储介质
WO2023134509A1 (zh) 视频推流方法、装置、终端设备及存储介质
CN110611847B (zh) 视频预览的方法、装置、存储介质及电子设备
WO2023169262A1 (zh) 一种视频动态下载方法、装置、电子设备及存储介质
CN111460211A (zh) 音频信息播放方法、装置和电子设备
CN114025116B (zh) 视频生成方法、装置、可读介质和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22806707

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE