jaryhe 67001cd674 new | 6 mēneši atpakaļ | |
---|---|---|
.. | ||
hls.js | 6 mēneši atpakaļ | |
.gitignore | 6 mēneši atpakaļ | |
LICENSE | 6 mēneši atpakaļ | |
README.en.md | 6 mēneši atpakaļ | |
README.md | 6 mēneši atpakaļ | |
default.ts | 6 mēneši atpakaļ | |
default.yaml | 6 mēneši atpakaļ | |
go.mod | 6 mēneši atpakaļ | |
go.sum | 6 mēneši atpakaļ | |
hls.go | 6 mēneši atpakaļ | |
llhls.go | 6 mēneši atpakaļ | |
main.go | 6 mēneši atpakaļ | |
pull.go | 6 mēneši atpakaļ | |
write.go | 6 mēneši atpakaļ |
http://localhost:8080/hls/live/user1.m3u8
for playback, where port 8080 is the global HTTP configuration, live/user1 is streamPath, which needs to be modified according to the actual situationhttps://github.com/Monibuca/plugin-hls
import (
_ "m7s.live/plugin/hls/v4"
)
The parameters are variable. The following parameters live/hls are used as examples, not fixed
/hls/api/list
List all HLS streams, is an SSE, can continue to receive the list data, plus?json=1 can return json data./hls/api/save?streamPath=live/hls
Save the specified stream (such as live/hls) as an HLS file (m3u8 and ts) when this request is closed, the save ends (this API only works for remote pulling)/hls/api/pull?streamPath=live/hls&target=http://localhost/abc.m3u8
Pull the target HLS stream over as a media source in monibuca in the form oflive/hls
streamllhls address form
http://localhost:8080/llhls/live/user1/index.m3u8
for playback, where port 8080 is the global HTTP configuration, live/user1 is streamPath, which needs to be modified according to the actual situationConfiguration
The configuration information is added to the configuration file as needed, and there is no need to copy all the default configuration information
The publish and subscribe configurations will override the global configuration
hls: publish: # Format reference global configuration subscribe: # Format reference global configuration pull: # Format https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE fragment: 10s # TS fragment length window: 2 # The number of TS files included in the real-time stream m3u8 file filter: "" # Regular expression used to filter published streams, only streams that match will be written path: "" # If the remote stream needs to be saved, the directory where it is stored defaultts: "" # The default slice is used for the slice header playback when there is no stream. If it is empty, the system built-in is used defaulttsduration: 3.88s # The length of the default slice relaymode: 0 # Forwarding mode, 0: transfer protocol + no forwarding, 1: no transfer protocol + forwarding, 2: transfer protocol + forwarding
The relay mode only works for hls that pulls streams from the remote end.
relaymode can be configured with different forwarding modes
Among them, protocol conversion means that HLS can pull streams and convert them to other protocol formats, which requires parsing of HLS data,
Forwarding means that the TS files in HLS are cached on the server and can be directly read when pulling streams from the server.
For example, if you want to only do pure forwarding for HLS and reduce CPU consumption, you can configure
hls:
relaymode: 1
Access http://localhost:8080/hls/index.html
Modify the domain name and port according to the actual situation