mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-05 14:56:56 +08:00
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
node_modules
|
node_modules
|
||||||
|
/.history
|
||||||
|
10
main.go
10
main.go
@@ -140,6 +140,7 @@ func (rtc *WebRTC) Play(streamPath string) bool {
|
|||||||
switch connectionState {
|
switch connectionState {
|
||||||
case ICEConnectionStateDisconnected:
|
case ICEConnectionStateDisconnected:
|
||||||
sub.Close()
|
sub.Close()
|
||||||
|
rtc.Close()
|
||||||
case ICEConnectionStateConnected:
|
case ICEConnectionStateConnected:
|
||||||
|
|
||||||
//rtc.videoTrack = rtc.GetSenders()[0].Track()
|
//rtc.videoTrack = rtc.GetSenders()[0].Track()
|
||||||
@@ -240,6 +241,15 @@ func (rtc *WebRTC) GetAnswer() ([]byte, error) {
|
|||||||
|
|
||||||
func run() {
|
func run() {
|
||||||
http.HandleFunc("/webrtc/play", func(w http.ResponseWriter, r *http.Request) {
|
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")
|
streamPath := r.URL.Query().Get("streamPath")
|
||||||
var offer SessionDescription
|
var offer SessionDescription
|
||||||
var rtc WebRTC
|
var rtc WebRTC
|
||||||
|
Reference in New Issue
Block a user