Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
825 B

// Package main contains an utility to download hls.js
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func do() error {
log.Println("downloading hls.js...")
buf, err := os.ReadFile("./hlsjsdownloader/VERSION")
if err != nil {
return err
}
version := string(buf[:len(buf)-1])
res, err := http.Get("https://cdn.jsdelivr.net/npm/hls.js@" + version + "/dist/hls.min.js")
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return fmt.Errorf("bad status code: %v", res.StatusCode)
}
buf, err = io.ReadAll(res.Body)
if err != nil {
return err
}
err = os.WriteFile("hls.min.js", buf, 0o644)
if err != nil {
return err
}
log.Println("ok")
return nil
}
func main() {
err := do()
if err != nil {
log.Printf("ERR: %v", err)
os.Exit(1)
}
}