Media file switching method and apparatus

By adding a marker field to the track information of multimedia files, the problem of high cost of switching multi-track media files in browsers is solved, achieving seamless and low-cost media file switching, suitable for seamless switching between web pages and local players.

WO2026007585A1PCT designated stage Publication Date: 2026-01-08SHANGHAI BILIBILI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/097717
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-05
Filing Date
2025-05-28
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

Existing technologies for playing multitrack media files in browsers have drawbacks, such as increased usage costs and difficulty in reusing existing server and client systems. This is mainly due to the differences in preprocessing and playback logic, which necessitate downloading multiple media files.

Method used

By adding a flag field to the track basic information of multimedia files, the flag can indicate the main track that needs to be played. The flag can be adjusted in response to switching events to control the switching of media files in the webpage embedded player, thus achieving seamless switching of audio or video tracks.

Benefits of technology

It enables seamless switching of media files in the browser, avoiding stuttering and playback time jumps, has low usage costs, and is easy to reuse in existing systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025097717_08012026_PF_FP_ABST
    Figure CN2025097717_08012026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a media file switching method and apparatus, the method comprising: acquiring basic track information corresponding to a multimedia file, the multimedia file corresponding to a plurality of media files of different tracks, the basic track information comprising a flag bit, and the flag bit being used for indicating a main track that currently needs to be played back; in response to a switching event for a media file being played back, adjusting the flag bit in the basic track information; and, on the basis of the flag bit, controlling a media file played back in an embedded player of a webpage to be switched to. A flag bit field is added, and the flag bit field is used to indicate the main track that currently needs to be played back. When the media file of the track currently being played back needs to be switched, the flag bit in the basic track information is directly modified, so that audio or video tracks that are the same as those of a local player can be seamlessly switched in a web page / browser without lagging, a black screen appearing, and time jumps during playback.
Need to check novelty before this filing date? Find Prior Art

Description

Switching method and device of media file

[0001] The present application claims priority to the Chinese patent application No.CN202410903630.3, filed on July 5, 2024, and entitled "Switching method and device of media file", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] Embodiments of the present application relate to the technical field of Internet, and in particular, to a switching method and device of media file, computer device, computer readable storage medium, computer program product. BACKGROUND

[0003] Although multi-track media is an industry standard, it is currently only used in the scene of local playback because only a small number of browsers support it. When playing multimedia video in a browser, although the media files of multiple tracks can be preprocessed into multiple media files on a server to realize playback and track switching, there is a big difference between the preprocessing and playback logic and the ordinary media playback logic, which is reflected in that only one media file needs to be downloaded before playing the media, but after using this scheme, at least two media files need to be downloaded, thus increasing the use cost and making it difficult to reuse the existing server and client system.

[0004] It should be noted that the above content is not necessarily prior art, nor is it used to limit the patent protection scope of the present application. SUMMARY

[0005] Embodiments of the present application provide a switching method and device of media file, computer device, computer readable storage medium, computer program product, to solve or alleviate one or more technical problems raised above.

[0006] One aspect of embodiments of the present application provides a switching method of media file, the method comprising:

[0007] obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to multiple media files of different tracks, and the track basic information contains a mark bit, wherein the mark bit is used to indicate a main track currently needed to be played;

[0008] in response to a switching event for the played media file, adjusting the mark bit in the track basic information;

[0009] controlling the media file played in the embedded player of the switching webpage according to the mark bit.

[0010] Optionally, the track basic information corresponding to the multimedia file comprises:

[0011] acquiring a multimedia file and parsing the track basic information corresponding to the multimedia file from the multimedia file.

[0012] Optionally, after the step of acquiring the track basic information corresponding to the multimedia file, the method further comprises:

[0013] caching the track basic information corresponding to the multimedia file in a preset cache area;

[0014] The step of adjusting the mark bit in the track basic information in response to the switching event for the played media file comprises:

[0015] adjusting the mark bit in the track basic information cached in the preset cache area in response to the switching event for the played media file.

[0016] Optionally, the step of controlling the switching of the media file played in the embedded player of the webpage according to the mark bit comprises:

[0017] reading the mark bit in the track basic information cached in the preset cache area in the case that the embedded player of the webpage completes the playing of the media file;

[0018] controlling the switching of the media file played in the embedded player of the webpage according to the mark bit.

[0019] Optionally, the step of controlling the switching of the media file played in the embedded player of the webpage according to the mark bit comprises:

[0020] determining a target media file from the plurality of media files of different tracks according to the mark bit;

[0021] controlling the switching of the media file played in the embedded player of the webpage to the target media file.

[0022] Optionally, the data structure of the multimedia file comprises a data area; and before the step of determining a target media file from the plurality of media files of different tracks according to the mark bit, the method further comprises:

[0023] parsing the plurality of media files of different tracks corresponding to the multimedia file from the data area of the multimedia file.

[0024] Optionally, the step of adjusting the mark bit in the track basic information in response to the switching event for the played media file comprises:

[0025] In response to a switching event for the played media file, a first track currently required to be played and a second track currently not required to be played are determined; wherein the second track contains one or more media files;

[0026] The first track is set as a main track and the second track is set as a non-main track in the mark bit.

[0027] Another aspect of the embodiments of the present application provides a switching device for a media file, the device comprising:

[0028] a track basic information obtaining module, configured to obtain track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0029] a mark bit adjusting module, configured to adjust the mark bit in the track basic information in response to a switching event for the played media file;

[0030] a media file switching module, configured to control switching of a media file played in an embedded player of a webpage according to the mark bit.

[0031] Another aspect of the embodiments of the present application provides a computer device, comprising:

[0032] at least one processor; and

[0033] a memory in communication connection with the at least one processor;

[0034] wherein: the memory stores computer readable instructions executable by the at least one processor, and the computer readable instructions are executed by the at least one processor to enable the at least one processor to perform the following steps:

[0035] obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0036] adjusting the mark bit in the track basic information in response to a switching event for the played media file;

[0037] controlling switching of a media file played in an embedded player of a webpage according to the mark bit.

[0038] Another aspect of the embodiments of the present application provides a computer readable storage medium, the computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor to implement the following steps:

[0039] obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0040] adjusting the mark bit in the track basic information in response to a switching event for the played media file;

[0041] controlling the media file played in the embedded player of the switching webpage according to the mark bit.

[0042] Another aspect of the embodiment of the present application provides a computer program product, comprising computer readable instructions, which, when executed by a processor, implement the following steps:

[0043] obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0044] adjusting the mark bit in the track basic information in response to a switching event for the played media file;

[0045] controlling the media file played in the embedded player of the switching webpage according to the mark bit.

[0046] The embodiment of the present application adopts the above technical solution and can include the following advantages: by adding a mark bit field in the track basic information corresponding to the multimedia file, the mark bit field is used to indicate the main track currently required to be played; when the media file of the track currently played needs to be switched, the mark bit in the track basic information is directly modified, the track required to be switched is set as the main track, and the other tracks are set as non-main tracks; the switching of the media file in the embedded player of the webpage can be realized through the mark bit, the switching process can be realized without the user's awareness of switching the media file, and thus the seamless switching of the audio or video track in the webpage / browser can be realized as in the local player, without the problems of lag, black screen, and time jump, and the use cost of the solution is low, and the solution is easy to be reused in the existing server and client system. BRIEF DESCRIPTION OF DRAWINGS

[0047] The accompanying drawings, which are included to provide a further understanding of the application and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain exemplary embodiments of the application. The components in the drawings are only for the purpose of illustration and do not limit the scope of the claims. In all the drawings, the same reference numerals refer to the same or similar elements throughout the various figures.

[0048] Fig. 1 schematically shows a running environment diagram of a switching method of a media file according to Embodiment One of the present application;

[0049] Fig. 2 schematically shows a flow chart of a switching method of a media file according to Embodiment One of the present application;

[0050] Fig. 3 schematically shows a module block diagram of a switching of a media file in MP4 format;

[0051] Fig. 4 schematically shows a block diagram of a switching device of a media file according to Embodiment Two of the present application; and

[0052] Fig. 5 schematically shows a hardware architecture diagram of a computer device according to Embodiment Three of the present application. Embodiments of the present application

[0053] In order to make the purposes, technical solutions and advantages of the present application more clear, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present application.

[0054] It should be noted that the description of "first", "second" and the like in the embodiments of the present application is only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the technical features indicated or the number of the technical features indicated. Therefore, the features with "first", "second" can explicitly or implicitly include at least one of the features. In addition, the technical solutions of each embodiment can be combined with each other, but it must be based on the fact that those of ordinary skill in the art can realize it, and when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, and is not within the scope of protection claimed by the present application.

[0055] In the description of the present application, it should be understood that the numerical reference number before the step does not indicate the order of execution of the steps before and after the step, but is only used to facilitate the description of the present application and to distinguish each step, and therefore cannot be understood as a limitation on the present application.

[0056] First, the terms related to the present application are explained:

[0057] Encapsulation format: generally called encapsulation format or container format, is a format used to store audio and video data.

[0058] MP4: MP4 or MPEG-4 Part 14 is a standard digital multimedia container format. The extension for MPEG-4 Part 14 is.mp4, which is mainly used to store digital audio and digital video, but can also store subtitles and still images. It is a streaming format as it can contain a video stream that supports bit streaming (such as advanced video coding). The format of MP4 stores various data in units of Box, which can contain another Box.

[0059] Track: Common media files contain audio and video, which are generally called audio track and video track respectively. Generally, a media file contains only one audio track and one video track, but many encapsulation formats support multiple tracks.

[0060] MediaSource: Media Source Extensions API or MSE is a media playback interface provided by the browser to developers, which allows playing audio and video files generated by program code, instead of only playing audio and video from files or network addresses.

[0061] Keyframe: A complete content frame that can be used as a starting frame. Non-key frames are frames that need to refer to one or more frames to synthesize complete content.

[0062] MIME Type: Multipurpose Internet Mail Extensions (MIME) is an Internet standard. Browsers usually use MIME types (not file extensions) to determine how to handle URLs, so it is very important for web servers to add the correct MIME type in the response header. If the configuration is not correct, the browser may not be able to parse the file content, the website will not work properly, and the downloaded file will also be processed incorrectly. In MediaSource, MIME Type is needed to tell the browser the format of the currently played audio and video.

[0063] Secondly, in order to facilitate the understanding of the technical solutions provided by the person skilled in the art, the related art is described as follows:

[0064] MP4 format container supports storing multiple audio and video tracks, and most local players support switching the currently played track at any time when playing multi-track media files.

[0065] In the web browser standard, track switching can be performed by controlling the enabled attribute of audioTracks and videoTracks, but this function is not supported in the new version and most browser kernels on the market.

[0066] In view of poor support of browsers for multi-track media formats, most solutions store tracks in multiple media files, so that each media file has only one audio or video track, and each time the video track file and the audio track file needed for playing are downloaded for playing, and then played through the MediaSource interface provided by the browser.

[0067] Although multi-track media is an industry standard, it is currently only used in local playback scenarios because only a small number of browsers support it. When playing multimedia video in a browser, although the media files of multiple tracks can be preprocessed into multiple media files on a server to achieve playback and track switching, there is a big difference between the preprocessing and playback logic and the ordinary media playback logic, which is reflected in that the previous media only needs to download one media file, but after using this solution, at least two media files need to be downloaded, thus increasing the use cost and making it difficult to reuse the existing server and client system.

[0068] To this end, an embodiment of the present application provides a technical solution for switching of media files. In the technical solution, track basic information corresponding to a multimedia file is obtained, wherein the multimedia file corresponds to multiple media files of different tracks, and the track basic information includes a flag bit, wherein the flag bit is used to indicate the main track currently needed for playing; in response to a switching event for the played media file, the flag bit in the track basic information is adjusted; and the media file played in the embedded player of the webpage is controlled according to the flag bit. By adding a flag bit field to the track basic information corresponding to the multimedia file, the flag bit field is used to indicate the main track currently needed for playing, and when the media file of the track currently played needs to be switched, the track to be switched to is directly set as the main track and the other tracks are set as non-main tracks by modifying the flag bit in the track basic information, so that the switching of the media file in the embedded player of the webpage can be realized through the flag bit, the switching process has small delay, and the media file can be switched without user awareness at the user end, so that the same seamless switching of audio or video tracks as the local player can be realized in the webpage / browser, without lag, black screen, or jump in playing time, and the use cost of the solution is low and the solution is easy to reuse in the existing server and client system. See the following for details.

[0069] Finally, for the convenience of understanding, an example of a running environment is provided below.

[0070] FIG. 1 schematically shows an environment application diagram according to an embodiment of the present application.

[0071] The environment diagram can include a service platform 2, one or more clients 4, and a network 6.

[0072] The service platform 2 and the one or more clients 4 can be coupled through the network 6 to enable information transfer interactions.

[0073] The service platform 2, the client 4, and the network 6 are described in detail below.

[0074] The service platform 2 can be composed of one or more computing devices. The one or more computing devices can include virtualized computing instances. The virtualized computing instances can include virtual machines, such as emulations of computer systems, operating systems, servers, and the like. The computing devices can load the virtual machines based on virtual images and / or other data that define particular software (e.g., operating systems, specialized applications, servers) for the emulation. Different virtual machines can be loaded and / or terminated on the one or more computing devices as the demand for different types of processing services changes. A hypervisor can be implemented to manage the use of different virtual machines on the same computing device. The service platform 2 can run one or more services or software applications that enable the performance of the methods described herein. The service platform 2 can also provide other services or software applications, which can include non-virtualized and virtualized environments. In some embodiments, these services can be provided as web-based services or cloud services, such as to users of the clients 4 under a software as a service (SaaS) model.

[0075] The service platform 2 can include one or more components that implement the functionality performed by the service platform 2. These components can include software components, hardware components, or a combination thereof, executable by one or more processors. In some embodiments, the service platform 2 can provide storage, read, write, query, delete, and the like services, such as switching services for media files provided to clients. In other embodiments, users operating the clients 4 can in turn utilize one or more client applications to interact with the service platform 2 to utilize the services provided by these components.

[0076] The client 4 can include various types of computer devices, such as portable handheld devices, general purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other electronic devices, etc. These computer devices can run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows, Mobile OS, iOS, Windows Phone, Android. The portable handheld devices can include cellular phones, smart phones, tablet computers, personal digital assistants, etc. The wearable devices can include head-mounted displays (such as smart glasses), etc. The gaming systems can include various handheld gaming devices, Internet-enabled gaming devices, etc. The client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.

[0077] Based on the operating system described above, the client 4 can also be installed with one or more applications, such as a handler for switching of media files.

[0078] The client 4 can include input / output interfaces. The input interfaces can include touchpads, touch screens, mice, keyboards, or other sensing elements. The input interfaces can be configured to receive user instructions, which can cause the client 4 to perform various operations, such as switching of media files, etc. The output interfaces are used to output information, such as display information, to the user.

[0079] The network 6 can be used as a transmission medium between the service platform 2 and the client 4. The network 6 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network can include physical links, such as coaxial cable links, twisted-pair cable links, fiber-optic links, combinations thereof, etc., or wireless links, such as cellular links, satellite links, Wi-Fi links, etc.

[0080] It is noted that the above-described devices are exemplary, and the number and types of devices can be adjusted in different scenarios or according to different needs.

[0081] Embodiment One

[0082] FIG. 2 shows a flow chart of a switching method of a media file according to Embodiment One of the present application.

[0083] As shown in FIG. 2, the switching method of the media file can include steps S202-S208, wherein:

[0084] In step S202, track basic information corresponding to a multimedia file is acquired; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a flag bit, wherein the flag bit is used to indicate a main track currently required to be played.

[0085] In step S204, in response to a switching event of the played media file, the flag bit in the track basic information is adjusted.

[0086] In step S206, the media file played in the embedded player of the switching webpage is controlled according to the flag bit.

[0087] The switching method of the media file provided by the present embodiment: by adding a flag bit field in the track basic information corresponding to the multimedia file, the flag bit field is used to indicate the main track currently required to be played, when the media file of the track currently played needs to be switched, the track required to be switched is directly set as the main track and the other tracks are set as non-main tracks by modifying the flag bit in the track basic information, so that the switching of the media file in the embedded player of the webpage can be realized by the flag bit, the switching process can be realized without feeling by the user end, so that the seamless switching of the audio or video track in the webpage / browser can be realized as the local player, without appearing to be stuck, black screen, and time jump, and the use cost of the scheme is lower, and it is easy to be reused in the existing server and client system.

[0088] The steps S202-S206 and optional other steps are described in detail below in combination with FIG. 2.

[0089] In step S202, track basic information corresponding to a multimedia file is acquired; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a flag bit, wherein the flag bit is used to indicate a main track currently required to be played.

[0090] The multimedia file corresponds to media files of multiple different tracks, such as two video tracks and two audio tracks, and these media files of different tracks can be packaged in one multimedia file, and the media file currently required to be played can be selected when played in the embedded player of the webpage.

[0091] In the embodiment, in order to realize seamless switching of the media file played in the embedded player of the webpage, a mark bit field is added in the track basic information corresponding to the multimedia file, and the mark bit field is used to indicate the main track currently required to be played, wherein the main track is the track used by the player by default, so that when the track needs to be switched, the mark bit field can be directly modified. Specifically, the embedded player of the webpage reads the main track indicated in the mark bit field and acquires the multimedia file corresponding to the main track to play the multimedia file each time the multimedia file is played.

[0092] Step S204, in response to the switching event of the played media file, adjusting the mark bit in the track basic information;

[0093] Specifically, a processing program for realizing switching of the media file is deployed in the embedded player of the webpage, and when the embedded player of the webpage receives the switching event of the played media file, the processing program can be used to respond to the switching event of the played media file to adjust the mark bit in the track basic information.

[0094] Step S206, according to the mark bit, controlling switching of the media file played in the embedded player of the webpage.

[0095] In the embodiment, the embedded player of the webpage reads the main track recorded in the mark bit field and acquires the multimedia file corresponding to the main track to play the multimedia file each time the multimedia file is played. Specifically, after the embedded player of the webpage completes the played media file, the mark bit in the track basic information is re-read, and then the key frame of the media file corresponding to the main track is acquired according to the mark bit, the key frame is sent to the MediaSource interface of the embedded player of the webpage, and the media file corresponding to the main track is played by using the MediaSource interface.

[0096] In an optional embodiment of the present application, the track basic information corresponding to the multimedia file is acquired, including:

[0097] The multimedia file is acquired, and the track basic information corresponding to the multimedia file is parsed from the multimedia file.

[0098] In the embodiment, a processing program for realizing switching of the media file is deployed in the embedded player of the webpage, and when the media file is played, the processing program can be used to acquire the multimedia file and parse the track basic information corresponding to the multimedia file from the multimedia file.

[0099] Specifically, different packaging formats have different storage structures for multi-track files, but most formats include a "track information area" and a "data area". For example, in the MP4 format shown in FIG. 3, each area is referred to as a Box, the track header is stored by means of a TKHD and a TFHD Box, MDAT is an audio / video data block, and the track and data can be associated by means of the TKHD and the TFHD Box. In addition, the MP4 format includes other types of Box, which are omitted in FIG. 3.

[0100] The TKHD includes a flag indicating whether the current track is a main track (the main track is a track that is used by default by a player), and if the TFHD exists, the TKHD associates the track number (track_id) with the TFHD having the same track number.

[0101] In most browsers, all formats in the track can be listed in the MIME Type and placed in the codecs field to enable the browser to normally play the video. For example, if a media file includes two AVC tracks and two AAC tracks, the media file can be written as video / mp4; codecs="avc1.64002a, avc1.64002a, mp4a.40.2, mp4a.40.2".

[0102] In an optional embodiment of the present application, after the step of obtaining the track header information corresponding to the media file, the method further includes:

[0103] storing the track header information corresponding to the media file in a preset cache area.

[0104] In this embodiment, the embedded player of the webpage can have a corresponding preset cache area, and after the track header information corresponding to the media file is obtained, the track header information corresponding to the media file can be stored in the preset cache area.

[0105] In an optional embodiment of the present application, the step of adjusting the flag in the track header information in response to a switching event for the played media file includes:

[0106] The step of adjusting the flag in the track header information in response to a switching event for the played media file includes:

[0107] In the embodiment, a processing program for realizing switching of media files is deployed in the embedded player of the webpage, and when the embedded player of the webpage receives a switching event for the played media file, the processing program is used to respond to the switching event for the played media file, and the flag bit in the track basic information cached in the preset cache area is adjusted, so as to realize switching of media files.

[0108] In an optional embodiment of the present application, the method for controlling switching of the media file played in the embedded player of the webpage according to the flag bit comprises:

[0109] In the case where the embedded player of the webpage completes the played media file, the flag bit in the track basic information cached in the preset cache area is read, and the media file played in the embedded player of the webpage is controlled according to the flag bit.

[0110] In the embodiment, in the case where the embedded player of the webpage completes the played media file, at this time, the embedded player of the webpage is ready to play the next media file, and the flag bit in the track basic information cached in the preset cache area is read. Since the flag bit in the track basic information cached in the preset cache area has been modified, the main track currently required to be played can be directly determined according to the modified flag bit, and the media file played in the embedded player of the webpage is controlled according to the flag bit.

[0111] It should be noted that if the flag bit is not modified, after the embedded player of the webpage reads the flag bit in the track basic information cached in the preset cache area, the multimedia file can be played according to the initially set main track.

[0112] In an optional embodiment of the present application, the method for controlling switching of the media file played in the embedded player of the webpage according to the flag bit comprises:

[0113] The target media file is determined from the plurality of different track media files according to the flag bit, and the media file played in the embedded player of the webpage is controlled to be switched to the target media file.

[0114] In the embodiment, when the embedded player of the webpage plays a multimedia file, after playing a media file, the target media file is determined from the plurality of different track media files according to the flag bit, and the media file played in the embedded player of the webpage is controlled to be switched to the target media file.

[0115] In an alternative embodiment of the present application, the data structure of the multimedia file comprises a data area; before the step of determining the target media file from the media files of the plurality of different tracks according to the mark bit, the method further comprises:

[0116] parsing the media files of the plurality of different tracks corresponding to the multimedia file from the data area of the multimedia file.

[0117] In the embodiment, the data structure of the multimedia file comprises a data area, and before determining the target media file, the media files of the plurality of different tracks corresponding to the multimedia file can be parsed from the data area of the multimedia file.

[0118] In an alternative embodiment of the present application, the step of adjusting the mark bit in the track basic information in response to the switching event for the played media file comprises:

[0119] In response to the switching event for the played media file, determining the first track currently required to be played and the second track currently not required to be played; wherein the second track comprises one or more media files; setting the first track as the main track and setting the second track as the non-main track in the mark bit.

[0120] In the embodiment, a processing program for implementing the switching of media files is deployed in the embedded player of the webpage, when the embedded player of the webpage receives the switching event for the played media file, the processing program determines the first track currently required to be played and the second track currently not required to be played in response to the switching event for the played media file; wherein the second track comprises one or more media files; then, the first track is set as the main track and the second track is set as the non-main track in the mark bit. For example, in FIG. 3, it is assumed that the video 2 and the audio 1 are switched to, then the video 2 and the audio 1 are set as the main track, and the video 1 and the audio 2 are set as the non-main track.

[0121] The processing program caches the header information of the MP4, specifically, in the MP4, it is called MOOV, which comprises TKHD, then the mark bit indicating whether it is the main track in the cached TKHD is modified, the track switched to is set as the main track, and the other tracks are set as the non-main track, when the embedded player of the webpage is ready to insert the next audio / video key frame, the modified MP4 header information is sent into the MediaSource again, and then the key frame and the subsequent content are sent, so that the track switching is completed.

[0122] Embodiment two

[0123] Fig. 4 shows a block diagram of a media file switching device according to Embodiment Two of the present application, which can be divided into one or more program modules stored in a storage medium and executed by one or more processors to complete the embodiments of the present application. The program modules referred to in the embodiments of the present application are a series of computer readable instruction segments capable of completing a specific function, and the functions of the program modules in the embodiments will be described in detail below. As shown in Fig. 4, the media file switching device 400 can include a track base information acquisition module 410, a flag bit adjustment module 420, and a media file switching module 430, wherein:

[0124] The track base information acquisition module 410 is configured to acquire track base information corresponding to a multimedia file. The multimedia file corresponds to a plurality of media files of different tracks, and the track base information includes a flag bit. The flag bit is used to indicate a main track currently required to be played.

[0125] The flag bit adjustment module 420 is configured to adjust the flag bit in the track base information in response to a switching event for a played media file.

[0126] The media file switching module 430 is configured to control a media file played in an embedded player of a webpage to be switched according to the flag bit.

[0127] In an optional embodiment of the present application, the track base information acquisition module 410 includes:

[0128] An information acquisition sub-module is configured to acquire a multimedia file and parse the track base information corresponding to the multimedia file from the multimedia file.

[0129] In an optional embodiment of the present application, the device further includes:

[0130] A track base information caching module is configured to cache the track base information corresponding to the multimedia file in a preset cache area.

[0131] In an optional embodiment of the present application, the flag bit adjustment module 420 includes:

[0132] A first flag bit adjustment sub-module is configured to adjust the flag bit in the track base information cached in the preset cache area in response to a switching event for a played media file.

[0133] In an optional embodiment of the present application, the media file switching module 430 includes:

[0134] The mark bit reading submodule is configured to read the mark bit in the track base information cached in the preset cache area when the embedded player of the webpage completes playing the media file.

[0135] The media file switching submodule is configured to control switching of the media file played in the embedded player of the webpage according to the mark bit.

[0136] In an optional embodiment of the present application, the media file switching submodule comprises:

[0137] The target media file determining unit is configured to determine a target media file from the plurality of different track media files according to the mark bit.

[0138] The media file switching unit is configured to control switching of the media file played in the embedded player of the webpage to the target media file.

[0139] In an optional embodiment of the present application, the data structure of the multimedia file comprises a data area; and the apparatus further comprises:

[0140] The media file parsing module is configured to parse the plurality of different track media files corresponding to the multimedia file from the data area of the multimedia file.

[0141] In an optional embodiment of the present application, the mark bit adjusting module 420 comprises:

[0142] The track determining submodule is configured to determine a first track currently required to be played and a second track currently not required to be played in response to a switching event of the played media file; wherein the second track comprises one or more media files.

[0143] The mark bit setting submodule is configured to set the first track as a main track and the second track as a non-main track in the mark bit.

[0144] Embodiment Three

[0145] FIG. 5 schematically illustrates a hardware architecture diagram of a computer device 10000 suitable for implementing the switching method of media files according to Embodiment Three of the present application. In some embodiments, the computer device 10000 can be a terminal device such as a smartphone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workstation, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 can be a rack-mounted server, a blade server, a tower server, or a cabinet server (including a standalone server, or a server cluster composed of multiple servers), etc. As shown in FIG. 5, the computer device 10000 includes, but is not limited to, a memory 10010, a processor 10020, and a network interface 10030 which are communicatively linked via a system bus. Among them:

[0146] The memory 10010 includes at least one type of computer-readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 10000. Of course, the memory 10010 can also include both the internal storage module and the external storage device of the computer device 10000. In this embodiment, the memory 10010 is generally used to store an operating system and various application software installed on the computer device 10000, such as program codes of the switching method of media files, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0147] The processor 10020 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips in some embodiments. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication of the computer device 10000, etc. In this embodiment, the processor 10020 is used to run program codes or process data stored in the memory 10010.

[0148] The network interface 10030 can include a wireless network interface or a wired network interface, and is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 with an external terminal through a network, to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal, and the like. The network can be an Intranet, the Internet, a Global System of Mobile communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, Wi-Fi, and the like wireless or wired network.

[0149] It should be noted that FIG. 5 only shows the computer device with components 10010-10030, but it should be understood that all the shown components are not required to be implemented, and more or less components can be alternatively implemented.

[0150] In the embodiment, the switching method of the media file stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiments of the present application.

[0151] Embodiment Four

[0152] The embodiments of the present application also provide a computer readable storage medium, and the computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions are executed by a processor to implement the following steps:

[0153] Obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0154] In response to a switching event for the played media file, adjusting the mark bit in the track basic information;

[0155] According to the mark bit, controlling the switching of the media file played in the embedded player of the webpage.

[0156] In this embodiment, the computer readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the computer readable storage medium can be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Of course, the computer readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer readable storage medium is usually used to store an operating system and various application software installed on the computer device, such as program codes of the media file switching method in the embodiments, etc. In addition, the computer readable storage medium can also be used to temporarily store various data that have been output or will be output.

[0157] Embodiment five

[0158] The embodiments of the present application also provide a computer program product, comprising computer readable instructions which, when executed by a processor, implement the following steps:

[0159] obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information contains a mark bit, wherein the mark bit is used to indicate a main track currently required to be played;

[0160] in response to a switching event for the played media file, adjusting the mark bit in the track basic information;

[0161] controlling the media file played in the embedded player of the switching webpage according to the mark bit.

[0162] Obviously, those skilled in the art should understand that each module or each step of the above-mentioned embodiments of the present application can be realized by a general computer device, which can be concentrated on a single computer device or distributed on a network composed of multiple computer devices, and optionally, each module or each step can be realized by computer device executable program code, so that each module or each step can be stored in a storage device and executed by a computer device, and in some cases, the steps shown or described can be executed in different order, or each module or each step can be manufactured into an individual integrated circuit module, or multiple modules or steps can be manufactured into a single integrated circuit module. Therefore, the embodiments of the present application are not limited to any specific hardware and software combination.

[0163] It should be noted that the above is only the preferred embodiment of the present application, and does not limit the patent protection scope of the present application, and any equivalent structure or equivalent process transformation using the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A switching method of a media file, the method comprising: obtaining track base information corresponding to a multimedia file; the multimedia file corresponding to a plurality of media files of different tracks, the track base information containing a mark bit, wherein the mark bit is used to indicate a main track currently required to be played; in response to a switching event of a played media file, adjusting the mark bit in the track base information; controlling a media file played in an embedded player of a switching webpage according to the mark bit. 2.The switching method of a media file according to claim 1, wherein the obtaining track base information corresponding to a multimedia file comprises: obtaining a multimedia file and parsing the track base information corresponding to the multimedia file from the multimedia file. 3.The switching method of a media file according to claim 1 or 2, wherein after the step of obtaining track base information corresponding to a multimedia file, the method further comprises: caching the track base information corresponding to the multimedia file in a preset cache area; the adjusting the mark bit in the track base information in response to a switching event of a played media file comprises: in response to a switching event of a played media file, adjusting the mark bit in the track base information cached in the preset cache area. 4.The switching method of a media file according to claim 3, wherein the controlling a media file played in an embedded player of a switching webpage according to the mark bit comprises: in the case that the embedded player of the webpage completes a media file being played, reading the mark bit in the track base information cached in the preset cache area; controlling a media file played in an embedded player of a switching webpage according to the mark bit. 5.The switching method of a media file according to claim 1, wherein the controlling a media file played in an embedded player of a switching webpage according to the mark bit comprises: determining a target media file from the plurality of media files of different tracks according to the mark bit; controlling a media file played in an embedded player of a switching webpage to be switched to the target media file. 6.The switching method of a media file according to claim 1, wherein the data structure of the multimedia file contains a data area; before the step of determining a target media file from the plurality of media files of different tracks according to the mark bit, the method further comprises: parsing the plurality of media files of different tracks corresponding to the multimedia file from the data area of the multimedia file. 7.The switching method of a media file according to claim 1, wherein the adjusting the mark bit in the track base information in response to a switching event of a played media file comprises: in response to a switching event of a played media file, determining a first track currently required to be played and a second track currently not required to be played; wherein the second track contains one or more media files; setting the first track as a main track and the second track as a non-main track in the mark bit. 8.A switching device of a media file, the device comprising: The track basic information acquisition module is configured to acquire track basic information corresponding to the multimedia file. The multimedia file corresponds to a plurality of media files of different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate a main track currently required to be played. The mark bit adjustment module is configured to adjust the mark bit in the track basic information in response to a switching event for the played media file. The media file switching module is configured to control switching of the media file played in the embedded player of the webpage according to the mark bit.

9. The media file switching apparatus according to claim 8, wherein the track basic information acquisition module comprises: The information acquisition sub-module is configured to acquire the multimedia file, and parse the track basic information corresponding to the multimedia file from the multimedia file. In an optional embodiment of the present application, the apparatus further comprises: The track basic information cache module is configured to cache the track basic information corresponding to the multimedia file in a preset cache area.

10. The media file switching apparatus according to claim 8 or 9, wherein the mark bit adjustment module 420 comprises: The first mark bit adjustment sub-module is configured to adjust the mark bit in the track basic information cached in the preset cache area in response to the switching event for the played media file. In an optional embodiment of the present application, the media file switching module 430 comprises: The mark bit reading sub-module is configured to read the mark bit in the track basic information cached in the preset cache area in the case that the embedded player of the webpage completes playing of the media file. The media file switching sub-module is configured to control switching of the media file played in the embedded player of the webpage according to the mark bit.

11. The media file switching apparatus according to claim 10, wherein the media file switching sub-module comprises: The target media file determination unit is configured to determine a target media file from the plurality of media files of different tracks according to the mark bit. The media file switching unit is configured to control switching of the media file played in the embedded player of the webpage to the target media file.

12. The media file switching apparatus according to claim 8, wherein the data structure of the multimedia file includes a data area, and the apparatus further comprises: The media file parsing module is configured to parse the plurality of media files of different tracks corresponding to the multimedia file from the data area of the multimedia file.

13. The media file switching apparatus according to claim 8, wherein the mark bit adjustment module 420 comprises: The track determination sub-module is configured to determine a first track currently required to be played and a second track currently not required to be played in response to the switching event for the played media file, wherein the second track includes one or more media files. The mark bit setting sub-module is configured to set the first track as a main track and the second track as a non-main track in the mark bit.

14. A computer device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein: The memory stores computer readable instructions executable by the at least one processor, and the computer readable instructions are executed by the at least one processor to enable the at least one processor to perform the following steps: Obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information contains a mark bit, wherein the mark bit is used to indicate a main track currently required to be played; In response to a switching event for a played media file, adjusting the mark bit in the track basic information; According to the mark bit, controlling switching of a media file played in an embedded player of a webpage.

15. The computer device of claim 14, wherein the obtaining track basic information corresponding to a multimedia file comprises: Obtaining a multimedia file and parsing the track basic information corresponding to the multimedia file from the multimedia file.

16. The computer device of claim 14 or 15, wherein after the step of obtaining track basic information corresponding to a multimedia file, the method further comprises: Caching the track basic information corresponding to the multimedia file in a preset cache area; The step of adjusting the mark bit in the track basic information in response to a switching event for a played media file comprises: In response to a switching event for a played media file, adjusting the mark bit in the track basic information cached in the preset cache area.

17. The computer device of claim 16, wherein the step of controlling switching of a media file played in an embedded player of a webpage according to the mark bit comprises: In a case where the embedded player of the webpage completes a media file being played, reading the mark bit in the track basic information cached in the preset cache area; Controlling switching of a media file played in the embedded player of the webpage according to the mark bit.

18. The computer device of claim 14, wherein the step of controlling switching of a media file played in an embedded player of a webpage according to the mark bit comprises: According to the mark bit, determining a target media file from the plurality of media files of different tracks; Controlling switching of a media file played in the embedded player of the webpage to the target media file.

19. The computer device of claim 14, wherein a data structure of the multimedia file contains a data area; and before the step of determining a target media file from the plurality of media files of different tracks according to the mark bit, the method further comprises: Parsing the plurality of media files of different tracks corresponding to the multimedia file from the data area of the multimedia file.

20. The computer device of claim 14, wherein the step of adjusting the mark bit in the track basic information in response to a switching event for a played media file comprises: In response to a switching event for a played media file, determining a first track currently required to be played and a second track currently not required to be played; wherein the second track contains one or more media files; In the mark bit, setting the first track as a main track and setting the second track as a non-main track.

21. A computer readable storage medium, having computer readable instructions stored therein, which when executed by a processor implement the following steps: Obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a mark bit, wherein, the mark bit is used to indicate the main track that needs to be played currently; adjusting the mark bit in the track base information in response to a switching event for the played media file; controlling the media file played in the embedded player of the switching webpage according to the mark bit.

22. The computer readable storage medium of claim 21, wherein the obtaining the track base information corresponding to the multimedia file comprises: obtaining the multimedia file and parsing the track base information corresponding to the multimedia file from the multimedia file.

23. The computer readable storage medium of claim 21 or 22, wherein after the step of obtaining the track base information corresponding to the multimedia file, the method further comprises: caching the track base information corresponding to the multimedia file in a preset cache area; the adjusting the mark bit in the track base information in response to a switching event for the played media file comprises: adjusting the mark bit in the track base information cached in the preset cache area in response to a switching event for the played media file.

24. The computer readable storage medium of claim 23, wherein the controlling the media file played in the embedded player of the switching webpage according to the mark bit comprises: reading the mark bit in the track base information cached in the preset cache area in the case that the embedded player of the webpage completes the playing of the media file; controlling the media file played in the embedded player of the switching webpage according to the mark bit.

25. The computer readable storage medium of claim 21, wherein the controlling the media file played in the embedded player of the switching webpage according to the mark bit comprises: determining a target media file from the media files of the plurality of different tracks according to the mark bit; controlling the switching of the media file played in the embedded player of the webpage to the target media file.

26. The computer readable storage medium of claim 1, wherein the data structure of the multimedia file comprises a data area; and wherein, before the step of determining the target media file from the media files of the plurality of different tracks according to the mark bit, the method further comprises: parsing the media files of the plurality of different tracks corresponding to the multimedia file from the data area of the multimedia file.

27. The computer readable storage medium of claim 21, wherein the adjusting the mark bit in the track base information in response to a switching event for the played media file comprises: determining a first track that needs to be played currently and a second track that does not need to be played currently in response to a switching event for the played media file; wherein the second track comprises one or more media files; setting the first track as the main track and setting the second track as the non-main track in the mark bit.

28. A computer program product, comprising computer readable instructions, which when executed by a processor implement the following steps: Obtaining track basic information corresponding to a multimedia file; the multimedia file corresponds to media files of multiple different tracks, and the track basic information contains a mark bit, wherein, The mark bit is used to indicate the main track which is currently needed to be played; adjusting the mark bit in the track base information in response to a switching event for the played media file; controlling the media file played in the embedded player of the switching webpage according to the mark bit.

29. The computer program product of claim 28, wherein the track base information corresponding to the multimedia file is obtained by: obtaining the multimedia file and parsing the track base information corresponding to the multimedia file from the multimedia file.

30. The computer program product of claim 28 or 29, wherein after the step of obtaining the track base information corresponding to the multimedia file, the method further comprises: caching the track base information corresponding to the multimedia file in a preset cache area; adjusting the mark bit in the track base information in response to a switching event for the played media file.

31. The computer program product of claim 20, wherein the controlling the media file played in the embedded player of the switching webpage according to the mark bit comprises: reading the mark bit in the track base information cached in the preset cache area when the embedded player of the webpage finishes playing the media file; controlling the media file played in the embedded player of the switching webpage according to the mark bit.

32. The computer program product of claim 28, wherein the controlling the media file played in the embedded player of the switching webpage according to the mark bit comprises: determining a target media file from the plurality of different tracks according to the mark bit; controlling the media file played in the embedded player of the webpage to be switched to the target media file.

33. The computer program product of claim 28, wherein the data structure of the multimedia file comprises a data area, and before the step of determining the target media file from the plurality of different tracks according to the mark bit, the method further comprises: parsing the plurality of different tracks corresponding to the multimedia file from the data area of the multimedia file.

34. The computer program product of claim 28, wherein the adjusting the mark bit in the track base information in response to a switching event for the played media file comprises: determining a first track which is currently needed to be played and a second track which is currently not needed to be played in response to a switching event for the played media file; wherein the second track comprises one or more media files; setting the first track as the main track and the second track as the non-main track in the mark bit. ​

Citation Information

Patent Citations

  • Method and system for switching and playing video

    CN102739627A

  • Method and device for switching stream media audios

    CN105791971A

  • Video switching method, device and system

    CN106961624A

  • Audio track switching method and device, computing equipment and storage medium

    CN116528018A

  • Media file switching method and device

    CN118890524A