install go2rtc on bob

This commit is contained in:
2026-04-04 19:36:14 +02:00
parent f0b56e63d1
commit ccf88187b8
537 changed files with 69213 additions and 0 deletions
@@ -0,0 +1,44 @@
package yandex
import (
"net/url"
"github.com/AlexxIT/go2rtc/internal/streams"
"github.com/AlexxIT/go2rtc/pkg/core"
"github.com/AlexxIT/go2rtc/pkg/yandex"
)
func Init() {
streams.HandleFunc("yandex", func(source string) (core.Producer, error) {
u, err := url.Parse(source)
if err != nil {
return nil, err
}
query := u.Query()
token := query.Get("x_token")
session, err := yandex.GetSession(token)
if err != nil {
return nil, err
}
deviceID := query.Get("device_id")
if query.Has("snapshot") {
rawURL, err := session.GetSnapshotURL(deviceID)
if err != nil {
return nil, err
}
rawURL += "/current.jpg?" + query.Get("snapshot") + "#header=Cookie:" + session.GetCookieString(rawURL)
return streams.GetProducer(rawURL)
}
room, err := session.WebrtcCreateRoom(deviceID)
if err != nil {
return nil, err
}
return goloomClient(room.ServiceUrl, room.ServiceName, room.RoomId, room.ParticipantId, room.Credentials)
})
}