CN118175357A - Live broadcast method, device, equipment and storage medium based on media play list - Google Patents

Live broadcast method, device, equipment and storage medium based on media play list Download PDF

Info

Publication number
CN118175357A
CN118175357A CN202211581231.7A CN202211581231A CN118175357A CN 118175357 A CN118175357 A CN 118175357A CN 202211581231 A CN202211581231 A CN 202211581231A CN 118175357 A CN118175357 A CN 118175357A
Authority
CN
China
Prior art keywords
client
server
media
play list
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211581231.7A
Other languages
Chinese (zh)
Inventor
张鹏
李剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202211581231.7A priority Critical patent/CN118175357A/en
Publication of CN118175357A publication Critical patent/CN118175357A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a live broadcast method, a device, equipment and a storage medium based on a media play list, and the related embodiment can be applied to various scenes such as cloud technology and the like, and is used for reducing request frequency and connection number and reducing load. The method comprises the following steps: when the server receives a media play list request of the client, a long connection between the server and the client is established, the server analyzes the media play list request, a media play list is generated, the media play list is sent to the client based on the long connection between the server and the client, incremental data in the updated media play list is acquired when the server detects that the media play list is updated in data, the incremental data is sent to the client based on the long connection between the server and the client, and the incremental data is combined to the media play list to obtain a current media update play list to live broadcast based on the current media update play list when the client acquires the incremental data.

Description

Live broadcast method, device, equipment and storage medium based on media play list
Technical Field
The embodiment of the application relates to the technical field of multimedia processing, in particular to a live broadcast method, device, equipment and storage medium based on a media play list.
Background
With the development of the internet and mobile communication technology, the demands of cross-network transmission of the streaming media, multi-terminal plug-in-free playing and the like are also more and more important. HLS (HTTP LIVE STREAMING, apple's dynamic code stream adaptive technology) is increasingly applied to streaming media playing services of various terminals.
In live broadcasting based on HLS, the client needs to continuously pull the media play list in live broadcasting HLS, and the client needs to send an HLS request to the server once every time the client pulls, so that when the media play list in the server has new media information update, the server can send the whole media play list with the new media information updated currently to the client based on the HLS request, so that the client pulls the latest media play list to update the latest media url and other information.
However, every time the client pulls a media playlist, it needs to send an HLS request to the server, and the client can acquire updated media information, which is a significant load increase for the request frequency of the client and the number of connections initiated between the client and the server, and when the client pulls a media playlist, there may be a repetition of the pulled latest media playlist in the existing playlist on the client, that is, redundancy data is repeated, which is a significant cost increase for the client and the server traffic.
Disclosure of Invention
The embodiment of the application provides a live broadcast method, a device, equipment and a storage medium based on a media play list, which are used for acquiring an updated media play list by only transmitting incremental data in the updated media play list to a client in a mode of establishing long connection between the server and the client, so that the request frequency and the number of connections initiated between the client and the server can be reduced, the load is reduced, the client can only merge the incremental data into the media play list to acquire the current media update play list, the media play list does not have data repetition, and data redundancy is not caused, thereby reducing the cost of the client and the server flow.
In one aspect, an embodiment of the present application provides a live broadcast method based on a media playlist, including:
When a server receives a media play list request of a client, the server acquires a request identification of the media play list request;
If the request identifier accords with the target request identifier, the server establishes long connection between the server and the client based on the target request identifier;
The server analyzes the media play list request to generate a media play list;
based on the long connection between the server and the client, the server sends the media play list to the client so that the client can live broadcast based on the media play list;
When the server detects that the media play list is updated with data, incremental data in the updated media play list is acquired;
Based on the long connection between the server and the client, the server sends incremental data to the client;
When the client acquires the incremental data, the incremental data is combined to the media play list to obtain the current media update play list, so that the client can live broadcast based on the current media update play list.
Another aspect of the present application provides a media playlist-based live broadcast apparatus, including:
The acquisition unit is used for acquiring a request identifier of the media play list request when the server receives the media play list request of the client;
the processing unit is used for establishing long connection between the server and the client based on the target request identifier if the request identifier accords with the target request identifier;
the processing unit is also used for analyzing the media play list request by the server to generate a media play list;
a transmitting unit, configured to transmit a media playlist to a client based on a long connection between the server and the client, so that the client performs live broadcast based on the media playlist;
the acquisition unit is also used for acquiring incremental data in the updated media play list when the server detects that the media play list is updated with data;
the sending unit is also used for sending the incremental data to the client based on the long connection between the server and the client;
And the processing unit is also used for merging the incremental data into the media play list when the client acquires the incremental data to obtain the current media update play list so that the client can live broadcast based on the current media update play list.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
When the request identifier is a block transmission code identifier, establishing a block transmission code long connection between the server and the client based on the block transmission code identifier;
the transmitting unit may specifically be configured to: transmitting the coded long connection based on the blocks between the server and the client, and transmitting the media play list to the client by the server;
The transmitting unit may specifically be configured to: the server sends delta data to the client based on the chunked transport encoded long connection between the server and the client.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
The server reads the initial index file content corresponding to the live broadcast according to the index file identification and the media information of the video and audio;
The server generates a media play list based on the initial index file content, wherein the media play list comprises at least one initial video stream slicing sequence number, an initial video stream slicing time length corresponding to the initial video stream slicing sequence number and an initial video stream slicing address.
In one possible design, in one implementation of another aspect of the embodiments of the present application,
The acquisition unit is also used for acquiring an initial request identifier of the initial transmission request when the client receives the initial transmission request of the media play list transmitted by the server;
The acquisition unit is further used for maintaining the block transmission coding long connection between the server and the client if the initial request identifier is the block transmission coding identifier, and receiving a media play list sent by the server based on the block transmission coding long connection;
The processing unit is further used for the client to acquire the initial video stream fragments based on the initial video stream fragment addresses and live broadcast the video stream fragments based on the initial video stream fragment serial numbers and the initial video stream fragment time lengths.
In one possible design, in one implementation of another aspect of the embodiments of the present application,
And the processing unit is also used for disconnecting the block transmission coding long connection between the server and the client if the initial request identification is not the block transmission coding identification.
In one possible design, in one implementation of another aspect of the embodiments of the present application,
The processing unit is also used for periodically reading index file contents corresponding to live broadcast by the server and generating a media play list corresponding to each period based on the read index file contents;
The acquisition unit may specifically be configured to: and comparing the media play list corresponding to the current period with the media play list corresponding to the previous period, and if the media play list is subjected to data updating, acquiring the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address in the current period.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
When the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the list tail of the media play list according to the sequence of the sequence numbers so as to acquire the current media updated play list.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
when the client acquires the incremental data, determining the position of the initial video stream fragment sequence number corresponding to the maximum sequence number value according to the sequence of the sequence numbers;
And adding the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address after the initial video stream slicing sequence number, the initial video stream slicing time length and the initial video stream slicing address corresponding to the maximum sequence number value so as to acquire the current media updated playlist.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
when the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the tail part of the media play list according to the sequence of the sequence numbers, and adding an end mark at the tail part of the merged media play list to acquire the current media updated play list;
And the client updates the play list based on the current media to carry out live broadcast, and when the live broadcast is executed to the end mark, the live broadcast is ended, and the long connection between the server and the client is disconnected.
In one possible design, in one implementation of another aspect of the embodiments of the present application,
The processing unit is also used for disconnecting the long connection between the server and the client when the client closes live broadcast;
the acquisition unit is further used for acquiring a new request identifier of the new request of the media play list if the server receives the new request of the media play list of the client again;
the processing unit is further used for reestablishing long connection between the server and the client based on the target request identifier if the new request identifier meets the target request identifier;
The processing unit is also used for analyzing the new request of the media play list by the server to generate a new media play list;
and the sending unit is also used for sending the new media play list to the client by the server based on the long connection between the server and the client so that the client can live broadcast again based on the new media play list.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
When the request identifier is a full duplex communication identifier, establishing a two-way communication long connection between the server and the client through a handshake mechanism;
The transmitting unit may specifically be configured to: based on the two-way communication long connection between the server and the client, the server sends the media play list to the client;
The transmitting unit may specifically be configured to: based on the bi-directional communication long connection between the server and the client, the server sends incremental data to the client.
In one possible design, in one implementation of another aspect of the embodiments of the present application, the processing unit may specifically be configured to:
when the request mark is a cache push mark, if the server responds to the media play list request, establishing message push long connection between the server and the client;
The transmitting unit may specifically be configured to: based on the message push long connection between the server and the client, the server sends the media play list to the client;
the transmitting unit may specifically be configured to: based on the message push long connection between the server and the client, the server sends the incremental data to the client.
Another aspect of the present application provides a computer device comprising: a memory, a processor, and a bus system;
Wherein the memory is used for storing programs;
the processor is used for executing the program in the memory to realize the method of the aspects;
The bus system is used to connect the memory and the processor to communicate the memory and the processor.
Another aspect of the application provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the methods of the above aspects.
From the above technical solution, the embodiment of the present application has the following beneficial effects:
When the server receives a media play list request of the client, if the request identification of the media play list request acquired by the server accords with the target request identification, a long connection between the server and the client can be established based on the target request identification, the server can analyze the media play list request to generate a media play list, and based on the long connection between the server and the client, the media play list is sent to the client so that the client can live broadcast based on the media play list, then when the server detects that the media play list is updated, incremental data in the updated media play list can be acquired, based on the long connection between the server and the client, the incremental data is sent to the client, so that the client can acquire the incremental data, and the incremental data is combined to the media play list so as to acquire a current media update play list, and live broadcast based on the current media update play list. By the method, the device and the system, through the method of establishing the long connection between the server and the client, when the client performs media play list pulling or the server detects that the media play list is updated, incremental data in the updated media play list is only required to be sent to the client, a request is not required to be sent to the server once every time the media play list is pulled, so that the updated media play list is obtained, the request frequency and the number of connections initiated between the client and the server can be reduced, the load is reduced, the client can only merge the incremental data into the media play list to obtain the current media update play list, the media play list does not have repetition on the data, and data redundancy is not caused, so that the cost of the client and the server flow is reduced.
Drawings
FIG. 1 is a schematic diagram of a media data control system according to an embodiment of the present application;
FIG. 2 is a flow chart of one embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 3 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 4 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 5 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 6 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 7 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 8 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 9 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 10 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 11 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 12 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 13 is a flow chart of another embodiment of a media playlist based live method in an embodiment of the present application;
FIG. 14 is a schematic flow diagram of a media playlist based live method in accordance with an embodiment of the present application;
FIG. 15 is a schematic diagram of a server acquiring a media playlist according to a live method of media playlist according to an embodiment of the present application;
FIG. 16 is a schematic diagram of a client capturing a media playlist according to a live method based on the media playlist in an embodiment of the present application;
FIG. 17 is a schematic diagram of a server updating a media playlist based live method of a media playlist in an embodiment of the present application;
FIG. 18 is a schematic diagram of a client updating a media playlist based live method in accordance with an embodiment of the present application;
FIG. 19 is a schematic diagram of one embodiment of a media playlist based live device in an embodiment of the present application;
FIG. 20 is a schematic diagram of one embodiment of a computer device in an embodiment of the application.
Detailed Description
The embodiment of the application provides a live broadcast method, a device, equipment and a storage medium based on a media play list, which are used for acquiring an updated media play list by only transmitting incremental data in the updated media play list to a client in a mode of establishing long connection between the server and the client, so that the request frequency and the number of connections initiated between the client and the server can be reduced, the load is reduced, the client can only merge the incremental data into the media play list to acquire the current media update play list, the media play list does not have data repetition, and data redundancy is not caused, thereby reducing the cost of the client and the server flow.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "includes" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For ease of understanding, some terms or concepts related to embodiments of the present application are explained first.
1. HTTP: the hypertext transfer protocol (HTTP) is an application layer protocol for transferring hypermedia documents (e.g., HTML). It is designed for communication between a Web browser and a Web server, but may be used for other purposes as well. HTTP follows the classical client-server model, and the client opens a connection to make a request and then waits until a server-side response is received.
2. HLS: HLS (HTTP Live Streaming) is an Apple's dynamic code rate adaptation technique. The method is mainly used for audio and video services of the PC and Apple terminals. Comprises an index file of m3u (8), a TS media fragment file and a key encryption string file.
3. M3u8: HLS contains playlists (index files) that are categorized into a master playlist MASTER PLAYLIST, a multivariable playlist Multivariant Playlist, and a media playlist MEDIA PLAYLIST.
4. MASTER PLAYLIST: the main playlist MASTER PLAYLIST does not contain slice-related information therein, but describes different encoding formats of the same source, referred to as variable in HLS. MASTER PLAYLIST describes various information about the variable such as download bandwidth, audio video coding information, video resolution, etc.
5. Multivariant Playlist: analogy to original MASTER PLAYLIST is the corresponding alternative name in hls.2.0 draft;
6. MEDIA PLAYLIST: a media playlist contains a list of media segments that the player plays sequentially.
7. Chunk: block transport coding (Chunked transfer encoding), a data transport mechanism in the hypertext transfer protocol (HTTP), allows data sent by an application server to a client application (typically a web browser) to be divided into multiple parts.
It will be appreciated that in the specific embodiments of the present application, related data such as media play lists are involved, and that when the above embodiments of the present application are applied to specific products or technologies, user permissions or consents need to be obtained, and the collection, use and processing of related data need to comply with the relevant laws and regulations and standards of the relevant countries and regions.
It is to be appreciated that the media playlist based live approach as disclosed herein, particularly relates to Cloud technology (Cloud technology), which is further described below. Cloud technology refers to a hosting technology for unifying serial resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data. The cloud technology is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied by the cloud computing business mode, can form a resource pool, and is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud computing (clouding) is a computing model that distributes computing tasks over a resource pool of large numbers of computers, enabling various application systems to acquire computing power, storage space, and information services as needed. The network that provides the resources is referred to as the "cloud". Resources in the cloud are infinitely expandable in the sense of users, and can be acquired at any time, used as needed, expanded at any time and paid for use as needed.
As a basic capability provider of cloud computing, a cloud computing resource pool (abbreviated as a cloud platform, generally referred to as IaaS (Infrastructure AS A SERVICE) platform) is established, in which multiple types of virtual resources are deployed for external clients to select for use.
According to the logic function division, a PaaS (Platform AS A SERVICE, platform service) layer can be deployed on an IaaS (Infrastructure AS A SERVICE, infrastructure service) layer, and a SaaS (Software AS A SERVICE, service) layer can be deployed above the PaaS layer, or the SaaS can be directly deployed on the IaaS. PaaS is a platform on which software runs, such as a database, web container, etc. SaaS is a wide variety of transactional software such as web portals, text message mass senders, etc. Generally, saaS and PaaS are upper layers relative to IaaS.
Next, cloud Security (Cloud Security) refers to a generic term for Security software, hardware, users, institutions, and Security Cloud platforms based on Cloud computing business model applications. Cloud security fuses emerging technologies and concepts such as parallel processing, grid computing, unknown virus behavior judgment and the like, acquires the latest information of Trojan horse and malicious programs in the Internet through abnormal monitoring of a large number of network clients on software behaviors, sends the latest information to a server for automatic analysis and processing, and distributes solutions of viruses and Trojan horse to each client.
Secondly, cloud storage (cloud storage) is a new concept which extends and develops in the concept of cloud computing, and a distributed cloud storage system (hereinafter referred to as a storage system for short) refers to a storage system which provides data storage and transaction access functions together and cooperatively works a large number of storage devices (storage devices are also called storage nodes) of different types in a network through application software or application interfaces through functions of cluster application, grid technology, a distributed storage file system and the like.
At present, the storage method of the storage system is as follows: when creating logical volumes, each logical volume is allocated a physical storage space, which may be a disk composition of a certain storage device or of several storage devices. The client stores data on a certain logical volume, that is, the data is stored on a file system, the file system divides the data into a plurality of parts, each part is an object, the object not only contains the data but also contains additional information such as a data Identification (ID) and the like, the file system writes each object into a physical storage space of the logical volume, and the file system records storage position information of each object, so that when the client requests to access the data, the file system can enable the client to access the data according to the storage position information of each object.
The process of allocating physical storage space for the logical volume by the storage system specifically includes: physical storage space is divided into stripes in advance according to the set of capacity measures for objects stored on a logical volume (which measures tend to have a large margin with respect to the capacity of the object actually to be stored) and redundant array of independent disks (RAID, redundant Array of INDEPENDENT DISK), and a logical volume can be understood as a stripe, whereby physical storage space is allocated for the logical volume.
It should be understood that the live broadcast method based on the media play list provided by the application can be applied to various scenes, including but not limited to cloud technology, artificial intelligence, maps, intelligent traffic and the like, and is used for updating the media play list of the client to carry out live broadcast or audio/video play by establishing a long connection between a server and the client and transmitting the increment of the media play list to the client so as to be applied to the scenes such as HLS live broadcast, audio/video play and the like.
In order to solve the above-mentioned problems, the present application proposes a live broadcast method based on a media playlist, which is applied to an image data control system shown in fig. 1, referring to fig. 1, fig. 1 is a schematic diagram of an architecture of an image data control system in an embodiment of the present application, as shown in fig. 1, when a server receives a media playlist request of a terminal device, that is, a client, if a request identifier of the media playlist request acquired by the server meets a target request identifier, a long connection between the server and the client may be established based on the target request identifier, and further, the server may parse the media playlist request, generate a media playlist, and send the media playlist to the client based on the long connection between the server and the client, so that the client can live broadcast the media playlist based on the media playlist, and then, when the server detects that the media playlist is updated, incremental data in the updated media playlist may be acquired based on the long connection between the server and the client, the incremental data may be sent to the client, so that the client may acquire the incremental data, and combine the data to the media and update the current media playlist based on the current incremental media. By the method, the device and the system, through the method of establishing the long connection between the server and the client, when the client performs media play list pulling or the server detects that the media play list is updated, incremental data in the updated media play list is only required to be sent to the client, a request is not required to be sent to the server once every time the media play list is pulled, so that the updated media play list is obtained, the request frequency and the number of connections initiated between the client and the server can be reduced, the load is reduced, the client can only merge the incremental data into the media play list to obtain the current media update play list, the media play list does not have repetition on the data, and data redundancy is not caused, so that the cost of the client and the server flow is reduced.
It should be understood that only one terminal device is shown in fig. 1, and in an actual scenario, a greater variety of terminal devices may participate in the data processing process, where the terminal devices include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, intelligent home appliances, vehicle terminals, etc., and the specific number and variety are determined by the actual scenario, and the specific number and variety are not limited herein. In addition, one server is shown in fig. 1, but in an actual scenario, there may also be a plurality of servers involved, especially in a scenario of multi-model training interaction, the number of servers depends on the actual scenario, and the present application is not limited thereto.
It should be noted that in this embodiment, the server may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content distribution network (content delivery network, CDN), and basic cloud computing services such as big data and an artificial intelligence platform. The terminal device and the server may be directly or indirectly connected through wired or wireless communication, and the terminal device and the server may be connected to form a blockchain network, which is not limited herein.
With reference to the foregoing description, a live broadcast method based on a media playlist in the present application will be described below with reference to fig. 2, where one embodiment of the live broadcast method based on a media playlist in an embodiment of the present application includes:
in step S101, when the server receives a media playlist request from the client, the server obtains a request identifier of the media playlist request;
In this embodiment, when the target object wants to watch live broadcast or on demand, the target object may send a media playlist request to the server through the client to pull the media playlist to the server, and further, when the server receives the media playlist request from the client, the server may obtain a request identifier of the media playlist request, so that a subsequent server may load the media playlist based on the request identifier and issue the media playlist to the client, so that the client may subsequently live broadcast based on the pulled media playlist.
Wherein the playlist includes a plurality of main playlist MASTER PLAYLIST, a multivariable playlist Multivariant Playlist, a media playlist MEDIA PLAYLIST, and the like, when the video requested by the target object is live, the contents of the main playlist and the multivariable playlist are usually fixed, which can be understood that after the target object requests once, the two lists are usually not changed in the live process, and the media playlist is usually updated periodically, which can be understood that the update frequency is related to the generation speed of new media files in the media playlist. A media playlist contains a list of media segments for sequential play by the player. The request Identification (ID) is used to indicate a request type of the media playlist request, and may be embodied as a number string of integer (int) or a character string.
Specifically, when the target object wants to watch live broadcast or on demand, the target object can send live broadcast watching operation through an operation interface of a live broadcast tool such as a player or a browser on the client, so that the client can send a media play list request to the server, and further, when the server receives the media play list request of the client, the server can acquire a request identification of the media play list request, so that a subsequent server can load the media play list based on the request identification and send the media play list to the client, and the client can receive the media play list for live broadcast.
In step S102, if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier;
In this embodiment, if the obtained request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, so that the media playlist may be issued to the client based on the long connection between the server and the client.
The long connection between the server and the client is used to indicate a stable persistent connection between the server and the client, and may be generally represented by a block transmission code (Chunked transfer encoding), a socket code, or other forms, which are not particularly limited herein.
Specifically, after the request identifier is obtained, if the request identifier meets the target request identifier, a communication connection between the client and the server can be established through a handshake mechanism based on a TCP/IP protocol, then, on the basis of the TCP/IP protocol communication connection, a long connection between the client and the server can be established through a block transmission code (Chunked transfer encoding) or a socket code or other modes according to a hypertext transfer protocol (HTTP), and a long connection can also be established in other modes, which is not particularly limited herein.
In step S103, the server parses the media playlist request to generate a media playlist;
in this embodiment, in the live broadcast process based on HLS, the client needs to live broadcast based on the media playlist in the live broadcast HLS, so after the server receives the media playlist request, the server may parse the media playlist request to generate the media playlist, so that the media playlist may be issued to the client for live broadcast.
In the process of live streaming media by using HLS, the HLS protocol generally includes an HTTP protocol, an M3U8 file, and TS media information, where HTTP is a transport protocol, M3U8 is an index file, and TS is media information of video and audio. The M3U8 file is a playlist (playlist), which may be a media playlist (MEDIA PLAYLIST) or a master list (MASTER PLAYLIST), but whichever playlist is used, its internal text uses utf-8 encoding, and when the M3U8 file is used as the media playlist (MEIDA PLAYLIST), its internal information records a series of media clip resources, and the clip resources are sequentially played, so that the multimedia resources can be completely displayed. The media segment resource refers to a slicing file obtained after the server slices the acquired media data stream according to the TS format.
Specifically, it can be understood that when there is a media data stream that needs to be or is being live broadcast, the server can index the media data stream that needs to be or is being live broadcast, and perform TS slicing on the obtained media data stream, and then encapsulate the TS slicing by using an M3U8 file storage format.
Further, when the client, i.e. the player, is to play the data stream, the client first needs to acquire the media playlist, then acquire and play each media file, i.e. the TS slice, in the media playlist, so in order to acquire the media playlist, the client first sends a media playlist request to the server, so that after the server receives the media playlist request, the server can parse the media playlist request, i.e. the server reads the corresponding M3U8 file content according to the index file carried in the media playlist request, and then can generate the corresponding media playlist based on the read M3U8 file content.
For example, live M3U8 files, i.e., generated media playlist data, are exemplified as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2680
#EXTINF:7.975,
https://priv.example.com/fileSequence2680.ts
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
wherein "#EXT-X-VERSION:3" is used to indicate the number of TS slices in the M3U8 file, "TARGETDURATION" is used to indicate the duration of the largest TS slice in the media playlist in seconds, and the accuracy is an integer, i.e., "#EXT-X-TARGETDURATION:8" is used to indicate the duration of the largest TS slice as 8s.
Wherein, "#EXT-X-MEDIA-SEQUENCE" indicates the serial number of the TS slice currently playing, e.g., "#EXT-X-MEDIA-SEQUENCE:2680" is the serial number 2680 of the TS slice currently playing. It will be appreciated that the file name of a TS fragment may be irrelevant to the sequence number, and for live broadcast, in general, the player will correspond the first TS fragment file obtained for the first time in the M3U8 file to the sequence number in the first TS fragment file, and then analogize the same, and the sequence number is incremented by 1, which is considered to be pointing to the next TS fragment file.
Where "EXTINF" indicates the length of time in seconds of the corresponding TS slice, in the example 2680.TS has a duration of 7.975 seconds. It can be understood that extnf also affects the interval at which the player refreshes the M3U8 file, and under normal conditions, the player will take the value of extnf of the currently downloaded TS slice as the interval at which the M3U8 file is refreshed each time; if the player finds that the content of the M3U8 file acquired at this time is not updated, the player can refresh the content again within 1-2 seconds.
For example, "https:// priv. Sample. Com/filesequence2680.TS" is used to indicate the media fragment resource path, i.e., URL, of the corresponding TS slice, e.g., 2680.TS, so as to facilitate loading and playing of the TS slice according to the media fragment resource path of the TS slice.
In step S104, based on the long connection between the server and the client, the server transmits the media playlist to the client, so that the client performs live broadcast based on the media playlist;
In this embodiment, after the server acquires the media playlist, the server may send the media playlist to the client based on the long connection between the server and the client, so that the client performs live broadcasting based on the media playlist.
Specifically, when the server acquires the media playlist, that is, acquires the initial media playlist, the server may perform data transmission based on a long connection between the server and the client, so as to safely and stably transmit the media playlist to the client, so that a subsequent client may parse and play the acquired media playlist.
In step S105, when the server detects that the media playlist is updated with data, incremental data in the updated media playlist is acquired;
In this embodiment, when the server detects that the data update occurs in the media playlist, the updated tag and the TS clip file, that is, the incremental data, in the updated media playlist may be acquired, so that the subsequent server may directly issue the incremental data to the client through the long connection, so that the client does not need to send a request to the server to acquire the updated media playlist every time the data is updated, which avoids an increase in the number of requests and connections, and acquires the data redundancy of the updated media playlist.
Specifically, it can be understood that when HLS is used for streaming live broadcast, in the M3U8 index file, the description of three TS slices in the above example is generally stored, and the server continuously slices the media data stream, so the content in the M3U8 index file will be changed, but only one slice is updated at a time, that is, based on the above example, when a new TS slice is generated, the content of the M3U8 file changes as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2681
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2683.ts
The updated data is a label corresponding to "2683.TS" and a TS fragment file, that is, the updated data is incremental data obtained by the server.
In step S106, the server transmits the incremental data to the client based on the long connection between the server and the client;
In this embodiment, after the server obtains the incremental data, the server may send the incremental data to the client based on the long connection between the server and the client, so that the client does not need to send a request to the server to obtain the updated media playlist each time the data is updated, avoiding an increase in the number of requests and connections, and obtaining data redundancy of the updated media playlist.
Specifically, since a stable and safe long connection between the server and the client is established, when the server detects that the media play list is updated with data, incremental data in the updated media play list can be acquired, and based on the long connection between the server and the client, the server sends the incremental data to the client without sending the whole updated media play list to the client, so that the situation that the client repeatedly acquires the same data of the media play list, and data redundancy is caused is avoided.
In step S107, when the client acquires the incremental data, the incremental data is merged into the media playlist to obtain the current media update playlist, so that the client performs live broadcast based on the current media update playlist.
In this embodiment, when the client obtains incremental data based on the long connection between the server and the client, the incremental data may be incorporated into the media playlist to update the media playlist, so as to obtain an updated media update playlist, so that the client performs live broadcast based on the current media update playlist.
Specifically, when the client obtains incremental data based on the long connection between the server and the client, the incremental data can be combined with the original existing media play list on the client, namely the incremental data can be added into the media play list according to the TS slice serial number to update the media play list, so that the updated media update play list is obtained, and the client can download and play the TS slices according to the playing serial number of the media file in turn based on the TS slice serial number in the current media update play list.
In the embodiment of the application, a live broadcast method based on a media play list is provided, by the method, through a long connection mode between a server and a client side, when the client side performs media play list pulling or the server detects that the media play list is subjected to data updating, incremental data in the updated media play list is only required to be sent to the client side, a request is not required to be sent to the server once every time the media play list is pulled, so that the updated media play list is obtained, the request frequency and the number of connections initiated between the client side and the server can be reduced, the load is reduced, the client side can only merge the incremental data into the media play list to obtain the current media update play list, the media play list does not have data repetition, and the data redundancy is not caused, so that the cost of the client side and the server flow is reduced.
Optionally, on the basis of the embodiment corresponding to fig. 2, in another optional embodiment of the media play list based live broadcast method provided by the embodiment of the present application, as shown in fig. 3, the target request identifier includes a block transmission code identifier; step S102, if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, including: step S301; step S104 includes: step S302; step S106 includes: step S303;
in step S301, when the request identifier is a block transmission code identifier, a block transmission code long connection between the server and the client is established based on the block transmission code identifier;
in step S302, the server sends the media playlist to the client based on the chunked transport encoding long connection between the server and the client;
In step S303, the server transmits incremental data to the client based on the block transfer encoded long connection between the server and the client.
In this embodiment, if the obtained request identifier meets the target request identifier, that is, when the request identifier is a block transmission code identifier, the server establishes a block transmission code length connection between the server and the client based on the block transmission code identifier, so that the media playlist may be sent to the client and the incremental data may be sent to the client based on the block transmission code length connection between the server and the client.
The long connection between the server and the client may be represented by a block transmission code (Chunked transfer encoding), a socket code, or the like, so the corresponding long connection corresponds to a target request identifier, and is used for establishing the corresponding long connection, that is, the target request identifier may be represented by a block transmission code identifier, a full duplex communication identifier, or the like, or may be represented by other identifiers, which is not particularly limited herein.
Specifically, as shown in fig. 14, in the process of streaming live broadcast using HLS, since HLS protocol generally includes HTTP protocol, in order to obtain a media playlist, a client first sends a media playlist request such as HTTP request to a server, and if a chunk tag, that is, a chunk transmission code identifier, is added to header information HTTP HEADER of the media playlist request such as HTTP request (chunk request as illustrated in fig. 14), examples are as follows:
Transfer-Encoding:chunked;
Therefore, when the server receives a media play list request, such as an HTTP request, and the block transmission coding identifier in the example above is added to the header information HTTP HEADER of the media play list request, that is, the request identifier accords with the target request identifier, a communication connection between the client and the server can be established through a handshake mechanism based on a TCP/IP protocol, and then a block transmission coding long connection between the client and the server is established through a block transmission code (Chunked transfer encoding) according to a hypertext transfer protocol (HTTP) based on the TCP/IP protocol communication connection.
Further, as shown in fig. 14, when the server acquires the media playlist, that is, acquires the initial media playlist, data transmission may be performed through a chunk transmission code length connection between the server and the client (as shown in fig. 14, for example, by initially returning to the chunk), so that the initial media playlist acquired by the server is safely and stably transmitted to the client, so that the subsequent client may parse and play the acquired media playlist.
Further, when the server detects that the media playlist is updated, incremental data in the updated media playlist may be acquired, and based on the block transmission encoded long connection (chunk incremental return as illustrated in fig. 14) between the server and the client, the server sends the incremental data to the client, and the entire updated media playlist does not need to be sent to the client, so as to avoid the client from repeating the acquired same data of the media playlist, which results in data redundancy.
Optionally, on the basis of the embodiment corresponding to fig. 3, in another optional embodiment of the live broadcast method based on a media play list provided in the embodiment of the present application, as shown in fig. 4, a media play list request includes an index file identifier and media information of video and audio; step S103, the server parses the media playlist request to generate a media playlist, including:
in step S401, the server reads the content of the initial index file corresponding to the live broadcast according to the index file identifier and the media information of the video and audio;
In step S402, the server generates a media play list based on the initial index file content, where the media play list includes at least one initial video stream slicing sequence number, an initial video stream slicing time length corresponding to the initial video stream slicing sequence number, and an initial video stream slicing address.
In this embodiment, in the live broadcast process based on HLS, the client needs to live broadcast based on the media playlist in the live broadcast HLS, so after the server receives the media playlist request, the server may parse the media playlist request, that is, the server may read the initial index file content corresponding to the live broadcast according to the index file identifier and the media information of the video and audio, and then, based on the initial index file content, the server may generate a media playlist that includes at least one initial video stream slicing sequence number, an initial video stream slicing time length corresponding to the initial video stream slicing sequence number, and an initial video stream slicing address, so that the media playlist may be issued to the client for live broadcast.
In the process of live streaming using HLS, the HLS protocol generally includes an HTTP protocol, an M3U8 file, and TS media information, where HTTP is a transport protocol, M3U8 is an index file, TS is media information of video and audio, an index file identifier is used to indicate the M3U8 index file, and media information of video and audio is used to indicate a TS slice included in the M3U8 index file.
The initial index file content is used for indicating the content in the M3U8 index file which is read for the first time based on a media play list request sent by the client; the initial video stream slice sequence number is used to indicate the sequence number of the TS slices contained in the initial index file content, and may be one or more, typically three, such as "2680.TS" to "2682.TS" in the above example; the initial video stream slicing is used for indicating a TS slicing file corresponding to a TS slicing sequence number contained in the initial index file content, namely playing a media slice resource corresponding to the data stream after slicing, for example, a section of video stream is cut into countless sections, the sections are the TS format slicing files, and each section is correspondingly allocated with a unique video stream slicing sequence number.
Specifically, it can be understood that when there is a media data stream that needs to be or is being live broadcast, the server can index the media data stream that needs to be or is being live broadcast, and perform TS slicing on the obtained media data stream, and then encapsulate the TS slicing by using an M3U8 file storage format.
Further, as shown in fig. 15, when the client, i.e. the player, is to obtain and play the data stream, the client first needs to obtain the media play list, and then obtain and play each media file, i.e. the TS slice, in the media play list, so that, in order to obtain the media play list, the client first sends a media play list request to the server, so that, after the server receives the media play list request for the first time, the server can parse the media play list request (e.g. the parsing request type illustrated in fig. 15), i.e. the server can read the initial index file content corresponding to the live broadcast according to the index file identifier and the media information of the video and audio, e.g. the M3U8 file content from the above example "2680.TS" to "2682.TS", and then, based on the initial index file content, the server can generate a media stream sequence (e.g. the sequence number "2680.TS" to "2682. TS"), the initial video stream slice time length (e.g. the initial video stream sequence number "2680.TS" to "2682. TS"), and the initial video stream segment time length (e.26. 5) # 7.f/26. 5, and the media stream sequence "corresponding to" 60. 80. Program "and so on the media stream sequence" 80. Program ".
Further, as shown in fig. 15, after the media playlist is acquired, it may be determined again whether the request received by the current server is a locked request, and if so, the block transmission coded length connection between the server and the client may be maintained, so that the acquired media playlist may be pushed to the client subsequently based on the block transmission coded length connection between the server and the client. On the contrary, if the request is not a locked request, it can be understood that the current server may receive an immediate http request, and data output cannot be performed based on the block transmission coding length connection between the server and the client, so that the block transmission coding length connection (such as the closed connection illustrated in fig. 15) between the server and the client can be disconnected, so as to avoid resource waste.
Optionally, on the basis of the embodiment corresponding to fig. 4, in another optional embodiment of the live broadcast method based on a media play list provided in the embodiment of the present application, as shown in fig. 5, step S302 is based on a block transmission encoded long connection between a server and a client, and after the server sends the media play list to the client, the method further includes:
in step S501, when the client receives an initial transmission request of a media playlist sent by the server, an initial request identifier of the initial transmission request is obtained;
In step S502, if the initial request identifier is a block transmission code identifier, maintaining a block transmission code long connection between the server and the client, and receiving a media play list sent by the server based on the block transmission code long connection;
in step S503, the client obtains an initial video stream slice based on the initial video stream slice address, and live-broadcasts the video stream slice based on the initial video stream slice sequence number and the initial video stream slice time length.
In this embodiment, when the server establishes a block transmission coding long connection between the server and the client based on the block transmission coding identifier, when the media play list is first sent to the client, an initial sending request carrying the media play list may be sent to the client, then the client may obtain an initial request identifier carried by the initial sending request, if the initial request identifier is the block transmission coding identifier, that is, accords with the target request identifier, the block transmission coding long connection between the server and the client may be maintained, so that the client may receive the media play list sent by the server based on the block transmission coding long connection, and then the client may obtain an initial video stream slice based on the initial video stream slice address, and live broadcast the video stream slice based on the initial video stream slice sequence number and the initial video stream slice time length.
Specifically, as shown in fig. 14, when the server acquires the media playlist, that is, acquires the initial media playlist, the server may transmit an initial transmission request (as shown in fig. 14, for example, by initially returning the chunk) carrying the media playlist to the client through performing data transmission based on the connection of the chunk transmission code length between the server and the client, so as to safely and stably transmit the initial media playlist acquired by the server to the client, so that the subsequent client may parse and play the acquired media playlist.
Further, as shown in fig. 16, after the client acquires the initial transmission request, the initial transmission request may be parsed to determine whether the initial transmission request is a chunked request, if the acquired initial request is identified as a chunked transmission code identifier, that is, if the initial transmission request is a chunked request, the chunked transmission code long connection (such as the connection is maintained as illustrated in fig. 16) between the server and the client may be maintained, so that the client may receive the media playlist transmitted by the server based on the chunked transmission code long connection,
Further, after obtaining the media play list, the client may obtain the initial video stream fragments based on the initial video stream fragment address in the media play list (e.g. the media fragment resource path "https:// priv. Sample. Com/filesequence2680.Ts" corresponding to the initial video stream fragment sequence number of "2680.Ts", etc.), and then may live broadcast the video stream fragments in sequence according to the sequence of the initial video stream fragment sequence number and the initial video stream fragment time length.
Optionally, on the basis of the embodiment corresponding to fig. 5, in another optional embodiment of the live broadcast method based on a media playlist according to the embodiment of the present application, as shown in fig. 6, after obtaining an initial request identifier of an initial transmission request when the client receives the initial transmission request of the media playlist sent by the server, step S501 further includes:
In step S601, if the initial request identifier is not the block transfer code identifier, the block transfer code long connection between the server and the client is disconnected.
In this embodiment, after the client acquires the initial transmission request, the initial request identifier carried in the initial transmission request may be acquired, and if the initial request identifier is not the block transmission code identifier, the block transmission code long connection between the server and the client is disconnected.
Specifically, as shown in fig. 16, after the client obtains the initial sending request, the initial sending request may be parsed to determine whether the initial sending request is a chunked request, if the request received by the current client is not a chunked request, it may be understood that the request received by the current client is an immediate http request, and data output cannot be performed based on the block transmission coding length connection between the server and the client, so that the block transmission coding length connection between the server and the client may be disconnected (such as the closed connection illustrated in fig. 15) to avoid resource waste.
Optionally, in another optional embodiment of the media playlist based live broadcasting method provided by the embodiment of the present application based on the embodiment corresponding to fig. 4, as shown in fig. 7, after the server reads the content of the initial index file corresponding to live broadcasting according to the index file identifier and the media information of the video and audio in step S401, the method further includes: step S701; step S105 includes: step S702;
In step S701, the server periodically reads the content of the index file corresponding to the live broadcast, and generates a media play list corresponding to each period based on the read content of the index file;
In step S702, the media playlist corresponding to the current period is compared with the media playlist corresponding to the previous period, and if the media playlist is updated, the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address in the current period are obtained.
In this embodiment, when live streaming media is performed by using HLS, the server continuously segments the media data stream, so that the content in the M3U8 index file is changed and only one segment is updated at a time, so that after the server reads the initial index file content corresponding to live streaming according to the index file identifier and the media information of video and audio, periodically reads the index file content corresponding to live streaming, generates a media play list corresponding to each period based on the read index file content, and then compares the media play list corresponding to the current period with the media play list corresponding to the previous period, if the media play list is updated with data, the updated segment in the current period, that is, the updated video stream segment sequence number, the updated video stream segment time length and the updated video stream segment address can be directly obtained.
Specifically, as shown in fig. 17, it may be understood that when live streaming is performed by using HLS, in the M3U8 index file, the description of three TS slices in the above example is generally stored, and the server continuously slices the media data stream, so that the content in the M3U8 index file may be changed, and only one slice is updated at a time, so that after the server reads the initial index file content corresponding to the live broadcast according to the index file identifier and the media information of the video and audio, the server may periodically read the index file content corresponding to the live broadcast at preset time intervals (for example, taking the time length of each TS as the time interval), and generate a media play list corresponding to each period according to the play list format of the M3U8 index file based on the read index file content.
Further, by comparing the two-period lists, that is, comparing the media play list corresponding to the current period with the media play list corresponding to the previous period, it is determined whether the media play list is updated (whether the list data illustrated in fig. 17 is changed), when the media play list is updated, a piece of updated video stream piece serial number, updated video stream piece time length and updated video stream piece address (generated incremental data illustrated in fig. 17) in the current period can be directly obtained, for example, the media play list corresponding to the current period is as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2681
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2683.ts
Comparing the media play list corresponding to the current period with the media play list corresponding to the previous period, such as the media play list data corresponding to the sequence numbers from 2680.TS to 2682.TS, the updated data is known to be the label corresponding to 2683.TS and the TS slicing file, that is, the updated data is the incremental data obtained by the server, so that the updated video stream slicing sequence number from 2683.TS, the updated video stream slicing time length "# EXTINF:7.975" and the updated video stream slicing address "https:// priv. Example. Composition/filerequest 2683.TS" can be obtained.
Optionally, based on the embodiment corresponding to fig. 7, in another optional embodiment of the live broadcast method based on a media play list provided in the embodiment of the present application, as shown in fig. 8, step S107 includes, when the client acquires incremental data, merging the incremental data into the media play list to obtain a current media update play list, where the step includes:
In step S801, when the client acquires the incremental data, the updated video stream slicing sequence number, the updated video stream slicing time length, and the updated video stream slicing address are combined to the list tail of the media playlist according to the sequence of the sequence numbers, so as to acquire the current media updated playlist.
In this embodiment, when the client obtains incremental data based on the long connection between the server and the client, the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address may be combined to the tail of the list of the media play list according to the sequence of the sequence numbers, so as to obtain the current media update play list, so that the client can live broadcast based on the current media update play list.
Specifically, as shown in fig. 18, after new data is generated, the client obtains the incremental data based on the long connection between the server and the client (parsing the incremental data as shown in fig. 18), merges the incremental data into the original existing media play list on the client, specifically, may merge the incremental data into the tail of the media play list according to the sequence of the sequence numbers, that is, according to the sequence numbers of the TS fragments from small to large, that is, the sequence numbers of the fragments of the incremental data are the last sequence number in the media play list, and adds the incremental data into the list of the media play list to update the media play list, so as to obtain the updated media update play list, so that the client can sequentially download and play the TS fragments according to the play sequence numbers of the media files based on the sequence numbers of the TS fragments in the current media update play list.
Optionally, in another optional embodiment of the live broadcast method based on a media play list according to the embodiment of fig. 8, as shown in fig. 9, when the media play list corresponding to the previous period is an initial video stream slicing sequence number, an initial video stream slicing time length and an initial video stream slicing address; step S801, when the client obtains the incremental data, merges the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the list tail of the media play list according to the sequence of the sequence numbers, so as to obtain the current media updated play list, which includes:
in step S901, when the client acquires the incremental data, determining the position of the initial video stream fragment sequence number corresponding to the maximum sequence number value according to the sequence of the sequence numbers;
In step S902, after the initial video stream slicing sequence number, the initial video stream slicing time length, and the initial video stream slicing address corresponding to the maximum sequence number value, the updated video stream slicing sequence number, the updated video stream slicing time length, and the updated video stream slicing address are added to obtain the current media update playlist.
In this embodiment, when the client obtains incremental data based on the long connection between the server and the client, the position of the initial video stream slicing sequence number corresponding to the current maximum sequence number value may be determined first according to the sequence of the sequence numbers, and then, after the initial video stream slicing sequence number, the initial video stream slicing time length and the initial video stream slicing address corresponding to the maximum sequence number value, the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address may be added to merge the incremental data into the list tail of the media play list, so as to obtain the current media update play list, so that the client may sequentially download and play the TS slices according to the play sequence number of the media file based on the current TS slicing sequence number in the current media update play list.
Specifically, as shown in fig. 18, after new data is generated, the client obtains incremental data based on a long connection between the server and the client (parsing the incremental data as shown in fig. 18), merges the incremental data into the original existing media play list on the client, specifically, according to the sequence of the sequence numbers, that is, according to the sequence numbers of the TS slices from small to large, the position of the initial video stream slice sequence number corresponding to the current maximum sequence number value can be determined, the incremental data is added to the current maximum TS slice sequence number in the media play list, and then the media play list is updated, so that the updated media update play list is obtained, and the client can download and play the TS slices according to the play sequence number of the media file in sequence based on the current TS slice sequence number in the current media update play list.
For example, the media playlist data on the current client is exemplified as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2680
#EXTINF:7.975,
https://priv.example.com/fileSequence2680.ts
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
further, assume that delta data is acquired as follows:
#EXTINF:7.975,
https://priv.example.com/fileSequence2683.ts
Further, as shown in fig. 18, the obtained incremental data may be combined into the current tomorrow playlist data (as illustrated in fig. 18 and combined with old data), that is, the incremental data "2683.Ts" may be added to the current maximum sequence number "2682.Ts" to obtain the updated media update playlist as follows:
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2681
#EXTINF:7.975,
https://priv.example.com/fileSequence2680.ts
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2683.ts
It can be understood that, based on the characteristic that the M3U8 index file plays the latest three TS slices, it can be known that the slices to be played are the slice files corresponding to the SEQUENCE numbers "2681.TS" to "2683.TS", so that the slice currently played is the slice file corresponding to the SEQUENCE number "2681.TS", that is "# EXT-X-MEDIA-SEQUENCE:2681".
Optionally, on the basis of the embodiment corresponding to fig. 7, in another optional embodiment of the media play list based live broadcast method provided by the embodiment of the present application, as shown in fig. 10, when the incremental data further includes an end identifier; step S107, when the client acquires the incremental data, merging the incremental data into the media playlist to obtain a current media update playlist, including:
in step S1001, when the client obtains the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the tail of the media play list according to the sequence of the sequence numbers, and adding an end identifier at the tail of the merged media play list to obtain the current media updated play list;
In step S1002, the client performs live broadcasting based on the current media update playlist, and when executing the end identifier, ends live broadcasting, and disconnects the long connection between the server and the client.
In this embodiment, when the client obtains the incremental data based on the long connection between the server and the client, if the incremental data includes the end identifier, the sequence of the sequence numbers may be first used to merge the updated video stream slicing sequence number, the updated video stream slicing time length, and the updated video stream slicing address into the tail of the media play list, and then the end identifier is added at the end of the merged media play list to obtain the current media update play list, so that the client may first perform live broadcast based on the current media update play list, and when the live broadcast is executed to the end identifier, the long connection between the server and the client is disconnected when the live broadcast is ended.
Specifically, as shown in fig. 18, after new data is generated, the client obtains the incremental data (parsing the incremental data as illustrated in fig. 18) based on the long connection between the server and the client, if the obtained incremental data includes an end identifier, such as "#ext-X-end list", for indicating that the live broadcast is about to end, the incremental data may be first merged into the original existing media play list on the client, specifically, the incremental data may be merged into the list tail of the media play list according to the sequence of the sequence numbers, that is, the sequence number of the fragments of the incremental data is used as the last sequence number in the media play list, and the incremental data is added into the list of the media play list.
Further, the acquisition end identifier may be added to the list end of the media playlist, assuming that the updated media update playlist is acquired as follows:
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2681
#EXTINF:7.975,
https://priv.example.com/fileSequence2680.ts
#EXTINF:7.941,
https://priv.example.com/fileSequence2681.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2682.ts
#EXTINF:7.975,
https://priv.example.com/fileSequence2683.ts
#EXT-X-ENDLIST
Further, after the updated media update playlist is obtained, so that the client can download and play the TS slices according to the playing serial numbers of the media files in turn based on the current TS slice serial numbers in the media update playlist, and then when the live broadcast is executed to the end identifier, indicating that the live broadcast is ended, the long connection between the server and the client (closing connection as illustrated in fig. 18) can be disconnected, and the live broadcast player or browser can be exited.
Optionally, on the basis of the embodiment corresponding to fig. 2, in another optional embodiment of the media playlist-based live broadcast method provided by the embodiment of the present application, as shown in fig. 11, step S104 is based on a long connection between a server and a client, where the server sends the media playlist to the client, so that after the client performs live broadcast based on the media playlist, the method further includes:
in step S1101, when the client turns off live broadcast, the long connection between the server and the client is disconnected;
In this embodiment, when the client closes the live broadcast, that is, the client does not need to pull or update the media playlist to perform live broadcast, the long connection between the server and the client can be disconnected, so as to avoid resource waste caused by that the server actively issues updated data, namely incremental data.
Specifically, as shown in fig. 18, in the process that the client performs live broadcasting based on the media playlist or the media update playlist combined with the incremental data, when the client detects or receives the exit or closing operation of the target object, that is, the client closes live broadcasting, for example, when the target object closes the player or exits the live browser, the client may send an end request carrying an end identifier, such as "#ext-X-ENDLIST", to the server, so that the server and the client may disconnect the long connection between the server and the client based on the end identifier, that is, close connection as illustrated in fig. 18.
In step S1102, if the server receives the new request of the media playlist of the client again, the server obtains a new request identifier of the new request of the media playlist;
In this embodiment, after the client closes the live broadcast, if the server re-receives the new request of the media playlist of the client, the server may acquire the new request identifier of the media playlist request, so that the subsequent server may reload the media playlist based on the new request identifier and issue the reload to the client, so that the client may subsequently live broadcast based on the pulled media playlist.
Specifically, after the client closes the live broadcast, when the target object reenters the player or re-watches the live broadcast, the target object can send the live broadcast watching operation again through the operation interface of the live broadcast tool such as the player or the browser on the client, so that the client can send the media play list request to the server again, and further, when the server re-receives the media play list request of the client, the server can acquire a new request identification of the media play list request, so that the subsequent server can load the media play list based on the new request identification and send the media play list to the client, and the client can receive the media play list for live broadcast.
In step S1103, if the new request identifier meets the target request identifier, the server reestablishes a long connection between the server and the client based on the target request identifier;
in this embodiment, if the obtained new request identifier meets the target request identifier, the server reestablishes a long connection between the server and the client based on the target request identifier, so that the media playlist can be issued to the client based on the long connection between the server and the client.
Specifically, after the new request identifier is obtained, if the new request identifier meets the target request identifier, the server may reestablish the communication connection between the client and the server through a handshake mechanism based on the TCP/IP protocol, and then reestablish the long connection between the client and the server according to a hypertext transfer protocol (HTTP), through a block transfer code (Chunked transfer encoding), or a socket code, or other manners on the basis of the TCP/IP protocol communication connection, and may also establish the long connection according to other manners, which is not limited in particular herein.
In step S1104, the server parses the new request for the media playlist to generate a new media playlist;
In this embodiment, in the live broadcast process based on HLS, the client needs to live broadcast based on the media playlist in the live broadcast HLS, so after the server receives the media playlist request again, the server may parse the media playlist request again to generate a new media playlist, so that the new media playlist may be issued to the client for live broadcast.
Specifically, when the client, i.e. the player, is to re-play the data stream, the client first needs to re-acquire the media playlist, and then re-acquire and play each media file, i.e. the TS slice, in the media playlist, so that, in order to re-acquire the media playlist, the client will re-send the media playlist request to the server, so that after the server re-receives the media playlist request, the server can parse the media playlist request, i.e. the server can re-read the corresponding M3U8 file content according to the current index file carried in the media playlist request, and then can generate a corresponding new media playlist based on the read M3U8 file content.
In step S1105, based on the long connection between the server and the client, the server transmits the new media play list to the client so that the client can live again based on the new media play list.
In this embodiment, after the server acquires the new media play list, the server may send the new media play list to the client based on the long connection between the server and the client, so that the client may live based on the new media play list.
Specifically, when the server acquires the new media play list, that is, reacquires the new media play list, the new media play list can be safely and stably transmitted to the client through data transmission based on a stable long connection between the server and the client, so that the subsequent client can analyze and play the acquired new media play list.
Optionally, on the basis of the embodiment corresponding to fig. 2, in another optional embodiment of the media playlist-based live broadcast method provided by the embodiment of the present application, as shown in fig. 12, the target request identifier further includes a full duplex communication identifier; step S102, if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, including: step S1201; step S104 includes: step S1202; step S106 includes: step S1203;
in step S1201, when the request identifier is a full duplex communication identifier, a bidirectional communication long connection transmission between the server and the client is established through a handshake mechanism;
in step S1202, the server sends the media playlist to the client based on the bi-directional communication long connection between the server and the client;
In step S1203, the server transmits the incremental data to the client based on the bidirectional communication long connection between the server and the client.
In this embodiment, if the obtained request identifier meets the target request identifier, that is, when the request identifier is a full duplex communication identifier, the server establishes a bidirectional communication long connection between the server and the client through a handshake mechanism based on the full duplex communication identifier, so that the media playlist can be subsequently sent to the client and the incremental data can be sent to the client based on the bidirectional communication long connection between the server and the client.
The long connection between the server and the client may be represented by a block transmission code (Chunked transfer encoding), a full duplex communication websocket code, or the like, so that the corresponding long connection corresponds to a target request identifier, and is used for establishing the corresponding long connection, that is, the target request identifier may be represented by a block transmission code identifier, a full duplex communication identifier, or the like, and may also be represented by other identifiers, which is not particularly limited herein.
Among them, full duplex communication websocket is a new network protocol based on TCP, which is used to implement full duplex (full-duplex) communication between a client and a server, that is, to allow the server to actively send information to the client.
Specifically, in the process of streaming live broadcasting using HLS, since the HLS protocol generally includes HTTP protocol, the client sends a media play list request such as HTTP request to the server in order to obtain the media play list, if a WebSocket label, that is, a full duplex communication identifier, is added to header information HTTP HEADER of the media play list request such as HTTP request, when the server receives the media play list request such as HTTP request, the server sends a response when the request identifier meets the target request identifier, that is, when the full duplex communication identifier in the example is added to header information HTTP HEADER of the media play list request such as HTTP request, the server sends a response, which is generally called "handshake" in WebSocket API, and only one handshake action is needed between the client and the server, then a fast channel is formed between the client and the server, that is, and a bidirectional communication long connection between the server and the client is formed. The data can be directly transmitted between the server and the client.
It will be appreciated that based on the nature of the long connection of bi-directional communications between the server and the client, the server will not passively return data after receiving the client's request, but will actively push to the client when the server has new data, i.e., a media playlist or delta data is acquired.
Further, when the server acquires the media play list, that is, acquires the initial media play list, data transmission can be performed through a bi-directional communication long connection between the server and the client, so that the media play list is safely and stably transmitted to the client, and a subsequent client can analyze and play the acquired media play list.
Further, when the server detects that the media play list is updated, incremental data in the updated media play list can be acquired, based on the bidirectional communication long connection between the server and the client, the server sends the incremental data to the client, and the whole updated media play list is not required to be sent to the client, so that the situation that the client repeatedly acquires the same data of the media play list, and data redundancy is caused is avoided.
Optionally, on the basis of the embodiment corresponding to fig. 2, in another optional embodiment of the media play list based live broadcast method provided by the embodiment of the present application, as shown in fig. 13, the target request identifier further includes a cache push identifier; step S102, if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, including: step S1301; step S104 includes: step S1302; step S106 includes: step S1303;
In step S1301, when the request identifier is a cache push identifier, if the server responds to the media playlist request, a message push long connection between the server and the client is established;
In step S1302, the server sends the media playlist to the client based on the message push long connection between the server and the client;
In step S1303, the server sends incremental data to the client based on the message push long connection between the server and the client.
In this embodiment, if the obtained request identifier meets the target request identifier, that is, when the request identifier is the cache push identifier, the server establishes a message push long connection between the server and the client based on the cache push identifier, so that the media playlist may be sent to the client and the incremental data may be sent to the client based on the message push long connection between the server and the client.
The long connection between the server and the client may be represented by a cache push, a socket code, or the like, so the corresponding long connection corresponds to a target request identifier, and is used for establishing the corresponding long connection, that is, the target request identifier may be represented by a cache push identifier, a full duplex communication identifier, or the like, and may also be represented by other identifiers, which is not particularly limited herein.
The cache PUSH identifier is used for indicating a server side message PUSH function push_PROMISE in the HTTP 2.0 protocol, and the message PUSH function can be based on a sent request, such as a client side request HTTP, the server side can actively PUSH an M3U8 file, or the server can PUSH resources to the client side in advance, and the like.
Specifically, in the process of streaming live broadcasting using HLS, since HLS protocol generally includes HTTP protocol, the client sends a media play list request such as HTTP request to the server in order to obtain the media play list, if a push flag, for example, "HTTP2_push", i.e. a cache push identifier is added to header information HTTP HEADER of the media play list request such as HTTP request, when the server receives the media play list request such as HTTP request, when the cache push identifier in the example above is added to header information HTTP HEADER of the media play list request such as HTTP request, i.e. the request identifier meets the target request identifier, after the server responds to the media play list request, a message push long connection between the client and the server may be established based on the HTTP2_push command.
Further, when the server acquires the media play list, that is, acquires the initial media play list, data transmission can be performed by pushing a long connection based on a message between the server and the client, that is, the media play list is actively and safely transmitted to the client based on an http2_push command, so that a subsequent client can analyze and play the acquired media play list.
Further, when the server detects that the media play list is updated, incremental data in the updated media play list can be obtained, long connection is pushed based on information between the server and the client, namely the incremental data is actively sent to the client based on the http2_push command, and the whole updated media play list is not required to be sent to the client, so that the situation that the client repeatedly obtains the same data of the media play list and data redundancy is caused is avoided.
Referring to fig. 19, fig. 19 is a schematic diagram illustrating an embodiment of a media playlist based live broadcast device according to an embodiment of the present application, a media playlist based live broadcast device 20 includes:
an obtaining unit 201, configured to, when a server receives a media playlist request from a client, obtain a request identifier of the media playlist request;
A processing unit 202, configured to, if the request identifier meets the target request identifier, establish a long connection between the server and the client based on the target request identifier;
the processing unit 202 is further configured to parse the media playlist request by the server to generate a media playlist;
A transmitting unit 203, configured to transmit, based on a long connection between a server and a client, a media playlist to the client, so that the client performs live broadcast based on the media playlist;
An obtaining unit 201, configured to obtain incremental data in the updated media playlist when the server detects that the media playlist is updated with data;
A sending unit 203, configured to send incremental data to the client by the server based on the long connection between the server and the client;
The processing unit 202 is further configured to, when the client obtains the incremental data, merge the incremental data into the media playlist to obtain a current media update playlist, so that the client performs live broadcast based on the current media update playlist.
Optionally, in another embodiment of the media playlist based live broadcast device according to the embodiment of the present application, based on the embodiment corresponding to fig. 19, the processing unit 202 may specifically be configured to:
When the request identifier is a block transmission code identifier, establishing a block transmission code long connection between the server and the client based on the block transmission code identifier;
the transmitting unit 203 may specifically be configured to: transmitting the coded long connection based on the blocks between the server and the client, and transmitting the media play list to the client by the server;
the transmitting unit 203 may specifically be configured to: the server sends delta data to the client based on the chunked transport encoded long connection between the server and the client.
Optionally, in another embodiment of the media playlist based live broadcast device according to the embodiment of the present application, based on the embodiment corresponding to fig. 19, the processing unit 202 may specifically be configured to:
The server reads the initial index file content corresponding to the live broadcast according to the index file identification and the media information of the video and audio;
The server generates a media play list based on the initial index file content, wherein the media play list comprises at least one initial video stream slicing sequence number, an initial video stream slicing time length corresponding to the initial video stream slicing sequence number and an initial video stream slicing address.
Alternatively, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the live broadcast apparatus based on a media playlist according to the embodiment of the present application,
The obtaining unit 201 is further configured to obtain an initial request identifier of the initial transmission request when the client receives the initial transmission request of the media playlist sent by the server;
The obtaining unit 201 is further configured to maintain a block transmission coding long connection between the server and the client if the initial request identifier is a block transmission coding identifier, and receive a media playlist sent by the server based on the block transmission coding long connection;
The processing unit 202 is further configured to obtain an initial video stream slice based on the initial video stream slice address by the client, and live broadcast the video stream slice based on the initial video stream slice sequence number and the initial video stream slice time length.
Alternatively, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the live broadcast apparatus based on a media playlist according to the embodiment of the present application,
The processing unit 202 is further configured to disconnect the long connection of the block transport coding between the server and the client if the initial request identifier is not the block transport coding identifier.
Alternatively, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the live broadcast apparatus based on a media playlist according to the embodiment of the present application,
The processing unit 202 is further configured to periodically read the content of the index file corresponding to the live broadcast by the server, and generate a media play list corresponding to each period based on the read content of the index file;
The acquisition unit 201 may specifically be configured to: and comparing the media play list corresponding to the current period with the media play list corresponding to the previous period, and if the media play list is subjected to data updating, acquiring the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address in the current period.
Optionally, in another embodiment of the media playlist based live broadcast device according to the embodiment of the present application, based on the embodiment corresponding to fig. 19, the processing unit 202 may specifically be configured to:
When the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the list tail of the media play list according to the sequence of the sequence numbers so as to acquire the current media updated play list.
Optionally, in another embodiment of the media playlist based live broadcast device according to the embodiment of the present application, based on the embodiment corresponding to fig. 19, the processing unit 202 may specifically be configured to:
when the client acquires the incremental data, determining the position of the initial video stream fragment sequence number corresponding to the maximum sequence number value according to the sequence of the sequence numbers;
And adding the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address after the initial video stream slicing sequence number, the initial video stream slicing time length and the initial video stream slicing address corresponding to the maximum sequence number value so as to acquire the current media updated playlist.
Optionally, in another embodiment of the media playlist based live broadcast device according to the embodiment of the present application, based on the embodiment corresponding to fig. 19, the processing unit 202 may specifically be configured to:
when the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the tail part of the media play list according to the sequence of the sequence numbers, and adding an end mark at the tail part of the merged media play list to acquire the current media updated play list;
And the client updates the play list based on the current media to carry out live broadcast, and when the live broadcast is executed to the end mark, the live broadcast is ended, and the long connection between the server and the client is disconnected.
Alternatively, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the live broadcast apparatus based on a media playlist according to the embodiment of the present application,
The processing unit 202 is further configured to disconnect the long connection between the server and the client when the client turns off live broadcast;
The obtaining unit 201 is further configured to, if the server re-receives a new request for the media playlist from the client, obtain a new request identifier of the new request for the media playlist;
The processing unit 202 is further configured to, if the new request identifier meets the target request identifier, reestablish a long connection between the server and the client based on the target request identifier;
The processing unit 202 is further configured to parse the new request for the media playlist by the server, and generate a new media playlist;
The sending unit 203 is further configured to send the new media play list to the client by the server based on the long connection between the server and the client, so that the client can live again based on the new media play list.
Optionally, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the media playlist based live broadcast device provided by the embodiment of the present application, the processing unit 203 may specifically be configured to:
When the request identifier is a full duplex communication identifier, establishing a two-way communication long connection between the server and the client through a handshake mechanism;
the transmitting unit 203 may specifically be configured to: based on the two-way communication long connection between the server and the client, the server sends the media play list to the client;
the transmitting unit 203 may specifically be configured to: based on the bi-directional communication long connection between the server and the client, the server sends incremental data to the client.
Optionally, on the basis of the embodiment corresponding to fig. 19, in another embodiment of the media playlist based live broadcast device provided by the embodiment of the present application, the processing unit 203 may specifically be configured to:
when the request mark is a cache push mark, if the server responds to the media play list request, establishing message push long connection between the server and the client;
The transmitting unit 203 may specifically be configured to: based on the message push long connection between the server and the client, the server sends the media play list to the client;
the transmitting unit 203 may specifically be configured to: based on the message push long connection between the server and the client, the server sends the incremental data to the client.
Another aspect of the present application provides another schematic diagram of a computer device, as shown in fig. 20, fig. 20 is a schematic diagram of a structure of a computer device provided in an embodiment of the present application, where the computer device 300 may have a relatively large difference due to different configurations or performances, and may include one or more central processing units (central processing units, CPUs) 310 (e.g., one or more processors) and a memory 320, one or more storage mediums 330 (e.g., one or more mass storage devices) storing application programs 331 or data 332. Wherein memory 320 and storage medium 330 may be transitory or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instruction operations in the computer device 300. Still further, the central processor 310 may be configured to communicate with the storage medium 330 and execute a series of instruction operations in the storage medium 330 on the computer device 300.
The computer device 300 may also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input/output interfaces 360, and/or one or more operating systems 333, such as a Windows Server TM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM, or the like.
The above-described computer device 300 is also used to perform the steps in the corresponding embodiments as in fig. 2 to 13.
Another aspect of the application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs steps in a method as described in the embodiments shown in fig. 2 to 13.
Another aspect of the application provides a computer program product comprising a computer program which, when executed by a processor, implements steps in a method as described in the embodiments shown in fig. 2 to 13.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (16)

1. A media playlist based live broadcast method, comprising:
When a server receives a media play list request of a client, the server acquires a request identifier of the media play list request;
If the request identifier meets the target request identifier, the server establishes long connection between the server and the client based on the target request identifier;
the server analyzes the media play list request to generate a media play list;
Based on the long connection between the server and the client, the server sends the media play list to the client so that the client can live broadcast based on the media play list;
when the server detects that the media play list is updated with data, incremental data in the updated media play list is acquired;
based on the long connection between the server and the client, the server sends the incremental data to the client;
and when the client acquires the incremental data, merging the incremental data into the media play list to obtain a current media update play list, so that the client can live broadcast based on the current media update play list.
2. The method of claim 1, wherein the target request identification comprises a chunk transfer code identification; if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, and the method comprises the following steps:
when the request identifier is the block transmission code identifier, establishing a block transmission code long connection between the server and the client based on the block transmission code identifier;
The server sending the media playlist to the client based on the long connection between the server and the client, comprising:
Transmitting the media playlist to the client based on the chunked transport encoding long connection between the server and the client;
The server sending the delta data to the client based on the long connection between the server and the client, comprising:
based on the chunked transport encoded long connection between the server and the client, the server sends the delta data to the client.
3. The method of claim 2, wherein the media playlist request includes an index file identification and media information of audio and video; the server parses the media playlist request to generate a media playlist, including:
the server reads the initial index file content corresponding to the live broadcast according to the index file identification and the media information of the video and audio;
The server generates the media play list based on the initial index file content, wherein the media play list comprises at least one initial video stream slicing sequence number, an initial video stream slicing time length corresponding to the initial video stream slicing sequence number and an initial video stream slicing address.
4. The method of claim 3, wherein the transmitting the encoded long connection based on the chunk between the server and the client, the server after sending the media playlist to the client, the method further comprises:
When the client receives an initial sending request of the media play list sent by the server, acquiring an initial request identifier of the initial sending request;
If the initial request identifier is the block transmission code identifier, maintaining the block transmission code long connection between the server and the client, and receiving the media play list sent by the server based on the block transmission code long connection;
and the client acquires an initial video stream fragment based on the initial video stream fragment address, and live broadcasts the video stream fragment based on the initial video stream fragment sequence number and the initial video stream fragment time length.
5. The method according to claim 4, wherein when the client receives an initial transmission request of the media playlist transmitted by the server, after acquiring an initial request identifier of the initial transmission request, the method further comprises:
And if the initial request identifier is not the block transmission code identifier, disconnecting the block transmission code long connection between the server and the client.
6. The method of claim 3, wherein after the server reads the initial index file content corresponding to the live broadcast according to the index file identifier and the media information of the video and audio, the method further comprises:
The server periodically reads the index file content corresponding to the live broadcast, and generates a media play list corresponding to each period based on the read index file content;
when the server detects that the media play list is updated with data, the method for acquiring the incremental data in the updated media play list comprises the following steps:
And comparing the media play list corresponding to the current period with the media play list corresponding to the previous period, and if the media play list is subjected to data updating, acquiring the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address in the current period.
7. The method of claim 6, wherein merging the delta data into the media playlist when the client obtains the delta data, obtaining a current media update playlist, comprises:
when the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the tail part of the list of the media play list according to the sequence of the sequence numbers so as to acquire the current media updated play list.
8. The method of claim 7, wherein when the media playlist corresponding to the last period is an initial video stream slicing sequence number, an initial video stream slicing time length, and an initial video stream slicing address;
When the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the list tail of the media play list according to the sequence of the sequence numbers, so as to acquire the current media updated play list, which comprises the following steps:
when the client acquires the incremental data, determining the position of the initial video stream fragment sequence number corresponding to the maximum sequence number value according to the sequence of the sequence numbers;
And adding the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address after the initial video stream slicing sequence number, the initial video stream slicing time length and the initial video stream slicing address corresponding to the maximum sequence number value so as to acquire the current media updated play list.
9. The method of claim 6, wherein when the delta data further comprises an end identifier; and when the client acquires the incremental data, merging the incremental data into the media play list to obtain a current media update play list, wherein the method comprises the following steps of:
When the client acquires the incremental data, merging the updated video stream slicing sequence number, the updated video stream slicing time length and the updated video stream slicing address into the tail part of the media play list according to the sequence of the sequence numbers, and adding the ending mark at the tail part of the merged media play list to acquire the current media updated play list;
And the client performs live broadcasting based on the current media update play list, and finishes the live broadcasting and disconnects the long connection between the server and the client when the client performs the ending identification.
10. The method of claim 1, wherein the server sends the media playlist to the client based on a long connection between the server and the client such that after the client has live based on the media playlist, the method further comprises:
when the client closes the live broadcast, disconnecting a long connection between the server and the client;
If the server re-receives the new request of the media play list of the client, the server acquires a new request identifier of the new request of the media play list;
If the new request identifier meets the target request identifier, the server reestablishes long connection between the server and the client based on the target request identifier;
the server analyzes the new request of the media play list to generate a new media play list;
based on the long connection between the server and the client, the server sends the new media play list to the client so that the client can live again based on the new media play list.
11. The method of claim 1, wherein the target request identification further comprises a full duplex communication identification; if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, and the method comprises the following steps:
When the request identifier is the full duplex communication identifier, establishing a bidirectional communication long connection between the server and the client through a handshake mechanism;
The server sending the media playlist to the client based on the long connection between the server and the client, comprising:
Based on a bi-directional communication long connection between the server and the client, the server sends the media playlist to the client;
The server sending the delta data to the client based on the long connection between the server and the client, comprising:
The server sends the delta data to the client based on a bi-directional long communication connection between the server and the client.
12. The method of claim 1, wherein the target request identifier further comprises a cache push identifier; if the request identifier meets the target request identifier, the server establishes a long connection between the server and the client based on the target request identifier, and the method comprises the following steps:
When the request identifier is the cache push identifier, if the server responds to the media play list request, establishing a message push long connection between the server and the client;
The server sending the media playlist to the client based on the long connection between the server and the client, comprising:
Based on a message push long connection between the server and the client, the server sends the media playlist to the client;
The server sending the delta data to the client based on the long connection between the server and the client, comprising:
Based on the message push long connection between the server and the client, the server sends the incremental data to the client.
13. A media playlist based live broadcast apparatus, comprising:
the acquisition unit is used for acquiring a request identifier of a media play list request of a client when the server receives the media play list request;
the processing unit is used for establishing long connection between the server and the client based on the target request identifier if the request identifier accords with the target request identifier;
the processing unit is further configured to parse the media playlist request by the server to generate a media playlist;
a transmitting unit, configured to transmit the media playlist to the client based on a long connection between the server and the client, so that the client performs live broadcast based on the media playlist;
the acquisition unit is further used for acquiring incremental data in the updated media play list when the server detects that the media play list is updated with data;
The sending unit is further configured to send the incremental data to the client based on a long connection between the server and the client;
And the processing unit is further used for merging the incremental data into the media play list to obtain a current media update play list when the client acquires the incremental data, so that the client can live broadcast based on the current media update play list.
14. A computer device comprising a memory, a processor and a bus system, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1to 12 when executing the computer program;
The bus system is used for connecting the memory and the processor so as to enable the memory and the processor to communicate.
15. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 12.
16. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 12.
CN202211581231.7A 2022-12-09 2022-12-09 Live broadcast method, device, equipment and storage medium based on media play list Pending CN118175357A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211581231.7A CN118175357A (en) 2022-12-09 2022-12-09 Live broadcast method, device, equipment and storage medium based on media play list

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211581231.7A CN118175357A (en) 2022-12-09 2022-12-09 Live broadcast method, device, equipment and storage medium based on media play list

Publications (1)

Publication Number Publication Date
CN118175357A true CN118175357A (en) 2024-06-11

Family

ID=91347614

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211581231.7A Pending CN118175357A (en) 2022-12-09 2022-12-09 Live broadcast method, device, equipment and storage medium based on media play list

Country Status (1)

Country Link
CN (1) CN118175357A (en)

Similar Documents

Publication Publication Date Title
EP3105903B1 (en) Requesting multiple chunks from a network node on the basis of a single request message
EP3979602B1 (en) Request-based encoding for streaming content portions
CA2988320C (en) Http live streaming (hls) video client synchronization
US9038116B1 (en) Method and system for recording streams
US8468262B2 (en) Method and apparatus for updating http content descriptions
CA2826552C (en) Method and apparatus for receiving presentation metadata
US8824676B2 (en) Streaming video to cellular phones
CN104662865A (en) Hybrid http and udp content delivery
GB2534849A (en) Client-driven push of resources by a server device
EP2493191B1 (en) Method, device and system for realizing hierarchically requesting content in http streaming system
US8886716B2 (en) Cloud-based de-duplication
WO2011088725A1 (en) Method and apparatus for synchronization based on hypertext transfer protocol (http)
US20220179831A1 (en) Management of content
CN106411996B (en) Content negotiation in content-centric networks
CN110519656B (en) Self-adaptive streaming media playing method, system and server
CN116684703A (en) Streaming media data transmission method and related equipment based on proximity service communication protocol
CN118175357A (en) Live broadcast method, device, equipment and storage medium based on media play list
CN113301100A (en) Data disaster tolerance method, device, equipment and medium based on content distribution network
EP3292698B1 (en) Http live streaming (hls) video client synchronization
CN117499715A (en) Audio and video traffic transmission method, device, equipment and storage medium
CN116827619A (en) Method, apparatus and computer readable medium for preventing HTTP amplification attacks
WO2016156386A1 (en) System for broadcasting audio and/or video content via a local wifi network, and devices implementing the method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication