Media resource playing method and device, electronic equipment and computer readable storage medium
By obtaining and scheduling the placeholder of media resources, using the media resource scheduler to determine the playback timing, the problem of invalid advertising links in the VMAP protocol is solved, and the accurate insertion of advertisements in videos is achieved.
Patent Information
- Application Number
- CN202510308964.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-06
AI Technical Summary
Ads based on VMAP protocol pin the link in the video when they are loaded for the first time, which may cause the link to fail, resulting in the lack of advertising capabilities.
By acquiring the second media resource corresponding to the first media resource and its placeholder in the first media resource playback progress, the media resource scheduler is used to determine whether the playback progress reaches the placeholder, and play the second media resource upon arrival.
It realizes successful and accurate insertion of advertisements in videos, avoiding the problem of link failure and ensuring that the advertisements can be played normally.
Smart Images

Figure CN120111307A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of resource processing technology, and specifically to a method, device, electronic device, and computer-readable storage medium for playing media resources. Background Art
[0002] The Video Media Ad Placement (VMAP) protocol is a commonly used protocol in the field of digital video advertising. The VMAP protocol is suitable for inserting advertisements at multiple points in a video, and can define the location information of each advertisement in the video in detail. Ads based on the VMAP protocol have already fixed the link of the advertisement in the video when they are first loaded, but the link address may become invalid, resulting in a lack of advertising capabilities. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for playing media resources, which can successfully and accurately insert advertisements into videos.
[0004] In a first aspect, an embodiment of the present application provides a method for playing a media resource, including:
[0005] Acquire a second media resource corresponding to the first media resource;
[0006] Obtaining a placeholder node of the second media resource in the playback progress of the first media resource;
[0007] Determining, based on a media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node; and
[0008] When the play progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node is played.
[0009] In one embodiment, the determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes:
[0010] Determining, based on the media resource scheduler, a playback time point corresponding to the playback progress of the first media resource;
[0011] Determining an insertion time point of the second media resource according to a placeholder node of the second media resource in the playback progress of the first media resource;
[0012] Calculate whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource.
[0013] In one embodiment, before the playback progress of the first media resource reaches the placeholder node, the method further includes:
[0014] Obtaining a difference between an insertion time point of the second media resource and a playback time point corresponding to a playback progress of the first media resource;
[0015] When the difference is less than the difference threshold, a second media resource corresponding to the placeholder node is loaded.
[0016] In one of the embodiments, when there are multiple second media resources corresponding to the first media resource;
[0017] The acquiring the second media resource corresponding to the first media resource includes:
[0018] Acquire a queue consisting of a plurality of second media resources corresponding to the first media resource; arrange the second media resources in the queue in an orderly manner according to the order of the placeholder nodes from front to back;
[0019] The determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes:
[0020] Based on the media resource scheduler, it is determined whether the playback progress of the first media resource reaches the placeholder node of the second media resource at the front row in the queue.
[0021] In one embodiment, after playing the second media resource corresponding to the placeholder node, the method further includes:
[0022] deleting a second media resource corresponding to the placeholder node from the queue;
[0023] determining whether the queue is empty;
[0024] When the queue is not empty, polling and starting the media resource scheduler;
[0025] When the queue is empty, the media resource scheduler is closed.
[0026] In one embodiment, obtaining a placeholder node of the second media resource in the playback progress of the first media resource includes:
[0027] Acquire information about the first media resource;
[0028] Acquire configuration information of the second media resource;
[0029] A placeholder node of the second media resource in the playback progress of the first media resource is determined according to the information of the first media resource and the configuration information of the second media resource.
[0030] In one embodiment, the method further comprises:
[0031] In response to a change in the configuration information of the second media resource, acquiring the changed configuration information of the second media resource;
[0032] Re-determining a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the changed configuration information of the second media resource;
[0033] The determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes:
[0034] Based on the media resource scheduler, it is determined whether the playback progress of the first media resource reaches the re-determined placeholder node of the second media resource in the playback progress of the first media resource.
[0035] In a second aspect, an embodiment of the present application provides a device for playing a media resource, including:
[0036] A resource acquisition module, used to acquire a second media resource corresponding to the first media resource;
[0037] A node acquisition module, used to acquire a placeholder node of the second media resource in the playback progress of the first media resource;
[0038] a progress determination module, configured to determine, based on a media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node; and
[0039] The resource playing module is used to play the second media resource corresponding to the placeholder node when the playing progress of the first media resource reaches the placeholder node.
[0040] In one embodiment, the progress determination module includes:
[0041] A first determining unit, configured to determine, based on the media resource scheduler, a playback time point corresponding to the playback progress of the first media resource;
[0042] A second determining unit, configured to determine an insertion time point of the second media resource according to a placeholder node of the second media resource in the playback progress of the first media resource;
[0043] The calculation unit is used to calculate whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource.
[0044] In one embodiment, before the playback progress of the first media resource reaches the placeholder node, the apparatus further includes:
[0045] A difference acquisition module, used to acquire a difference between an insertion time point of the second media resource and a playback time point corresponding to a playback progress of the first media resource;
[0046] A loading module is used to load the second media resource corresponding to the placeholder node when the difference is less than a difference threshold.
[0047] In one embodiment, when there are multiple second media resources corresponding to the first media resource, the resource acquisition module includes:
[0048] A queue acquisition unit, configured to acquire a queue consisting of a plurality of second media resources corresponding to a first media resource; the second media resources in the queue are arranged in an orderly manner according to the order of the placeholder nodes from front to back;
[0049] The progress determination module comprises:
[0050] A progress determination unit is used to determine, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node of the second media resource at the front of the queue.
[0051] In one of the embodiments, after playing the second media resource corresponding to the placeholder node, the apparatus further includes:
[0052] a deleting module, configured to delete the second media resource corresponding to the placeholder node from the queue;
[0053] A queue determination module, used to determine whether the queue is empty;
[0054] A starting module, used for polling and starting the media resource scheduler when the queue is not empty;
[0055] The closing module is used to close the media resource scheduler when the queue is empty.
[0056] In one embodiment, the node acquisition module includes:
[0057] A first information acquisition unit, configured to acquire information about the first media resource;
[0058] A second information acquisition unit, configured to acquire configuration information of the second media resource;
[0059] A node determination unit is used to determine a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the configuration information of the second media resource.
[0060] In one embodiment, the device further comprises:
[0061] a change acquisition module, configured to acquire the changed configuration information of the second media resource in response to a change in the configuration information of the second media resource;
[0062] a redetermining module, configured to redetermine a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the changed configuration information of the second media resource;
[0063] The progress determination module comprises:
[0064] A redetermining unit is used to determine, based on the media resource scheduler, whether the playback progress of the first media resource reaches the redetermined placeholder node of the second media resource in the playback progress of the first media resource.
[0065] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the above-mentioned method for playing media resources when executed by the processor.
[0066] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned method for playing media resources are implemented.
[0067] In a fifth aspect, the embodiments of the present application further provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations described in the embodiments of the present application.
[0068] In summary, in the embodiment of the present application, it is possible to determine the placeholder node of the second media resource corresponding to the first media resource in the playback progress of the first media resource, and based on the media resource scheduler, determine whether the playback progress of the first media resource has reached the placeholder node, and when the playback progress of the first media resource has reached the placeholder node, play the second media resource corresponding to the placeholder node. In this way, the media resource scheduler can determine when to play the second media resource, and there is no need to fix the link of the second media resource in the first media resource in advance, so there will be no problem of link failure. When the first media resource is a video and the second media resource is an advertisement, the advertisement can be successfully and accurately inserted into the video. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0070] Figure 1 This is a schematic diagram of the steps of a method for playing media resources provided in an embodiment of the present application;
[0071] Figure 2 It is a flowchart of a method for playing media resources provided in an embodiment of the present application;
[0072] Figure 3 It is a structural diagram of a media resource playback device provided in an embodiment of the present application;
[0073] Figure 4 It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0074] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0075] In one embodiment, Figure 1As shown, a method for playing a media resource is provided. Although a logical order is shown in the step diagram, in some cases, the steps shown or described may be performed in an order different from that shown in the figure. Specifically, the method for playing a media resource may be applied to a terminal, wherein the terminal may include but is not limited to one or more of a smart TV, a smart phone, a tablet computer, a portable computer, a desktop computer, and a car computer.
[0076] It should be noted that the order of description of the following embodiments is not intended to limit the priority order of the embodiments.
[0077] according to Figure 1 The method for playing the media resource shown in the figure includes at least steps S110 to S140, which are described in detail as follows:
[0078] In step S110, a second media resource corresponding to the first media resource is obtained.
[0079] Media resources refer to content resources used in the process of media communication. The first media resources may include but are not limited to video resources and audio resources; the second media resources may include but are not limited to video resources, audio resources and picture resources. Video resources may include but are not limited to one or more of movies, TV series, variety shows, short videos and long videos. Audio resources may include but are not limited to one or more of music, audio novels and podcasts. Pictures may include but are not limited to one or more of photographic pictures, painted pictures, computer-generated pictures and dynamic pictures.
[0080] In one embodiment, the second media resource may be an advertisement, which may include but is not limited to one or more of a video advertisement, an audio advertisement, and a picture advertisement.
[0081] The second media resource corresponding to the first media resource refers to: the media resource played during the playing of the first media resource, including: the media resource played at the beginning of the playing of the first media resource, the media resource played in the middle of the playing of the first media resource, and the media resource played at the end of the playing of the first media resource.
[0082] For example, when the first media resource is a video and the second media resource is an advertisement, the second media resource corresponding to the first media resource includes a pre-roll advertisement of the video, a mid-roll advertisement of the video, and an end-roll advertisement of the video.
[0083] In step S120, a placeholder node of the second media resource in the playback progress of the first media resource is obtained.
[0084] The second media resource is a media resource played during the playing of the first media resource. The playing time of the second media resource during the playing of the first media resource can be determined by the placeholder node of the second media resource in the playing progress of the first media resource.
[0085] The placeholder node of the second media resource in the playback progress of the first media resource refers to: the time point of playing the second media resource during the playback of the first media resource; wherein the time point of playing the second media resource can be referenced by the playback progress of the first media resource.
[0086] For example, when the total playback time of a first media resource is 10 minutes, and the placeholder node of a second media resource corresponding to the first media resource in the playback progress of the first media resource is the 5th minute, the second media resource will be played when the playback progress of the first media resource reaches 5 minutes.
[0087] In one embodiment, a pre-configured placeholder node of a second media resource in the playback progress of a first media resource is obtained.
[0088] In another embodiment, obtaining the placeholder node of the second media resource in the playback progress of the first media resource may include: obtaining information of the first media resource; obtaining configuration information of the second media resource; and determining the placeholder node of the second media resource in the playback progress of the first media resource based on the information of the first media resource and the configuration information of the second media resource.
[0089] The information of the first media resource and the configuration information of the second media resource can be obtained from the server or locally. The information of the first media resource may include but is not limited to the playback duration information and content information. The configuration information of the second media resource is used to characterize the way in which the second media resource is inserted into the first media resource. The configuration information of the second media resource may include but is not limited to quantity information, duration information and attribute information.
[0090] According to the information of the first media resource and the configuration information of the second media resource, the placeholder node of the second media resource in the playback progress of the first media resource may be determined.
[0091] For example, when the information of the first media resource indicates that the playback duration of the first media resource is 12 minutes, and the configuration information of the second media resource indicates that two second media resources need to be equally inserted into the first media resource, it can be determined that the placeholder nodes of the two second media resources in the playback progress of the first media resource are the 4th minute and the 8th minute respectively.
[0092] For another example, when the information of the first media resource indicates that the first media resource describes three plots, and the configuration information of the second media resource indicates that two second media resources need to be inserted into the first media resource while minimizing the impact on the viewing experience, it can be determined that the placeholder nodes of the two second media resources in the playback progress of the first media resource can be the division points between the first plot and the second plot, and the division points between the second plot and the third plot, respectively.
[0093] By adopting the technical solution of the embodiment of the present application, a placeholder node of the second media resource in the playback progress of the first media resource can be determined according to the information of the first media resource and the configuration information of the second media resource, so that the determined placeholder node meets the user's needs.
[0094] In step S130, based on the media resource scheduler, it is determined whether the playback progress of the first media resource reaches the placeholder node.
[0095] The media resource scheduler can monitor the playback progress of the first media resource and the second media resource, and control the player to play the first media resource and the second media resource. The media resource scheduler can obtain the playback progress of the first media resource in real time, and determine whether the playback progress of the first media resource reaches the placeholder node of the second media resource in the playback progress of the first media resource.
[0096] In step S140, when the playing progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node is played.
[0097] When the media resource scheduler monitors that the playback progress of the first media resource reaches the placeholder node corresponding to the second media resource, it can trigger the player to play the second media resource corresponding to the placeholder node.
[0098] In one embodiment, playing the second media resource corresponding to the placeholder node may include: playing the second media resource corresponding to the placeholder node based on a Video Ad Serving Template (VAST) protocol.
[0099] The VAST protocol is a standard protocol developed by the Interactive Advertising Bureau for delivering and managing video ads on the Internet. It aims to ensure seamless delivery and display of ads between different advertising technology platforms and video players. The VAST protocol allows the ad server to provide detailed information about the ad to the video player, such as the type, duration, location of the media file, etc., so that the video player can correctly load and play the ad.
[0100] The VAST protocol is often used in some simple video advertising scenarios, such as pre-roll ads, post-roll ads, pause ads, etc. In these simple video advertising scenarios, the playing time of ads can be easily determined. The VMAP protocol is often used for multi-point interstitial ads, and may also be used in some single-advertising scenarios that require more sophisticated ad control.
[0101] In one embodiment of the present application, the second media resource is played during the playing of the first media resource, and the number of the second media resources can be multiple, so in this embodiment, the second media resource is actually multi-point inserted in the first media resource. On this basis, if the first media resource is a video and the second media resource is an advertisement, then the second media resource is a multi-point inserted advertisement.
[0102] The VAST protocol can better determine the location and time of ad display when delivering single-point ads, but for multi-point insertion, to accurately control the delivery of ads at different time points in the video, a more sophisticated time synchronization and positioning mechanism is required. The VAST protocol itself may not be able to provide sufficiently accurate time control, which may cause the timing of ad insertion to be inconsistent with expectations, affecting the accuracy and effectiveness of ad delivery. Therefore, in related technologies, multi-point insertion of ads is generally based on the VMAP protocol.
[0103] In one embodiment of the present application, the media resource scheduler determines whether the playback progress of the first media resource reaches the placeholder node of the second media resource, thereby achieving accurate control of the playback time of the second media resource, without relying solely on the VAST protocol to determine the playback time of the second media resource. Therefore, when the playback progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node can be played based on the VAST protocol.
[0104] In another embodiment, playing the second media resource corresponding to the placeholder node may also include: playing the second media resource corresponding to the placeholder node based on a VMAP protocol.
[0105] By adopting the technical solution of the embodiment of the present application, the media resource scheduler can determine when to play the second media resource without fixing the link of the second media resource in the first media resource in advance, so there will be no problem of link failure. When the first media resource is a video and the second media resource is an advertisement, the advertisement can be successfully and accurately inserted into the video.
[0106] Based on the above technical solution, as an embodiment, the method may further include: in response to a change in the configuration information of the second media resource, obtaining the changed configuration information of the second media resource; and re-determining the placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the changed configuration information of the second media resource. The determining whether the playback progress of the first media resource reaches the placeholder node based on the media resource scheduler may include: determining whether the playback progress of the first media resource reaches the re-determined placeholder node of the second media resource in the playback progress of the first media resource based on the media resource scheduler.
[0107] In one embodiment of the present application, dynamic insertion of the second media resource can be implemented. When the configuration information of the second media resource is changed, the changed configuration information of the second media resource can be directly obtained, and the placeholder node of the second media resource in the playback progress of the first media resource can be re-determined based on the information of the first media resource and the changed configuration information of the second media resource.
[0108] The configuration information of the second media resource may be changed before playing the first media resource, or during or after playing the first media resource.
[0109] The media resource scheduler can determine whether the playback progress of the first media resource has reached the placeholder node of the re-determined second media resource in the playback progress of the first media resource. If the playback progress of the first media resource has exceeded the placeholder node of the re-determined second media resource in the playback progress of the first media resource, the second media resource can be determined as a played second media resource. For example, if the second media resource queue includes an unplayed second media resource, the second media resource can be determined as a played second media resource by deleting the second media resource in the second media resource queue.
[0110] If the playback progress of the first media resource just reaches the re-determined placeholder node of the second media resource in the playback progress of the first media resource, the second media resource corresponding to the placeholder node may be directly played.
[0111] If the playback progress of the first media resource has not yet reached the re-determined placeholder node of the second media resource in the playback progress of the first media resource, the playback progress of the first media resource can continue to be monitored until the playback progress of the first media resource reaches the re-determined placeholder node, and then the second media resource corresponding to the placeholder node is played.
[0112] In one embodiment, during the process of playing the first media resource, a newly added second media resource corresponding to the first media resource can be inserted into the first media resource for playback. The newly added second media resource can also be regarded as a change in the configuration information of the second media resource. Based on the configuration information of the newly added second media resource and the configuration information of the original second media resource (which can be ignored if there is no original second media resource), as well as the information of the first media resource, the placeholder nodes of each second media resource (including the newly added second media resource and the original second media resource) in the playback progress of the first media resource can be determined, and then based on the placeholder nodes of each second media resource in the playback progress of the first media resource, it is determined whether to play each of the second media resources, and when the playback progress of the first media resource reaches the placeholder node corresponding to any second media resource, the second media resource corresponding to the placeholder node is played.
[0113] By adopting the technical solution of the embodiment of the present application, when the configuration information of the second media resource changes, the placeholder node can be re-determined according to the changed configuration information, and then whether to play the second media resource can be determined according to the re-determined placeholder node, thereby realizing dynamic insertion of the second media resource.
[0114] Based on the above technical solution, as an embodiment, the determination of whether the playback progress of the first media resource reaches the placeholder node based on the media resource scheduler may include: determining the playback time point corresponding to the playback progress of the first media resource based on the media resource scheduler; determining the insertion time point of the second media resource according to the placeholder node of the second media resource in the playback progress of the first media resource; and calculating whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource.
[0115] The media resource scheduler can monitor the playback progress of the first media resource to determine the playback time point corresponding to the playback progress of the first media resource. The media resource scheduler can determine the insertion time point of the second media resource based on the placeholder node of the second media resource in the playback progress of the first media resource. The insertion time point of the second media resource refers to the time point at which the second media resource is played in the playback progress of the first media resource.
[0116] The media resource scheduler may calculate whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource. When the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource, it is determined that the playback progress of the first media resource has reached the placeholder node; when the playback time point corresponding to the playback progress of the first media resource is not equal to the insertion time point of the second media resource, it is determined that the playback progress of the first media resource has not reached the placeholder node.
[0117] For example, the placeholder node corresponding to the second media resource is located at 1 / 2 of the playback progress of the first media resource; the total playback time of the first media resource is 10 minutes; the media resource scheduler can determine that the insertion time point corresponding to the placeholder node is the 5th minute; the media resource scheduler can monitor the playback progress of the first media resource in real time to obtain the playback time point corresponding to the playback progress of the first media resource; when the media resource scheduler monitors that the playback time point of the first media resource is the 5th minute, which is equal to the insertion time point of the second media resource, the playback progress of the first media resource can be determined to have reached the placeholder node. By adopting the technical solution of the embodiment of the present application, the playback time point corresponding to the playback progress of the first media resource and the insertion time point of the second media resource can be determined, so as to accurately determine whether the playback progress of the first media resource has reached the placeholder node according to whether the playback time point is equal to the insertion time point, so as to determine whether to play the second media resource.
[0118] Based on the above technical solution, as an embodiment, before the playback progress of the first media resource reaches the placeholder node, the method may further include: obtaining the difference between the insertion time point of the second media resource and the playback time point corresponding to the playback progress of the first media resource; when the difference is less than a difference threshold, loading the second media resource corresponding to the placeholder node.
[0119] In order to ensure that when the playback progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node can be quickly played, the second media resource corresponding to the placeholder node can be preloaded.
[0120] When the playback progress of the first media resource has not yet reached the placeholder node, the media resource scheduler can obtain the difference between the insertion time point of the second media resource and the playback time point corresponding to the playback progress of the first media resource, and the difference represents the time required from the playback time point to the insertion time point. When the difference is less than the difference threshold, it represents that the placeholder node is about to be reached, so the second media resource corresponding to the placeholder node can be loaded. The difference threshold can be set in advance according to actual needs.
[0121] Optionally, the data volume of the second media resource corresponding to the placeholder node can be obtained, and the difference threshold can be determined according to the data volume of the second media resource, and the data volume of the second media resource is proportional to the difference threshold, so as to ensure that the loading of the second media resource can be completed before reaching the placeholder node.
[0122] By adopting the technical solution of the embodiment of the present application and preloading the second media resource, it can be ensured that when the playback progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node is quickly played, thereby improving efficiency.
[0123] Based on the above technical solution, as an embodiment, when there are multiple second media resources corresponding to the first media resource, the obtaining of the second media resource corresponding to the first media resource may include: obtaining a queue consisting of multiple second media resources corresponding to the first media resource; the second media resources in the queue are arranged in order from front to back according to the placeholder nodes. The determining whether the playback progress of the first media resource reaches the placeholder node based on the media resource scheduler may include: determining whether the playback progress of the first media resource reaches the placeholder node of the second media resource at the front of the queue based on the media resource scheduler.
[0124] When there are multiple second media resources corresponding to the first media resource, multiple second media resources can be obtained and put into a queue to obtain a queue of second media resources. The second media resources in the queue can be arranged in order from front to back according to the placeholder nodes in the playback progress of the first media resource. Each queue of second media resources corresponds to a first media resource, and the second media resources in the queue are all second media resources corresponding to the first media resource.
[0125] For example, there are three second media resources corresponding to the first media resource, namely, second media resource A, second media resource B and second media resource C; the insertion time point corresponding to the placeholder node of second media resource A is the 1st minute; the insertion time point corresponding to the placeholder node of second media resource B is the 3rd minute; the insertion time point corresponding to the placeholder node of second media resource C is the 6th minute; then, in the second media resource queue, second media resource A is ranked first, followed by second media resource B, and finally second media resource C.
[0126] When determining whether the playback progress of the first media resource has reached the placeholder node, the media resource scheduler may only determine whether the playback progress of the first media resource has reached the placeholder node corresponding to the second media resource that is at the front in the queue of the second media resource. When the playback progress of the first media resource reaches the placeholder node corresponding to the second media resource that is at the front in the queue of the second media resource, the player is controlled to play the second media resource that is at the front, and the second media resource is deleted from the queue of the second media resource.
[0127] By adopting the technical solution of the embodiment of the present application, only determining whether the playback progress of the first media resource reaches the placeholder node corresponding to the second media resource that is at the front of the queue of the second media resources can greatly save computing resources compared to determining whether the playback progress reaches the placeholder node corresponding to each second media resource each time.
[0128] Based on the above technical solution, as an embodiment, after playing the second media resource corresponding to the placeholder node, the method may further include: deleting the second media resource corresponding to the placeholder node from the queue; determining whether the queue is empty; when the queue is not empty, polling to start the media resource scheduler; when the queue is empty, closing the media resource scheduler.
[0129] When the playback progress of the first media resource reaches the placeholder node corresponding to the second media resource that is at the front in the queue of the second media resource, the media resource scheduler controls the player to play the second media resource that is at the front and deletes the second media resource from the queue of the second media resource.
[0130] It can be checked whether the queue of the second media resource is empty. When the queue of the second media resource is not empty, it proves that there is a second media resource that has not been played, so the media resource scheduler is also needed to control the playback of the second media resource. Therefore, the media resource scheduler can be polled to start.
[0131] When the queue of the second media resource is empty, it proves that the second media resource has been played completely, so there is no need for the media resource scheduler to control the playing of the second media resource, and therefore, the media resource scheduler can be closed.
[0132] By adopting the technical solution of the embodiment of the present application, it is possible to determine whether to start the media resource scheduler by checking whether the queue of the second media resource is empty, so as to shut down the media resource scheduler when the queue is empty, thereby saving processing resources.
[0133] In one embodiment, Figure 2As shown, the media resource scheduler can be an advertising video scheduler, the first media resource can be a feature film, and the second media resource can be an advertisement. The advertising video scheduler can obtain the progress of the feature film playback, and according to the difference between the feature film playback progress and the advertisement placeholder node, load the advertisement in advance, and record the played feature film and the loaded advertisement. When the feature film playback progress reaches the advertisement placeholder node, the advertisement is played. When the advertisement is successfully played, the advertisement can be deleted from the queue, and it can be determined whether the queue is empty after deleting the advertisement. If it is empty, the advertising video scheduler can be closed; if it is not empty, the advertising video scheduler can be polled. When the playback is unsuccessful, the advertising video scheduler can control the player to replay the advertisement according to the recorded feature film and advertisement.
[0134] In order to better implement the media resource playback method of the present application, the present application also provides a media resource playback device based on the above media resource playback method. The meanings of the terms are the same as those in the above media resource playback method, and the specific implementation details can refer to the description in the method embodiment.
[0135] See also Figure 3 , Figure 3 : is a schematic diagram of the structure of a media resource playback device provided in an embodiment of the present application, wherein the media resource playback device may include:
[0136] Resource acquisition module 301, used to acquire a second media resource corresponding to the first media resource;
[0137] A node acquisition module 302 is used to acquire a placeholder node of the second media resource in the playback progress of the first media resource;
[0138] A progress determination module 303, configured to determine whether the playback progress of the first media resource reaches the placeholder node based on a media resource scheduler;
[0139] The resource playing module 304 is configured to play a second media resource corresponding to the placeholder node when the playing progress of the first media resource reaches the placeholder node.
[0140] In one embodiment, the progress determination module 303 includes:
[0141] A first determining unit, configured to determine, based on the media resource scheduler, a playback time point corresponding to the playback progress of the first media resource;
[0142] A second determining unit, configured to determine an insertion time point of the second media resource according to a placeholder node of the second media resource in the playback progress of the first media resource;
[0143] The calculation unit is used to calculate whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource.
[0144] In one embodiment, before the playback progress of the first media resource reaches the placeholder node, the apparatus further includes:
[0145] A difference acquisition module, used to acquire a difference between an insertion time point of the second media resource and a playback time point corresponding to a playback progress of the first media resource;
[0146] A loading module is used to load the second media resource corresponding to the placeholder node when the difference is less than a difference threshold.
[0147] In one embodiment, when there are multiple second media resources corresponding to the first media resource, the resource acquisition module 301 includes:
[0148] A queue acquisition unit, configured to acquire a queue consisting of a plurality of second media resources corresponding to a first media resource; the second media resources in the queue are arranged in an orderly manner according to the order of the placeholder nodes from front to back;
[0149] The progress determination module 303 includes:
[0150] A progress determination unit is used to determine, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node of the second media resource at the front of the queue.
[0151] In one of the embodiments, after playing the second media resource corresponding to the placeholder node, the apparatus further includes:
[0152] a deleting module, configured to delete the second media resource corresponding to the placeholder node from the queue;
[0153] A queue determination module, used to determine whether the queue is empty;
[0154] A starting module, used for polling and starting the media resource scheduler when the queue is not empty;
[0155] The closing module is used to close the media resource scheduler when the queue is empty.
[0156] In one embodiment, the node acquisition module 302 includes:
[0157] A first information acquisition unit, configured to acquire information about the first media resource;
[0158] A second information acquisition unit, configured to acquire configuration information of the second media resource;
[0159] A node determination unit is used to determine a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the configuration information of the second media resource.
[0160] In one embodiment, the device further comprises:
[0161] a change acquisition module, configured to acquire the changed configuration information of the second media resource in response to a change in the configuration information of the second media resource;
[0162] a redetermining module, configured to redetermine a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the changed configuration information of the second media resource;
[0163] The progress determination module 303 includes:
[0164] A redetermining unit is used to determine, based on the media resource scheduler, whether the playback progress of the first media resource reaches the redetermined placeholder node of the second media resource in the playback progress of the first media resource.
[0165] By adopting the technical solution of the embodiment of the present application, the media resource scheduler can determine when to play the second media resource without fixing the link of the second media resource in the first media resource in advance, so there will be no problem of link failure. When the first media resource is a video and the second media resource is an advertisement, the advertisement can be successfully and accurately inserted into the video.
[0166] For the specific definition of the playback device of media resources, please refer to the definition of the playback method of media resources above, which will not be repeated here. Each module in the playback device of the above media resources can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0167] In addition, the present application also provides an electronic device, such as Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in this application, specifically:
[0168] The electronic device may include one or more processors 401 of processing cores and one or more computer-readable storage media memories 402 and other components. Those skilled in the art will appreciate that Figure 4The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0169] The processor 401 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0170] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0171] In one embodiment, the electronic device further includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, power consumption management and other functions through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power supply device debugging circuits, power converters or inverters, and power status indicators.
[0172] In one embodiment, the electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0173] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application program stored in the memory 402, thereby implementing the steps in any one of the media resource playback methods provided in the embodiments of the present application.
[0174] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0175] In one embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in any embodiment of the present application is implemented.
[0176] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present application is implemented.
[0177] In some embodiments, a computer program product is also proposed, including a computer program or instructions, which implement the method described in any embodiment of the present application when executed by a processor.
[0178] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0179] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0180] To this end, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any media resource playback method provided in the present application.
[0181] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0182] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0183] Since the instructions stored in the computer-readable storage medium can execute the steps in any method for playing media resources provided in the present application, the beneficial effects that can be achieved by any method for playing media resources provided in the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0184] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0185] The above is a detailed introduction to a media resource playback method, device, electronic device and computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for playing a media resource, characterized in that: include: Acquire a second media resource corresponding to the first media resource; Obtaining a placeholder node of the second media resource in the playback progress of the first media resource; Determining, based on a media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node; as well as When the play progress of the first media resource reaches the placeholder node, the second media resource corresponding to the placeholder node is played.
2. The method according to claim 1, characterized in that The determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes: Determining, based on the media resource scheduler, a playback time point corresponding to the playback progress of the first media resource; Determining an insertion time point of the second media resource according to a placeholder node of the second media resource in the playback progress of the first media resource; Calculate whether the playback time point corresponding to the playback progress of the first media resource is equal to the insertion time point of the second media resource.
3. The method according to claim 2, characterized in that Before the playback progress of the first media resource reaches the placeholder node, the method further includes: Obtaining a difference between an insertion time point of the second media resource and a playback time point corresponding to a playback progress of the first media resource; When the difference is less than the difference threshold, a second media resource corresponding to the placeholder node is loaded.
4. The method according to claim 1, characterized in that: When there are multiple second media resources corresponding to the first media resource; The acquiring the second media resource corresponding to the first media resource includes: Acquire a queue consisting of a plurality of second media resources corresponding to the first media resource; arrange the second media resources in the queue in an orderly manner according to the order of the placeholder nodes from front to back; The determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes: Based on the media resource scheduler, it is determined whether the playback progress of the first media resource reaches the placeholder node of the second media resource at the front row in the queue.
5. The method according to claim 4, characterized in that After playing the second media resource corresponding to the placeholder node, the method further includes: deleting a second media resource corresponding to the placeholder node from the queue; determining whether the queue is empty; When the queue is not empty, polling and starting the media resource scheduler; When the queue is empty, the media resource scheduler is closed.
6. The method according to claim 1, characterized in that The obtaining of the placeholder node of the second media resource in the playback progress of the first media resource includes: Acquire information about the first media resource; Acquire configuration information of the second media resource; A placeholder node of the second media resource in the playback progress of the first media resource is determined according to the information of the first media resource and the configuration information of the second media resource.
7. The method according to claim 6, characterized in that The method further comprises: In response to a change in the configuration information of the second media resource, acquiring the changed configuration information of the second media resource; Re-determining a placeholder node of the second media resource in the playback progress of the first media resource according to the information of the first media resource and the changed configuration information of the second media resource; The determining, based on the media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node includes: Based on the media resource scheduler, it is determined whether the playback progress of the first media resource reaches the re-determined placeholder node of the second media resource in the playback progress of the first media resource.
8. A media resource playback device, characterized in that: include: A resource acquisition module, used to acquire a second media resource corresponding to the first media resource; A node acquisition module, used to acquire a placeholder node of the second media resource in the playback progress of the first media resource; A progress determination module, configured to determine, based on a media resource scheduler, whether the playback progress of the first media resource reaches the placeholder node; as well as The resource playing module is used to play the second media resource corresponding to the placeholder node when the playing progress of the first media resource reaches the placeholder node.
9. An electronic device, characterized in that: It comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the method for playing media resources as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the method for playing media resources according to any one of claims 1 to 7 are implemented.