I use Http.fileSever() to upload a m3u8 file and some ts file to a server.Now,I request them and read them by ioutil.ReadAll.What should I do to play the m3u8 file. I tried to only request the m3u8 file,but I found I can not play it by ffplay. This is my request code
res, err := client.Get(url)
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(res.Body)
defer res.Body.Close()
if err != nil {
log.Fatal(err)
}
fmt.Println(string(data))
And this is what I got:
<pre>
<a href="origin.m3u8">origin.m3u8</a>
<a href="origin0.ts">origin0.ts</a>
<a href="origin1.ts">origin1.ts</a>
</pre>
What should I do to play the m3u8 file. Actually,I can play this m3u8 file,if I use ffplay to request the url directory like this:
url := "http://192.168.0.110:8080/origin.m3u8"
res, err := http.Get(url)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := ioutil.ReadAll(res.Body)
c := exec.Command("cmd", "/c", "ffplay", url)
if err := c.Run(); err != nil {
fmt.Println("Error: ", err)
}
But now,I`m try to implement a p2p system so that I only get data from client but not acrossing url