mirror of https://github.com/ossrs/srs.git
refine srs player to play hls.
parent
46a31f4884
commit
b2bd63e833
@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("FileWriter web server, post to /api/v1/flv to temp.flv")
|
||||
http.HandleFunc("/api/v1/flv", func(w http.ResponseWriter, r *http.Request){
|
||||
defer r.Body.Close()
|
||||
|
||||
var f *os.File
|
||||
var err error
|
||||
if f,err = os.OpenFile("temp.flv", os.O_RDWR|os.O_APPEND|os.O_CREATE, os.ModePerm); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var written int64
|
||||
written,err = io.Copy(f, r.Body)
|
||||
fmt.Println(fmt.Sprintf("write to file temp.flv, %v bytes", written))
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
})
|
||||
_ = http.ListenAndServe(fmt.Sprintf(":8088"), nil)
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package
|
||||
{
|
||||
public class Consts
|
||||
{
|
||||
// refresh every ts_fragment_seconds*M3u8RefreshRatio
|
||||
public static var M3u8RefreshRatio:Number = 0.5;
|
||||
|
||||
// parse ts every this ms.
|
||||
public static var TsParseAsyncInterval:Number = 80;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue