CN110933482B - Video loading method and device, computer readable storage medium and computer equipment - Google Patents
Video loading method and device, computer readable storage medium and computer equipment Download PDFInfo
- Publication number
- CN110933482B CN110933482B CN201911245148.0A CN201911245148A CN110933482B CN 110933482 B CN110933482 B CN 110933482B CN 201911245148 A CN201911245148 A CN 201911245148A CN 110933482 B CN110933482 B CN 110933482B
- Authority
- CN
- China
- Prior art keywords
- video
- video data
- loaded
- playing
- segment
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 105
- 238000000034 method Methods 0.000 claims abstract description 32
- 230000004044 response Effects 0.000 claims description 20
- 238000004806 packaging method and process Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 14
- 230000008569 process Effects 0.000 claims description 14
- 238000006243 chemical reaction Methods 0.000 claims description 12
- 230000006870 function Effects 0.000 claims description 9
- 238000000926 separation method Methods 0.000 claims 2
- 239000002699 waste material Substances 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 12
- 238000005538 encapsulation Methods 0.000 description 10
- 230000001960 triggered effect Effects 0.000 description 6
- 230000000903 blocking effect Effects 0.000 description 5
- 238000005457 optimization Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000036316 preload Effects 0.000 description 3
- 238000009877 rendering Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 239000008186 active pharmaceutical agent Substances 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/433—Content storage operation, e.g. storage operation in response to a pause request, caching operations
- H04N21/4334—Recording operations
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/44004—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/442—Monitoring 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/44204—Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47217—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Computer Networks & Wireless Communication (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application relates to a video loading method, a video loading device, a computer readable storage medium and computer equipment, wherein the method comprises the following steps: when a video is played, acquiring a video playing position; determining the video time interval of the video to be loaded according to the video playing position and the preset time length to be loaded; when at least a part of video data in the video time interval is not loaded in a video buffer container, downloading the at least a part of video data from a server; loading the at least a portion of the downloaded video data into the video buffer container. The scheme provided by the application can avoid the waste of data flow and effectively ensure the loading efficiency of the video.
Description
Technical Field
The present application relates to the field of video technologies, and in particular, to a video loading method and apparatus, a computer-readable storage medium, and a computer device.
Background
With the wide application of various intelligent terminals, people are more and more accustomed to watching videos through the intelligent terminals, and generally, users watch videos online most of the time, that is, the videos are watched and loaded in a streaming media mode.
When the video is played by the application, the video is loaded in a short time in a preloading mode, so that the user can avoid excessive buffering waiting time. However, in order to avoid consuming too much traffic for downloading the video, the video downloading speed is usually limited, and the video playing may be jammed due to the limited downloading speed.
Disclosure of Invention
Based on this, it is necessary to provide a video loading method, an apparatus, a computer-readable storage medium and a computer device for solving the technical problem of video playing pause caused by limiting the speed of downloading video.
A video loading method, comprising:
when a video is played, acquiring a video playing position;
determining the video time interval of the video to be loaded according to the video playing position and the preset time length to be loaded;
when at least a part of video data in the video time interval is not loaded in a video buffer container, downloading the at least a part of video data from a server;
loading the at least a portion of the downloaded video data into the video buffer container.
A video loading device, the device comprising:
the acquisition module is used for acquiring a video playing position when a video is played;
the determining module is used for determining the video time period of the video to be loaded according to the video playing position and the preset duration to be loaded;
a downloading module, configured to download at least a portion of video data from a server when the at least a portion of video data is not loaded in a video buffer container in the video period;
and the loading module is used for loading the downloaded at least part of video data to the video buffer container.
A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to perform the steps of the video loading method.
A computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the video loading method.
According to the video loading method, the video loading device, the computer readable storage medium and the computer equipment, the current video playing position is obtained in time, the video time period of the video to be loaded is determined according to the video playing position and the preset time length to be loaded, and the corresponding video data is downloaded according to the video time period of the video to be loaded, so that the video to be played in the future can be effectively preloaded, and the problem of pause in playing is avoided. In addition, before downloading the video data, whether the video data in the video time interval is loaded in the video buffer container is judged, if at least one part of the video data is not loaded in the video buffer container, at least one part of the video data which is not loaded in the video buffer container is downloaded, and then the video data is loaded in the video buffer container, so that the problem of repeated loading of the video data is avoided. Moreover, the video playing position and the preset time length to be loaded determine the video time period of the video to be loaded, so that the network speed is not required to be limited, the video data in the video time period can be loaded in a short time, the waste of data flow is avoided, and the video loading efficiency is effectively ensured.
Drawings
FIG. 1 is a diagram of an exemplary video loading system;
FIG. 2 is a flow diagram illustrating a video loading method according to one embodiment;
FIG. 3 is a schematic diagram of an interface for playing a video in one embodiment;
FIG. 4 is a flowchart illustrating the steps of decoding and playing video according to one embodiment;
FIG. 5 is a flowchart illustrating the steps of downloading, repackaging, decoding, and playing a first segment of video data of a video according to one embodiment;
FIG. 6 is a flowchart illustrating a video loading method according to another embodiment;
FIG. 7 is a diagram illustrating a video loading method in accordance with another embodiment;
FIG. 8 is a comparison of the time consumed by playing the first frame;
FIG. 9 is a block diagram showing the construction of a video loader according to an embodiment;
FIG. 10 is a block diagram showing the construction of a video loading apparatus according to another embodiment;
FIG. 11 is a block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a diagram of an application environment of a video loading method in one embodiment. Referring to fig. 1, the video loading method is applied to a video loading system. The video loading system includes a terminal 110 and a cloud server 120. The terminal 110 and the cloud server 120 are connected via a network. The terminal 110 downloads video data from the cloud server 120, and acquires a video playing position when playing a video; determining a video time period of a video to be loaded according to the video playing position and a preset time length to be loaded; when at least a part of the video data in the video period is not loaded in the video buffer container, downloading at least a part of the video data from the cloud server 120; and loading at least part of the downloaded video data into a video buffer container.
The terminal 110 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a notebook computer, and the like. The cloud server 120 may be implemented as a stand-alone server or a server cluster composed of a plurality of servers.
Cloud storage (cloud storage) is a new concept extended and developed from a cloud computing concept, and a distributed cloud storage system (hereinafter, referred to as a storage system) refers to a storage system which integrates a large number of cloud servers 120 of different types in a network through application software or application interfaces to cooperatively work through functions such as cluster application, a grid technology, a distributed storage file system and the like, and provides data storage and service access functions to the outside.
At present, a storage method of a storage system is as follows: logical volumes are created, and when created, each logical volume is allocated physical storage space, which may be the disk composition of a certain storage device or of several storage devices. The client stores data on a certain logical volume, that is, the data is stored on a file system, the file system divides the data into a plurality of parts, each part is an object, the object not only contains the data but also contains additional information such as data identification (ID, ID entry), the file system writes each object into a physical storage space of the logical volume, and the file system records storage location information of each object, so that when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object.
The process of allocating physical storage space for the logical volume by the storage system specifically includes: physical storage space is divided in advance into stripes according to a group of capacity measures of objects stored in a logical volume (the measures often have a large margin with respect to the capacity of the actual objects to be stored) and Redundant Array of Independent Disks (RAID), and one logical volume can be understood as one stripe, thereby allocating physical storage space to the logical volume.
In one embodiment, as shown in FIG. 2, a video loading method is provided. The embodiment is mainly illustrated by applying the method to the terminal 110 in fig. 1. Referring to fig. 2, the video loading method specifically includes the following steps:
s202, when the video is played, the video playing position is obtained.
In one embodiment, the terminal plays a video through a webpage, and in the process of playing the video, the video playing position is obtained. The video playing position may be a position played according to a normal playing sequence, or a playing position jumped to according to an input control instruction, so as to load video data after the video playing position.
The web page may be a web page constructed by HTML (Hyper Text Markup Language) version 5, that is, HTML5, or a web page constructed by a subsequent version of HTML 5. The web page may be a stand-alone browser, such as a computer-based browser, a cell phone-based browser, a tablet computer-based browser, and the like. In addition, the web page may also be a web page embedded in an application program, such as a browser embedded in a social application.
For example, assuming that the total duration of a video is 3 minutes and 4 seconds, playing the video through a web page, and when playing to the point a according to the normal playing sequence, acquiring the time corresponding to playing to the point a, where the time is the current video playing position. And when jumping to the point A according to a control instruction input by a user, acquiring the time corresponding to the time when the video is played to the point A, wherein the time is the current video playing position.
Taking HTML5 web page as an example, a video tag, attributes corresponding to the video tag, and an API (Application Programming Interface) are newly added to HTML 5. The video tags define videos, such as movie clips or other video streams. The corresponding video can be played in the webpage through the video tag. Attributes and APIs in the video tag can be referred to as table 1 and table 2 below, respectively.
TABLE 1 Properties of video tags
Properties | Value of | Description of functions |
controls (control) | controls | Whether to display playing control |
autoplay (automatic playing) | autoplay | Automatic playing after setting whether to open webpage |
width (wide) | pilex (Pixel) | Setting the width of the player |
height (high) | pilex | Setting the height of the player |
Loop (circulation) | loop | Setting whether the video is played circularly |
preloads (preload) | preload | Setting whether to play after loading |
src (resource) | url | Setting url address of video to be played |
poster (Picture) | imgurl | Setting initial default display picture of player |
Autobuffer (buffer) | autobuffer | Setting browser buffer mode |
Wherein, if the Autobuffer is not set, the Autoply is valid.
The API provided in the Video tag can be directly called by the JS, and the API is as follows:
TABLE 2 API for video tags
For example, the video tags are: < video src = "xxx. Mp4" controls = "controls" >, the src attribute functions to set a URL (Uniform Resource Locator) address of a video to be played, and the control attribute functions to indicate whether a play control is displayed.
In one embodiment, when the video starts to be played, the terminal loads the native player through the webpage, plays the video through the native player, and acquires the video playing position in real time in the process of playing the video.
The native player can be a native player carried by the system or an installed third-party native player. Native players, which may also be referred to as Native players, use system Native code generated players. For example, for the android system, the native player may be a player generated using android system native JAVA code.
In one embodiment, before S202, the terminal performs data interaction with a cloud server (hereinafter, referred to as a server) through an XHR (XMLHttpRequest) object of the web page, so that video data can be downloaded from the server.
And S204, determining the video time period of the video to be loaded according to the video playing position and the preset time length to be loaded.
The preset duration to be loaded may refer to: when loading video data, the length of time required to load the video. The preset loading duration may be a default step length of the system, may be automatically set by the system according to the network speed, or may be a step length set by the user according to the actual demand. For example, when the user's demand is to load a video within n seconds in the future, the preset time duration to be loaded is n, for example, n =16.
A video period may be a time period between a start position (i.e., a start time) and an end position (i.e., an end time) of a certain video segment in a video, the time period including the start position and the end position. For example, as shown in fig. 3, the video period may be a period from point a to point B, i.e., a period from 20 th to 36 th seconds of the video. The point a is a node with a playing time of 20 seconds, and the point B is a node with a playing time of 36 seconds.
In one embodiment, the terminal detects the network speed, and determines the preset duration to be loaded according to the network speed, so as to determine the video time period of the video to be loaded according to the video playing position and the preset duration to be loaded. For example, as shown in fig. 3, assuming that the user only tries to watch the video and does not stay in the video for too long, when the user watches the video, if the network speed is high, the video may be downloaded in a short time, and the user leaves the web page only by watching a short segment of video, thereby causing waste of traffic, at this time, the terminal determines that only video data in the future 16 seconds need to be loaded according to the size of the traffic speed, and when playing to point a, the video data in the future 16 seconds can be loaded, that is, the video period to be loaded is the time period from point a to point B.
In one embodiment, S204 may specifically include: the terminal calculates the end position of video loading according to the video playing position and the preset time length to be loaded; and determining the video time interval to be loaded according to the video playing position and the ending position.
For example, as shown in fig. 3, when playing to the point a, assuming that the preset time duration to be loaded is 16, video data in the future 16 seconds may be loaded, and at this time, the terminal may determine, according to the time corresponding to the point a and the preset time duration to be loaded being 16, that the video period to be loaded is the time period from the point a to the point B, that is, the video period to be loaded is the time period from the 20 th second to the 36 th second.
S206, when at least one part of video data in the video time interval is not loaded in the video buffer container, downloading at least one part of video data from the server.
Wherein at least a portion of the video data may refer to: a portion of the video data within a video period, or all of the video data within a video period. A video Buffer container (Source Buffer Controller) may be a container for a user to Buffer video data, that is, after downloading video data from a server, the downloaded video data is loaded into the video Buffer container, or a packaging format of the downloaded video data is converted first, and then the converted video data is loaded into the video Buffer container.
In one embodiment, S206 may specifically include: when at least a part of Video data in the Video time interval is not loaded in the Video buffer container, the terminal acquires a Video link (such as a Video URL address) in the Video tag, and downloads at least a part of corresponding Video data from a server corresponding to the Video link according to the Video time interval.
For example, assume that the video tag is:
<video controls>
< source src = "www.xxx/hand angee.mp4" type = "video/mp4" >/the URL address of video is www.xxx/hand. Mp4
</video>
Then, the terminal will link to the corresponding server according to www.xxx/hand.mp 4, and then download the corresponding video data according to the time period from point a to point B, and if the video buffer container has loaded part of the video data in the time period from point a to point B, the terminal needs to download another part of the video data in the time period from point a to point B. If the video buffer container does not load the video data in the time period from point a to point B, the terminal needs to download all the video data in the time period from point a to point B.
Specifically, the method comprises the following steps: and when a part of Video data in the Video time interval is not loaded in the Video buffer container, the terminal acquires the Video link in the Video tag, and downloads the corresponding part of Video data from a server corresponding to the Video link according to the Video time interval. And when all the Video data in the Video time interval are not loaded in the Video buffer container, the terminal acquires the Video link in the Video tag, and downloads all the Video data in the Video time interval from a server corresponding to the Video link according to the Video time interval.
In one embodiment, the downloaded video data may be downloaded through a download controller. Specifically, the terminal judges whether at least a part of video data in a video time interval is loaded in the video buffer container through the scheduling logic controller, and if not, the terminal sends a control instruction to the download controller so that the download controller downloads at least a part of video data which is not loaded in the video buffer container from the server. Wherein, the scheduling logic Controller is MSE Controller.
And S208, loading at least a part of the downloaded video data to a video buffer container.
In an embodiment, S208 may specifically include: when the downloading is finished, the terminal converts the packaging format of at least one part of the downloaded video data; and loading at least a part of video data obtained by conversion into a video buffer container.
Among them, the package format may refer to a Video format, for example, an avi (Audio Video Interleaved) package format, an mkv (Multimedia Container) package format, an rmvb (real media Variable bit rate) package format, an mp4 (Moving Picture Experts Group 4) package format, and the like.
In one embodiment, when at least a part of video data which is not loaded in the video buffer container is completely downloaded through the download controller, the terminal notifies the trans-encapsulation controller through the download controller in a callback function manner, so that the trans-encapsulation controller performs trans-encapsulation processing on the downloaded at least a part of video data, that is, converts the encapsulation format of the at least a part of video data, and then loads the at least a part of video data obtained through conversion into the video buffer container.
For example, the decapsulation controller decapsulates the downloaded mp4 encapsulated format video data to obtain an fmp4 encapsulated format, and then adds the fmp4 encapsulated format video data to the video buffer container. In an mp4 file, the metadata of the mp4 file is in the header, all the media data are in one block, and in order to avoid the buffer time from being prolonged due to the storage structure of the mp4 file, at this time, the large mp4 file is cut into multiple segments which are physically separated, so that meta of each segment is relatively small, and video data in an fmp4 packaging format is obtained.
In the above embodiment, the current video playing position is obtained in time, the video time period of the video to be loaded is determined according to the video playing position and the preset time length to be loaded, and the corresponding video data is downloaded according to the video time period of the video to be loaded, so that the video to be played in the future can be effectively preloaded, and the problem of blocking during playing is avoided. In addition, before downloading the video data, whether the video data in the video time interval is loaded in the video buffer container is judged, if at least one part of the video data is not loaded in the video buffer container, at least one part of the video data which is not loaded in the video buffer container is downloaded, and then the video data is loaded in the video buffer container, so that the problem of repeated loading of the video data is solved. Moreover, the video playing position and the preset time length to be loaded determine the video time period of the video to be loaded, so that the network speed is not required to be limited, the video data in the video time period can be loaded in a short time, the waste of data flow is avoided, and the video loading efficiency is effectively ensured.
Finally, the video playing position can be set, when loading, the corresponding video data can be loaded according to the set video playing position and the preset time length to be loaded, the mode of loading the video data is flexible, the scheduling loading of the video data is realized, and the problem of blocking during playing is avoided.
In one embodiment, as shown in fig. 4, after S208, the method may further include:
s402, video data are obtained from the video buffer container according to the video playing position.
The video buffer container may be a container for caching video data by a user, that is, after downloading video data from a server, the downloaded video data is loaded into the video buffer container, or a packaging format of the downloaded video data is converted first, and then the converted video data is loaded into the video buffer container.
In one embodiment, the terminal may acquire all video data located after the video playing position from the video buffer container, or acquire a part of video data located after the video playing position from the video buffer container, and then perform S404.
In one embodiment, the terminal determines the length of the video to be decoded at each decoding according to the local calculation performance, acquires a portion of video data located after the video playing position in the video buffer container according to the determined video length, and then performs S404. The computing performance includes, but is not limited to, utilization of a processor, remaining memory space, and the like.
For example, as shown in fig. 3, if all the video data after the video playing position are acquired (assuming that the duration of all the video data after the video playing position is 16 seconds), when the video is played for the 20 th second, the video data in the 20 th to 36 th seconds of the video are acquired from the video buffer container. When the video is played for the 20 th second and the length of the video decoded each time is determined to be 5 seconds according to the self calculation performance of the terminal, the terminal acquires the video data in the 20 th to 25 th seconds from the video buffer container.
In one embodiment, after S208 and before S402, the method further comprises: the terminal generates a response event about the completion of the loading of at least a part of the video data; the response event is sent to the dispatch logic controller. In an embodiment, S404 may specifically include: and when the scheduling logic controller determines that at least one part of the video data is completely loaded according to the response event, the scheduling logic controller acquires the video data which is loaded in the video buffer container and belongs to the video time interval according to the video playing position.
For example, assuming that the current video playing position is 20 th second, the video data of 20 th to 30 th seconds are already loaded, and the video data of 20 th to 36 th seconds are needed to be loaded in total, at this time, the terminal downloads the video data of 30 th to 36 th seconds through the download controller, and then loads the video data into the video buffer container, at this time, the video buffer container will notify the video buffer container in a manner of responding to an event that the specified video data loading is completed, and the scheduling logic controller acquires the video data loaded in the video buffer container and belonging to the video period according to the video playing progress.
S404, decoding the acquired video data to obtain decoded video data.
In one embodiment, the terminal calls the player through a webpage, and the obtained video data is bridged to the player through the bridging interface; and decoding the acquired video data through the player to obtain decoded video data.
In one embodiment, the terminal decodes the acquired video data into frame-by-frame image data through the player to obtain decoded video data composed of the frame-by-frame image data, then renders each frame of image data in the decoded video data to obtain the decoded video data that can be displayed on the player after rendering, and then executes S406.
In one embodiment, the terminal invokes a rendering tool to render each frame of image data in the decoded video data, so as to obtain the decoded video data that can be displayed on the player.
For example, the terminal calls WebGL (Web Graphics Library), or OpenGL ES (Open Graphics Library for Embedded Systems), or OpenGL ES2.0 version to render each frame of image data in the decoded video data.
In an embodiment, S404 may specifically include: the terminal bridges the acquired video data to a player called by a webpage through a bridging interface; and decoding the acquired video data through the player to obtain decoded video data.
For example, the terminal bridges the acquired video data to a video module (i.e., a video player) through a Media Source Extensions (API) or through a JsBridge interface to decode the acquired video data through the video module.
S406, playing the decoded video data.
In one embodiment, when the video data of the video is downloaded for the first time, the terminal may also download the description information of the video, wherein the description information may include the time period of the popular clip, the type of the video, the video brief description, and the like.
In one embodiment, when playing the decoded video data, determining whether the decoded video data belongs to a hot segment according to the downloaded description information, if so, playing the decoded video data at a first playing speed; if not, playing at the second playing speed. Wherein the second playing speed is greater than the first playing speed.
For example, many users are interested in hot segments of video, which can be played at normal play speed when viewed; when a non-hot segment is viewed, it can be played at a double speed, e.g., n times the normal play speed. Wherein n is a number greater than 1.
In an embodiment, the determining the hot sections specifically includes: before a video is manufactured and uploaded to a server, a terminal performs feature extraction on frame images in the video to obtain corresponding image features, and then processes the image features through a machine learning model to obtain score values of the corresponding frame images, wherein the machine learning model can include but is not limited to a VASNet model or other neural network models based on video summarization technology. And when the score value reaches a preset score condition, the terminal determines a hot segment in the video according to the score value and marks the time period of the hot segment.
In the above embodiment, the video data is acquired in the video buffer container according to the video playing position, so that the video data to be played can be decoded and played in real time, and the video data to be played does not need to be downloaded from the network in real time. In addition, when the appointed video data is loaded, the scheduling logic controller is informed in a form of response event so that the scheduling logic controller acquires the video data which is loaded in the video buffer container and belongs to the video time interval according to the video playing position, and the problem of pause in playing is avoided.
In one embodiment, as shown in fig. 5, before S202, the method may further include:
s502, initializing the video buffer container.
In one embodiment, the terminal creates a video buffer container and initializes the video buffer container to save the downloaded video data to the video buffer container.
And S504, when the webpage is opened, sequentially downloading the first video data with the duration as the preset duration to be loaded from the server by taking the first frame of the video as a starting point.
In one embodiment, a web page may have an entry for playing a video, and the entry may be displayed on the web page with a first frame image of the video as a display diagram. For example, the terminal may set a portal presentation graph, such as < video src = "www.xxx/hand way. Mp4" = "hand way. Png" > ", indicating that there is a video with the name hand way. Mp4 in the web page, through a poster attribute in the video tag, and set this image in the web page as the portal presentation graph for presentation.
In one embodiment, the terminal acquires a first frame image of a video from the server, and then displays the first frame image as a display image on a webpage.
S506, the packaging formats of the sequentially downloaded first segment video data are respectively converted.
In one embodiment, when the first segment of video data is downloaded by the download controller, the terminal notifies the decapsulation controller by way of a callback function through the download controller, so that the decapsulation controller decapsulates the downloaded first segment of video data, that is, converts the encapsulation format of the first segment of video data, and then executes S508.
For example, the decapsulation controller decapsulates the first segment of downloaded mp 4-encapsulated video data to obtain an fmp 4-encapsulated format, and then adds the fmp 4-encapsulated video data to the video buffer container.
And S508, loading the first segment of video data obtained by conversion into a video buffer container respectively.
And S510, in the process of loading the first segment of video data, the loaded bridge is connected to the player through the bridge interface for decoding and playing.
For example, the terminal bridges the acquired video data to a video player through a media source extension API or through a JsBridge interface to decode and play the acquired video data through the player.
In one embodiment, the terminal decodes the acquired first segment of video data into frame-by-frame image data through the player to obtain decoded video data composed of the frame-by-frame image data, then renders each frame of image data in the decoded first segment of video data respectively, and then plays the decoded first segment of video data through the player.
In one embodiment, the terminal invokes a rendering tool to render each frame of image data in the decoded first segment of video data, so as to obtain the decoded first segment of video data that can be displayed on the player.
For example, the terminal invokes WebGL, openGL ES, or OpenGL ES2.0 version to render each frame of image data in the decoded first segment of video data.
For S510, the following two scenarios can be set forth:
In one embodiment, S510 may specifically include: when the first section of video data is loaded to the video buffer container, the terminal bridges the first section of video data to a player called by a webpage through a bridging interface; decoding the first segment of video data through a player to obtain the decoded first segment of video data; and playing the decoded first segment of video data.
In one embodiment, before playing the video, the terminal has loaded the first segment of video data of the specified preset duration to be loaded into the video buffer container, and at this time, the terminal may directly call the player through the web page, so as to implement automatic playing of the video. In addition, the terminal can also detect a playing instruction triggered in the webpage, and when the playing instruction triggered in the webpage is detected, the player is called through the webpage, so that the video playing can be realized in a user control mode.
In one embodiment, when the first segment of video data is played, the terminal acquires a video playing position in real time so as to determine a video time period of a video to be loaded at the next moment according to the video playing position and a preset time length to be loaded.
In scene 2, during playing, the first segment of video data is not completely loaded into the video buffer container.
In one embodiment, a play instruction triggered in a web page is detected; when a playing instruction triggered in a webpage is detected, calling a player through the webpage; when the first segment of video data is not completely loaded to the video buffer container, judging whether the data volume of the currently loaded part of video data reaches a playing condition; if yes, bridging the loaded partial video data to the player through a bridging interface; decoding the loaded part of the video data through a player to obtain decoded video data; and playing the decoded video data.
In one embodiment, before playing the video, the terminal does not load the first segment of video data of the specified preset duration to be loaded into the video buffer container, and if the first segment of video data can be played through the loaded part of video data, the terminal can directly call the player through a webpage, so as to realize automatic playing of the video. In addition, the terminal can also detect a playing instruction triggered in the webpage, and when the playing instruction triggered in the webpage is detected, the player is called through the webpage, so that the video playing can be realized in a user control mode.
In one embodiment, when playing part of the loaded video data in the first segment of video data, the terminal acquires the video playing position in real time so as to determine the video time period of the video to be loaded at the next moment according to the video playing position and the preset time length to be loaded.
For example, assuming that the preset time duration to be loaded is 16, if the video data of the first 5 seconds of the currently loaded video is, the terminal may play the video data of the first 5 seconds, record the video playing position, and simultaneously download the video data after the 5 th second in the playing process.
In the above embodiment, when the webpage is opened, the first segment of video data is downloaded according to the specified preset loading waiting time, then the packaging format of the first segment of video data is converted, and then the converted first segment of video data is loaded into the video buffer container, so that the video that may be played can be effectively preloaded, and the problem of pause during playing is avoided. When the video is played, the first video data can be played after being loaded, and also can be played after part of the first video data is loaded, so that the problem that the playing of the first frame takes long time can be effectively avoided.
As shown in fig. 6, in an embodiment, another video loading method is provided, where the video loading method specifically includes the following steps:
s602, when the video is played, the video playing position is obtained.
In one embodiment, the first piece of video data of the video is loaded before playing. Specifically, before S602, the terminal initializes the video buffer container; when a webpage is opened, sequentially downloading a first section of video data with the duration as the preset duration to be loaded from a server by taking a first frame of a video as a starting point; respectively converting the packaging formats of the sequentially downloaded first segment video data; and loading the first segment of video data obtained by conversion into a video buffer container respectively.
In one embodiment, during the process of loading the first segment of video data, the loaded bridge is connected to the player through the bridge interface for decoding and playing.
In one embodiment, the step of bridging the loaded bridge to the player through the bridge interface for decoding and playing comprises the following steps: when the first video data are all loaded into the video buffer container, the first video data are bridged to a player called by a webpage through a bridging interface; decoding the first segment of video data through a player to obtain decoded first segment of video data; and playing the decoded first segment of video data.
In one embodiment, the method further comprises: when the first segment of video data is not completely loaded to the video buffer container, judging whether the data volume of the currently loaded part of video data reaches a playing condition; if yes, bridging the loaded part of the video data to a player called by a webpage through a bridging interface; decoding the loaded part of the video data through a player to obtain decoded video data; and playing the decoded video data.
And S604, determining the video time period of the video to be loaded according to the video playing position and the preset time length to be loaded.
In one embodiment, the terminal calculates the end position of video loading according to the video playing position and the preset time length to be loaded; and determining the video time interval to be loaded according to the video playing position and the ending position.
And S606, when at least one part of video data in the video time interval is not loaded in the video buffer container, downloading at least one part of video data from the server.
S608, when the downloading is completed, converting the packaging format of at least a part of the downloaded video data.
S610, loading at least a part of video data obtained by conversion to a video buffer container.
S612, generating a response event about at least a part of the video data being loaded.
And S614, sending the response event to the dispatching logic controller.
And S616, when the scheduling logic controller determines that at least a part of the video data is completely loaded according to the response event, acquiring the video data which is loaded in the video buffer container and belongs to the video time interval according to the video playing position through the scheduling logic controller.
S618 decodes the acquired video data to obtain decoded video data.
In one embodiment, the terminal bridges the acquired video data to a player called by a webpage through a bridge interface; and decoding the acquired video data through the player to obtain decoded video data.
S620, playing the decoded video data.
As an example, a video is played through a web page, and due to the scheme that a video tag in the web page is associated with video data through an src attribute, video can not be scheduled, loaded, processed, and controlled, and thus video data can not be preloaded, which causes problems of pause in playing, long time consumed in playing a first frame image of the video, and the like. In this embodiment, a video loading method is provided, which may solve the above technical problem, and as shown in fig. 7, the specific method steps may include:
(1) A scheduling logic Controller (MSE Controller) is used as a core of service playing scheduling, and firstly a video Buffer container (Source Buffer Controller) is set through an initialization interface, and the Source Buffer Controller can be used for storing and managing video data to be played.
(2) The MSE Controller judges whether the video data cached in the Source buffer meets normal decoding playing or not according to the current demand for the buffered video (the demand can be video data within n seconds in the future after the current playing time is loaded, and n is a positive number which is more than 1 and less than the total video time), if so, the MSE Controller does not load new video data, and if not, a control instruction for loading the new video data is sent to the download Controller.
(3) And after receiving the control instruction of the MSE Controller, the download Controller downloads the mp4 video data according to the demand. For example, mp4 video data specifying the chunk size is downloaded in a byte-range manner.
(4) And the download controller acquires the specified mp4 video data after the loading is finished, and then notifies the trans-encapsulation controller in a callback function mode so that the trans-encapsulation controller finishes trans-encapsulation processing on the loaded mp4 video data.
(5) And the trans-encapsulation Controller carries out trans-encapsulation processing on the mp4 video data to obtain fmp4 video data, and then adds the fmp4 video data into a Source Buffer Controller for standby.
(6) After receiving the fmp4 video data and successfully storing the fmp4 video data into the standby Buffer, the Source Buffer Controller informs the MSE Controller of completing loading the fmp4 video data of the specified segment with the specified size through a response event.
(7) And dynamically deciding whether the fmp4 video data cached in the Source Buffer Controller meets the playing requirements of side-by-side playing, flow optimization and pause optimization or not by the MSE Controller processor according to the video playing progress, and bridging the fmp4 video data to the video module for decoding and playing if the fmp4 video data meets the playing requirements of side-by-side playing, flow optimization and pause optimization. If not, the above steps (2) to (5) are continuously executed in a loop until the fmp4 video data capable of meeting the playing requirement is loaded.
By adopting the scheme of the embodiment, the amount of the video data to be loaded can be determined according to the playing requirement of the current playing time point, for example, the amount of the video data to be loaded can be set by a user, and the amount of the video data to be loaded can also be automatically adjusted according to the network speed.
As shown in fig. 3, point a in the graph is a node position corresponding to 20 seconds when the video is currently played, point B is a node position corresponding to the 36 seconds of the video that has been loaded, and point C indicates that the total duration of the video is 3 minutes 04 seconds. The time period required to load the video can be determined according to the currently played point A and the specified playing demand, the point B represents the time point when the video data is loaded, and when the video data is played to the 20 th second (point A) in the figure 3, the video data only loaded to the 20 th to 36 th seconds (point B) can be controlled.
By adopting the scheme of the embodiment, the required flow during video loading can be saved while the smoothness of the current video playing can be ensured, and the purposes of loading as required, optimizing the pause, reducing the abnormal playing and the like are achieved. In addition, since the video in the webpage is preloaded before playing, the time consumed for playing the first frame is effectively reduced, as shown in fig. 8, for an mp4 video with a duration of 20 seconds, the time consumed for the first frame is 1.4 seconds by using the scheme of the present embodiment, and the time consumed for the first frame is 2.6 seconds by using the conventional scheme.
Fig. 2 and 4-6 are schematic flow diagrams of a video loading method in an embodiment. It should be understood that although the various steps in the flowcharts of fig. 2, 4-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 4-6 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least some of the sub-steps or stages of other steps.
As shown in fig. 9, an embodiment of the present invention provides a video loading apparatus, where the apparatus includes: an acquisition module 902, a determination module 904, a download module 906, and a load module 908; wherein:
an obtaining module 902, configured to obtain a video playing position when playing a video;
a determining module 904, configured to determine a video time period of the video to be loaded according to the video playing position and a preset duration to be loaded;
a downloading module 906, configured to download at least a part of the video data from the server when at least a part of the video data in the video period is not loaded in the video buffer container;
a loading module 908 for loading at least a portion of the downloaded video data into the video buffer container.
In one embodiment, the loading module 908 is further configured to: when the downloading is finished, converting the packaging format of at least one part of the downloaded video data; and loading at least a part of video data obtained by conversion into a video buffer container.
In one embodiment, the determining module 904 is further configured to: calculating the end position of video loading according to the video playing position and the preset time length to be loaded; and determining the video time interval to be loaded according to the video playing position and the ending position.
In the above embodiment, the current video playing position is obtained in time, the video time period of the video to be loaded is determined according to the video playing position and the preset time length to be loaded, and the corresponding video data is downloaded according to the video time period of the video to be loaded, so that the video to be played in the future can be effectively preloaded, and the problem of blocking during playing is avoided. In addition, before downloading the video data, whether the video data in the video time interval is loaded in the video buffer container is judged, if at least one part of the video data is not loaded in the video buffer container, at least one part of the video data which is not loaded in the video buffer container is downloaded, and then the video data is loaded in the video buffer container, so that the problem of repeated loading of the video data is solved. In addition, the video playing position and the preset time length to be loaded determine the video time period of the video to be loaded, so that the network speed is not limited, the video data in the video time period can be loaded in a short time, the waste of data flow is avoided, and the video loading efficiency is effectively ensured.
Finally, the video playing position can be set, when the video data are loaded, the corresponding video data can be loaded according to the set video playing position and the preset time length to be loaded, the mode of loading the video data is flexible, the scheduling loading of the video data is realized, and the problem of blocking during playing is avoided.
In one embodiment, as shown in fig. 10, the apparatus further comprises: a decode module 910 and a play module 912; wherein:
an obtaining module 902, further configured to obtain video data from the video buffer container according to the video playing position after loading at least a portion of the downloaded video data into the video buffer container;
a decoding module 910, configured to decode the obtained video data to obtain decoded video data;
a playing module 912, configured to play the decoded video data.
In one embodiment, as shown in fig. 10, the apparatus further comprises: a response module 914; wherein:
a response module 914 for generating a response event regarding completion of loading of at least a portion of the video data; sending the response event to the scheduling logic controller;
the obtaining module 902 is further configured to, when the scheduling logic controller determines that at least a portion of the video data has been completely loaded according to the response event, obtain, by the scheduling logic controller, the video data that is loaded in the video buffer container and belongs to the video time interval according to the video playing position.
In one embodiment, the decoding module 910 is further configured to: bridging the acquired video data to a player called by a webpage through a bridging interface; and decoding the acquired video data through the player to obtain decoded video data.
In the above embodiment, the video data is acquired in the video buffer container according to the video playing position, so that the video data to be played can be decoded and played in real time, and the video data to be played does not need to be downloaded from the network in real time. In addition, when the appointed video data is loaded, the scheduling logic controller is informed in a form of response event so that the scheduling logic controller acquires the video data which is loaded in the video buffer container and belongs to the video time interval according to the video playing position, and the problem of pause in playing is avoided
In one embodiment, as shown in fig. 10, the apparatus may further include: a conversion module 916; wherein:
a conversion module 916, configured to initialize the video buffer container; when a webpage is opened, sequentially downloading a first section of video data with the duration as preset duration to be loaded from a server by taking a first frame of a video as a starting point; respectively converting the packaging formats of the sequentially downloaded first segment video data;
the loading module 908 is further configured to load the first segment of video data obtained by conversion into the video buffer containers, respectively.
In one embodiment, the playing module 912 is further configured to: and in the process of loading the first segment of video data, the loaded bridge is connected to the player through the bridge interface for decoding and playing.
In one embodiment, the playing module 912 is further configured to: when the first video data are all loaded into the video buffer container, the first video data are bridged to a player called by a webpage through a bridging interface; decoding the first segment of video data through a player to obtain decoded first segment of video data; and playing the decoded first segment of video data.
In one embodiment, the playing module 912 is further configured to: when the first segment of video data is not completely loaded to the video buffer container, judging whether the data volume of the currently loaded part of video data reaches a playing condition; if yes, bridging the loaded part of the video data to a player called by the webpage through a bridging interface; decoding the loaded part of the video data through a player to obtain decoded video data; and playing the decoded video data.
In the above embodiment, when the webpage is opened, the first segment of video data is downloaded according to the specified preset loading duration, then the packaging format of the first segment of video data is converted, and then the converted first segment of video data is loaded into the video buffer container, so that videos which may be played can be effectively preloaded, and the problem of blocking during playing is avoided. When the video is played, the first segment of video data can be loaded for playing, and the first segment of video data can also be played after a part of the first segment of video data is loaded, so that the problem that the time consumption for playing the first frame can be effectively avoided.
FIG. 11 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may specifically be the terminal 110 in fig. 1. As shown in fig. 11, the computer apparatus includes a processor, a memory, a network interface, an input device, and a display screen, which are connected through a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement the video loading method. The internal memory may also have a computer program stored therein, which when executed by the processor, causes the processor to perform the video loading method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 11 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the video loading apparatus provided in the present application may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 11. The memory of the computer device may store various program modules constituting the video loading apparatus, such as an acquisition module 902, a determination module 904, a download module 906, and a loading module 908 shown in fig. 9. The computer program constituted by the respective program modules causes the processor to execute the steps in the video loading method of the embodiments of the present application described in the present specification.
For example, the computer device shown in fig. 11 may execute S202 through the obtaining module 902 in the video loading apparatus shown in fig. 9. The computer device may perform S204 by the determining module 904. The computer device may perform S206 through the download module 906. The computer device may perform S208 through the loading module 908.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the video loading method described above. Here, the steps of the video loading method may be steps in the video loading methods of the above embodiments.
In one embodiment, a computer readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of the video loading method described above. Here, the steps of the video loading method may be steps in the video loading methods of the above embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct Rambus Dynamic RAM (DRDRAM), and Rambus Dynamic RAM (RDRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (12)
1. A video loading method, comprising:
initializing a video buffer container;
when a webpage is opened, sequentially downloading a first section of video data with the duration as preset duration to be loaded from a server by taking a first frame of a video as a starting point, wherein the preset duration to be loaded is the time length of loading the video, which is set according to the actual requirement of a user on the video to be loaded when the video data is loaded;
respectively converting the packaging formats of the sequentially downloaded first segment video data;
loading the first segment of video data obtained by conversion to the video buffer container respectively, and bridging the loaded first segment of video data to a player for decoding and playing through a media source expansion API in the process of loading the first segment of video data;
when the video is played, acquiring a video playing position;
determining the video time interval of the video to be loaded according to the video playing position and the preset time length to be loaded;
when the scheduling logic controller judges that at least one part of video data in the video time interval is not loaded in the video buffer container, sending a control instruction to a download controller so that the download controller can download the at least one part of video data from a server; when the downloading is finished, the package transferring controller is informed in a callback function mode;
the trans-packaging controller converts the packaging format of the downloaded at least part of the video data to obtain a plurality of sections of video data with a target packaging format and divided into physical separation; loading each segment of the video data into the video buffer container;
the video buffer container sends a response event about the completion of the loading of each piece of the video data to the scheduling logic controller;
when the scheduling logic controller determines that each loaded section of video data meets the playing requirement according to the response event, the scheduling logic controller acquires the video data which are loaded in the video buffer container and belong to the video time period according to the video playing position;
bridging the acquired video data to a player called by a webpage through a media source expansion API;
decoding the acquired video data through the player to obtain decoded video data;
and playing the video data at different playing speeds according to whether the decoded video data are hot segments.
2. The method of claim 1, wherein the obtaining the video playing position when playing the video comprises:
loading the native player through a webpage;
playing a video based on the native player;
and in the process of playing the video, acquiring the video playing position in real time.
3. The method according to claim 1, wherein the determining the video period to be loaded according to the video playing position and the preset duration to be loaded comprises:
calculating the end position of video loading according to the video playing position and the preset time length to be loaded;
and determining the video time interval to be loaded according to the video playing position and the ending position.
4. The method of claim 1, wherein the bridging the loaded first segment of video data to a player for decoding and playing through a media source extension API comprises:
when the first segment of video data is loaded to the video buffer container, the first segment of video data is bridged to a player called by the webpage through a bridging interface;
decoding the first segment of video data through the player to obtain decoded first segment of video data;
and playing the decoded first segment of video data.
5. The method of claim 1, further comprising:
when the first segment of video data is not completely loaded into the video buffer container, judging whether the data volume of the currently loaded part of video data reaches a playing condition;
if yes, bridging the loaded part of the video data to a player called by the webpage through a bridging interface;
decoding the loaded part of the video data through the player to obtain decoded video data;
and playing the decoded video data.
6. A video loading apparatus, the apparatus comprising:
the acquisition module is used for acquiring a video playing position when a video is played;
the determining module is used for determining the video time period of the video to be loaded according to the video playing position and the preset duration to be loaded; the preset time length to be loaded is the time length of the video to be loaded, which is set according to the actual requirement of the user on the video to be loaded when the video data is loaded;
the downloading module is used for downloading at least one part of video data from a server when the scheduling logic controller judges that at least one part of video data in the video time interval is not loaded in the video buffer container according to the current demand for the buffered video data;
the loading module is used for converting the packaging format of the downloaded at least part of the video data when the downloading is finished so as to obtain a plurality of sections of video data which are in a target packaging format and are divided into physical separation; loading each segment of the video data into the video buffer container;
the response module is used for generating a response event about the completion of the loading of each piece of the video data; sending the response event to a scheduling logic controller;
the obtaining module is further configured to, when the dispatch logic controller determines that each loaded segment of the video data meets a playing requirement according to the response event, obtain, by the dispatch logic controller, the video data that is loaded in the video buffer container and belongs to the video period according to the video playing position;
the decoding module is used for bridging the acquired video data to a player called by a webpage through a media source extended API; decoding the acquired video data through the player to obtain decoded video data;
the playing module is used for playing at different playing speeds according to whether the decoded video data are hot segments or not;
wherein the apparatus further comprises:
the conversion module is used for initializing the video buffer container; when the webpage is opened, sequentially downloading a first section of video data with the duration being the preset duration to be loaded from a server by taking a first frame of the video as a starting point; respectively converting the packaging formats of the sequentially downloaded first section of video data;
the loading module is further configured to load the first segment of video data obtained through conversion to the video buffer container;
the playing module is further configured to: and in the process of loading the first segment of video data, bridging the loaded first segment of video data to a player through a media source expanding API (application programming interface) for decoding and playing.
7. The apparatus of claim 6, wherein the obtaining module is further configured to:
loading the native player through a webpage;
playing a video based on the native player;
and in the process of playing the video, acquiring the video playing position in real time.
8. The apparatus of claim 6, wherein the determining module is further configured to:
calculating the end position of video loading according to the video playing position and the preset time length to be loaded;
and determining the video time interval to be loaded according to the video playing position and the ending position.
9. The apparatus of claim 6, wherein the playback module is further configured to:
when the first segment of video data is loaded to the video buffer container, the first segment of video data is bridged to a player called by the webpage through a bridging interface;
decoding the first segment of video data through the player to obtain decoded first segment of video data;
and playing the decoded first segment of video data.
10. The apparatus of claim 6, wherein the playback module is further configured to:
when the first segment of video data is not completely loaded into the video buffer container, judging whether the data volume of the currently loaded part of video data reaches a playing condition;
if yes, bridging the loaded partial video data to a player called by the webpage through a bridging interface;
decoding the loaded part of the video data through the player to obtain decoded video data;
and playing the decoded video data.
11. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 5.
12. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911245148.0A CN110933482B (en) | 2019-12-06 | 2019-12-06 | Video loading method and device, computer readable storage medium and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911245148.0A CN110933482B (en) | 2019-12-06 | 2019-12-06 | Video loading method and device, computer readable storage medium and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110933482A CN110933482A (en) | 2020-03-27 |
CN110933482B true CN110933482B (en) | 2023-03-31 |
Family
ID=69858237
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911245148.0A Active CN110933482B (en) | 2019-12-06 | 2019-12-06 | Video loading method and device, computer readable storage medium and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110933482B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111901634B (en) * | 2020-07-31 | 2022-07-08 | 北京嘀嘀无限科技发展有限公司 | Stream media on-demand method, device and computer readable storage medium |
CN112202751B (en) * | 2020-09-25 | 2022-06-07 | 腾讯科技(深圳)有限公司 | Animation processing method and device, electronic equipment and storage medium |
CN116635397A (en) * | 2020-11-19 | 2023-08-22 | F.I.S.-菲博利佳意大利合成面料股份公司 | Improved process for preparing trenbolone and/or trenbolone acetate |
CN112738637A (en) * | 2020-12-29 | 2021-04-30 | 南京金智视讯技术有限公司 | Web page real-time video playing method and device and computer equipment |
CN112929711B (en) * | 2021-01-26 | 2023-04-28 | 广州欢网科技有限责任公司 | Short video feed stream dynamic loading method and device suitable for intelligent television |
CN113810773B (en) * | 2021-09-17 | 2024-03-01 | 北京百度网讯科技有限公司 | Video downloading method and device, electronic equipment and storage medium |
CN114466225A (en) * | 2022-02-10 | 2022-05-10 | 北京沃东天骏信息技术有限公司 | Video data playing method and device, electronic equipment and readable storage medium |
CN114584826B (en) * | 2022-03-08 | 2024-04-12 | 抖音视界有限公司 | Video dynamic downloading method and device, electronic equipment and storage medium |
CN114745572B (en) * | 2022-04-14 | 2023-06-13 | 中国联合网络通信集团有限公司 | Video cache control method, device, equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107197382A (en) * | 2017-05-05 | 2017-09-22 | 中广热点云科技有限公司 | A kind of TV programme playback controls method |
CN107888948A (en) * | 2017-11-07 | 2018-04-06 | 北京小米移动软件有限公司 | Determine method and device, the electronic equipment of video file broadcasting speed |
CN109040793A (en) * | 2018-09-21 | 2018-12-18 | 北京奇艺世纪科技有限公司 | A kind of playback method and device |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103517154A (en) * | 2012-06-26 | 2014-01-15 | 深圳中兴网信科技有限公司 | Method for preloading video files and system thereof |
US10264043B2 (en) * | 2014-04-23 | 2019-04-16 | Ericsson Ab | Outage notification with client control modification in an ABR streaming network |
TW201615022A (en) * | 2014-10-14 | 2016-04-16 | Hon Hai Prec Ind Co Ltd | Video preloading system and method of video preloading |
CN106993238A (en) * | 2017-04-14 | 2017-07-28 | 网宿科技股份有限公司 | Audio and video playing method and device, audio frequency and video live broadcasting method and system based on Html5 |
CN107222776B (en) * | 2017-05-19 | 2019-03-01 | 腾讯科技(深圳)有限公司 | Video playing control method, browser, storage equipment and terminal |
CN109358833B (en) * | 2018-10-16 | 2022-03-22 | 创新先进技术有限公司 | Audio playing method and system, computing device and storage medium |
CN110324719A (en) * | 2019-08-12 | 2019-10-11 | 浙江岩华文化传媒有限公司 | Control method for playing back, device and equipment |
-
2019
- 2019-12-06 CN CN201911245148.0A patent/CN110933482B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107197382A (en) * | 2017-05-05 | 2017-09-22 | 中广热点云科技有限公司 | A kind of TV programme playback controls method |
CN107888948A (en) * | 2017-11-07 | 2018-04-06 | 北京小米移动软件有限公司 | Determine method and device, the electronic equipment of video file broadcasting speed |
CN109040793A (en) * | 2018-09-21 | 2018-12-18 | 北京奇艺世纪科技有限公司 | A kind of playback method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110933482A (en) | 2020-03-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110933482B (en) | Video loading method and device, computer readable storage medium and computer equipment | |
US11303970B2 (en) | Systems and methods for internet video delivery | |
CN109032738B (en) | Multimedia playing control method, device, terminal and storage medium | |
US9282381B2 (en) | Media playback control | |
CN112738633B (en) | Video playing method, device, equipment and readable storage medium | |
US20120198492A1 (en) | Stitching Advertisements Into A Manifest File For Streaming Video | |
CN111343504B (en) | Video processing method, video processing device, computer equipment and storage medium | |
CN110784750B (en) | Video playing method and device and computer equipment | |
CN111401964B (en) | Advertisement putting control method, device and system | |
CN111277869A (en) | Video playing method, device, equipment and storage medium | |
US20170302721A1 (en) | Cloud streaming service system, cloud streaming service method using optimal GPU, and apparatus for same | |
CN109840879B (en) | Image rendering method and device, computer storage medium and terminal | |
CN111436004A (en) | Video playing method, device and equipment and computer readable storage medium | |
US10694226B1 (en) | Video ad delivery | |
CN113923472A (en) | Video content analysis method and device, electronic equipment and storage medium | |
CN113096218B (en) | Dynamic image playing method, dynamic image playing device, storage medium and computer equipment | |
CN113297267A (en) | Data caching and task processing method, device, equipment and storage medium | |
US20200213642A1 (en) | Systems and methods for playng videos with background loading | |
US10165245B2 (en) | Pre-fetching video content | |
KR20190032100A (en) | Method and apparatus for providing advertisement image | |
CN114449305A (en) | Gift animation playing method and device in live broadcast room | |
CN111726701A (en) | Information implantation method, video playing method, device and computer equipment | |
CN113068064B (en) | Method, device, computer equipment and storage medium for processing transmission stream media file | |
CN113901008B (en) | Data processing method and device, storage medium and computing equipment | |
US20230319346A1 (en) | Systems and methods for automatically generating content items from identified events |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40022522 Country of ref document: HK |
|
GR01 | Patent grant | ||
GR01 | Patent grant |