livekit

package
v0.1.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2025 License: AGPL-3.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LivekitParams = livekitParams{}

Functions

func NewLocalFileTrack

func NewLocalFileTrack(file string) (*lksdk.LocalSampleTrack, error)

NewLocalFileTrack 视频文件变成轨道

ffmpeg -i <input.mp4> \
 -c:v libvpx -keyint_min 120 -qmax 50 -maxrate 2M -b:v 1M <output.ivf> \
 -c:a libopus -page_duration 20000 -vn <output.ogg>

ffmpeg -i <input.mp4> \
 -c:v libx264 -bsf:v h264_mp4toannexb -b:v 2M -profile baseline -pix_fmt yuv420p \
   -x264-params keyint=120 -max_delay 0 -bf 0 <output.h264> \
 -c:a libopus -page_duration 20000 -vn <output.ogg>

func NewLocalReaderTrack

func NewLocalReaderTrack(in io.ReadCloser, mime string) (*lksdk.LocalSampleTrack, error)

NewLocalReaderTrack 视频流变成轨道

Types

type RoomServiceClient

type RoomServiceClient struct {
	// contains filtered or unexported fields
}

RoomServiceClient 连接livekit服务器的客户端,可以创建房间,对服务器的房间进行管理 可以在控制层发布成restful服务

func GetRoomServiceClient

func GetRoomServiceClient() *RoomServiceClient

GetRoomServiceClient 创建房间服务的客户端,这个客户端连接到livekit sfu服务器 有权限创建房间,因此需要相应的APIKey和APISecret

func (*RoomServiceClient) Connect

func (svc *RoomServiceClient) Connect(host string, apiKey string, apiSecret string, roomName string, identity string) (*lksdk.Room, error)

Connect 连接房间,设置回调函数

func (*RoomServiceClient) CreateRoom

func (svc *RoomServiceClient) CreateRoom(roomName string, emptyTimeout uint32, maxParticipants uint32, nodeId string) (*livekit.Room, error)

CreateRoom 创建新的房间,

func (*RoomServiceClient) CreateToken

func (svc *RoomServiceClient) CreateToken(roomName, identity string, name string, duration time.Duration, md string) (string, error)

CreateToken 创建新的token,这个token在客户端连接房间的时候要使用 所以每个参与者都会有一个token

func (*RoomServiceClient) CreateTokens

func (svc *RoomServiceClient) CreateTokens(roomName string, identities []string, names []string, duration time.Duration, md string) ([]string, error)

func (*RoomServiceClient) DeleteRoom

func (svc *RoomServiceClient) DeleteRoom(roomName string) (*livekit.DeleteRoomResponse, error)

DeleteRoom 删除房间,所以参与人离开

func (*RoomServiceClient) Disconnect

func (svc *RoomServiceClient) Disconnect(room *lksdk.Room)

Disconnect 断开房间的连接

func (*RoomServiceClient) GetParticipant

func (svc *RoomServiceClient) GetParticipant(roomName string, identity string) (*livekit.ParticipantInfo, error)

GetParticipant 列出房间的参与人的详细信息

func (*RoomServiceClient) ListParticipants

func (svc *RoomServiceClient) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error)

ListParticipants 列出房间的参与人

func (*RoomServiceClient) ListRooms

func (svc *RoomServiceClient) ListRooms(roomNames []string) ([]*livekit.Room, error)

ListRooms 列出房间

func (*RoomServiceClient) MutePublishedTrack

func (svc *RoomServiceClient) MutePublishedTrack(roomName string, identity string, trackSid string, muted bool) (*livekit.MuteRoomTrackResponse, error)

MutePublishedTrack 关闭打开轨道的声音

func (*RoomServiceClient) PublishTrack

func (svc *RoomServiceClient) PublishTrack(room *lksdk.Room, name string, track *lksdk.LocalSampleTrack, videoWidth int, videoHeight int) (*lksdk.LocalTrackPublication, error)

PublishTrack 把文件或者流轨道发布到房间

func (*RoomServiceClient) RemoveParticipant

func (svc *RoomServiceClient) RemoveParticipant(roomName string, identity string) (*livekit.RemoveParticipantResponse, error)

RemoveParticipant 参与人从房间离开

func (*RoomServiceClient) UpdateParticipant

func (svc *RoomServiceClient) UpdateParticipant(roomName string, identity string,
	metadata string, permission *livekit.ParticipantPermission) (*livekit.ParticipantInfo, error)

func (*RoomServiceClient) UpdateRoomMetadata

func (svc *RoomServiceClient) UpdateRoomMetadata(roomName string, metadata string) (*livekit.Room, error)

func (*RoomServiceClient) UpdateSubscriptions

func (svc *RoomServiceClient) UpdateSubscriptions(roomName string, identity string, trackSids []string,
	subscribe bool) (*livekit.UpdateSubscriptionsResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL