mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-09-27 03:06:29 +08:00
修改播放逻辑
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.idea
|
||||
.vscode
|
||||
node_modules
|
||||
node_modules
|
||||
/.history
|
||||
|
9
main.go
9
main.go
@@ -240,6 +240,15 @@ func (rtc *WebRTC) GetAnswer() ([]byte, error) {
|
||||
|
||||
func run() {
|
||||
http.HandleFunc("/webrtc/play", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
origin := r.Header["Origin"]
|
||||
if len(origin) == 0 {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
} else {
|
||||
w.Header().Set("Access-Control-Allow-Origin", origin[0])
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
streamPath := r.URL.Query().Get("streamPath")
|
||||
var offer SessionDescription
|
||||
var rtc WebRTC
|
||||
|
Reference in New Issue
Block a user