mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-07 04:49:43 +00:00
33 lines
828 B
Go
33 lines
828 B
Go
package carrier
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pion/webrtc/v4"
|
|
)
|
|
|
|
// ByteStream is a carrier capability for bidirectional byte transport.
|
|
type ByteStream interface {
|
|
Connect(ctx context.Context) error
|
|
Send(data []byte) error
|
|
Close() error
|
|
SetReconnectCallback(cb func())
|
|
SetShouldReconnect(fn func() bool)
|
|
SetEndedCallback(cb func(string))
|
|
WatchConnection(ctx context.Context)
|
|
CanSend() bool
|
|
}
|
|
|
|
// VideoTrack is a carrier capability for bidirectional video transport.
|
|
type VideoTrack interface {
|
|
Connect(ctx context.Context) error
|
|
Close() error
|
|
SetReconnectCallback(cb func())
|
|
SetShouldReconnect(fn func() bool)
|
|
SetEndedCallback(cb func(string))
|
|
WatchConnection(ctx context.Context)
|
|
CanSend() bool
|
|
AddTrack(track webrtc.TrackLocal) error
|
|
SetTrackHandler(cb func(*webrtc.TrackRemote, *webrtc.RTPReceiver))
|
|
}
|