mirror of
https://github.com/Monibuca/plugin-jessica.git
synced 2025-09-26 20:11:15 +08:00
跟随引擎修改
This commit is contained in:
6
main.go
6
main.go
@@ -2,7 +2,6 @@ package jessica
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/Monibuca/engine/v3"
|
||||
"github.com/Monibuca/utils/v3"
|
||||
@@ -16,8 +15,6 @@ var config struct {
|
||||
ListenAddrTLS string
|
||||
}
|
||||
|
||||
var publicPath string
|
||||
|
||||
func init() {
|
||||
plugin := &PluginConfig{
|
||||
Name: "Jessica",
|
||||
@@ -25,7 +22,6 @@ func init() {
|
||||
Run: run,
|
||||
}
|
||||
InstallPlugin(plugin)
|
||||
publicPath = filepath.Join(plugin.Dir, "ui", "public")
|
||||
}
|
||||
func run() {
|
||||
if config.ListenAddr != "" || config.ListenAddrTLS != "" {
|
||||
@@ -35,4 +31,4 @@ func run() {
|
||||
utils.Print(Green("Jessica start reuse gateway port"))
|
||||
http.HandleFunc("/jessica/", WsHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ func WsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
baseStream := Subscriber{Sign: sign, ID: r.RemoteAddr, Type: "Jessica"}
|
||||
baseStream := Subscriber{Sign: sign, ID: r.RemoteAddr, Type: "Jessica", Ctx2: r.Context()}
|
||||
if isFlv {
|
||||
baseStream.Type = "JessicaFlv"
|
||||
}
|
||||
@@ -41,7 +41,6 @@ func WsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
for _, err := conn.Read(b); err == nil; _, err = conn.Read(b) {
|
||||
|
||||
}
|
||||
baseStream.Close()
|
||||
}()
|
||||
if baseStream.Subscribe(streamPath) == nil {
|
||||
at := baseStream.GetAudioTrack("aac")
|
||||
@@ -103,7 +102,7 @@ func WsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
writeAV(codec.FLV_TAG_TYPE_AUDIO, pack.Timestamp, payload)
|
||||
}
|
||||
}
|
||||
baseStream.Play(r.Context(), at, vt)
|
||||
baseStream.Play(at, vt)
|
||||
} else {
|
||||
w.WriteHeader(404)
|
||||
}
|
||||
|
Reference in New Issue
Block a user