Documentation
¶
Index ¶
- Variables
- type BaseMovieInfo
- type BroadcastConf
- type Client
- func (c *Client) Broadcast(msg Message, conf ...BroadcastConf) error
- func (c *Client) Close() error
- func (c *Client) Closed() bool
- func (c *Client) GetReadChan() <-chan Message
- func (c *Client) NextReader() (int, io.Reader, error)
- func (c *Client) NextWriter(messageType int) (io.WriteCloser, error)
- func (c *Client) Room() *Room
- func (c *Client) Send(msg Message) error
- func (c *Client) Unregister() error
- func (c *Client) User() *User
- func (c *Client) Username() string
- type Current
- type ElementJsonMessage
- type ElementMessage
- type FormatErrMovieAlreadyExist
- type FormatErrMovieNotFound
- type Message
- type Movie
- type MovieConf
- type MovieInfo
- type PingMessage
- type Room
- func (r *Room) AddUser(u *User) error
- func (r *Room) Broadcast(msg Message, conf ...BroadcastConf) error
- func (r *Room) ChangeCurrentMovie(id uint64) error
- func (r *Room) CheckPassword(password string) (ok bool)
- func (r *Room) CheckVersion(version uint64) bool
- func (m Room) Clear() error
- func (r *Room) ClearMovies() (err error)
- func (r *Room) ClientNum() int64
- func (r *Room) Close() error
- func (r *Room) Closed() bool
- func (r *Room) CreatedAt() int64
- func (r *Room) Current() *Current
- func (r *Room) DelMovie(id ...uint64) error
- func (r *Room) DelUser(id string) error
- func (m Room) GetAndClear() (movies []*Movie)
- func (m Room) GetAndDelMovie(id ...uint64) (movies []*Movie, err error)
- func (r *Room) GetAndDelUser(id string) (u *User, ok bool)
- func (m Room) GetMovie(id uint64) (movie *Movie, err error)
- func (m Room) GetMovieWithPullKey(pullKey string) (movie *Movie, err error)
- func (r *Room) GetOrNewUser(id string, password string, conf ...UserConf) (*User, error)
- func (r *Room) GetUser(id string) (*User, error)
- func (m Room) HasMovie(id uint64) bool
- func (r *Room) Hidden() bool
- func (r *Room) Id() string
- func (r *Room) Init()
- func (r *Room) LateActiveTime() int64
- func (m Room) MovieList() (movies []MovieInfo)
- func (r *Room) NeedPassword() bool
- func (r *Room) NewLiveChannel(channel string) (*rtmps.Channel, error)
- func (r *Room) NewUser(id string, password string, conf ...UserConf) (*User, error)
- func (r *Room) PushBackMovie(movie *Movie) error
- func (r *Room) PushFrontMovie(movie *Movie) error
- func (m Room) Range(f func(e *dllist.Element[*Movie]) bool) (interrupt bool)
- func (r *Room) RegClient(user *User, conn *websocket.Conn) (*Client, error)
- func (r *Room) RootUser() *User
- func (r *Room) Serve()
- func (r *Room) SetHidden(hidden bool)
- func (r *Room) SetPassword(password string) error
- func (r *Room) SetPasswordAndCloseAll(password string) error
- func (r *Room) SetRootUser(u *User)
- func (r *Room) SetSeekRate(seek, rate, timeDiff float64) Status
- func (r *Room) SetStatus(playing bool, seek, rate, timeDiff float64) Status
- func (r *Room) SetVersion(version uint64)
- func (r *Room) Start()
- func (r *Room) SwapMovie(id1, id2 uint64) error
- func (r *Room) UnRegClient(user *User) error
- func (r *Room) UpdateActiveTime()
- func (r *Room) UserList() (users []User)
- func (r *Room) Version() uint64
- type RoomConf
- type Rooms
- func (rs *Rooms) CreateRoom(id string, password string, s *rtmps.Server, conf ...RoomConf) (*Room, error)
- func (rs *Rooms) DelRoom(id string) error
- func (rs *Rooms) GetRoom(id string) (*Room, error)
- func (rs *Rooms) HasRoom(id string) bool
- func (rs *Rooms) List() (rooms []*Room)
- func (rs *Rooms) ListHidden() (rooms []*Room)
- func (rs *Rooms) ListNonHidden() (rooms []*Room)
- type Status
- type User
- func (u *User) Broadcast(msg Message, conf ...BroadcastConf) error
- func (u *User) CheckPassword(password string) bool
- func (u *User) CheckVersion(version uint64) bool
- func (u *User) CloseHub()
- func (u *User) EditMovie(id uint64, movie BaseMovieInfo) error
- func (u *User) IsAdmin() bool
- func (u *User) IsRoot() bool
- func (u *User) LastAct() int64
- func (u *User) LastActTime() time.Time
- func (u *User) Movie(id uint64) (*MovieInfo, error)
- func (u *User) Movies() []*MovieInfo
- func (u *User) Name() string
- func (u *User) NewMovie(url string, name string, type_ string, live bool, proxy bool, rtmpSource bool, ...) (*Movie, error)
- func (u *User) NewMovieWithBaseMovie(baseMovie BaseMovieInfo, conf ...MovieConf) (*Movie, error)
- func (u *User) RegClient(conn *websocket.Conn) (*Client, error)
- func (u *User) Room() *Room
- func (u *User) SetAdmin(admin bool)
- func (u *User) SetPassword(password string) error
- func (u *User) SetVersion(version uint64)
- func (u *User) UpdateLastAct() int64
- func (u *User) Version() uint64
- type UserConf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoomIdEmpty = errors.New("roomid is empty") ErrRoomIdTooLong = errors.New("roomid is too long") ErrAdminPassWordEmpty = errors.New("admin password is empty") )
View Source
var ( ErrRoomNotFound = errors.New("room not found") ErrUserNotFound = errors.New("user not found") ErrRoomAlreadyExist = errors.New("room already exist") )
View Source
var ( ErrUsernameEmpty = errors.New("user name is empty") ErrUsernameTooLong = errors.New("user name is too long") ErrUserPasswordEmpty = errors.New("user password is empty") ErrUserPasswordTooLong = errors.New("user password is too long") )
View Source
var (
ErrAlreadyClosed = fmt.Errorf("already closed")
)
Functions ¶
This section is empty.
Types ¶
type BaseMovieInfo ¶ added in v0.2.4
type BroadcastConf ¶
type BroadcastConf func(*broadcastMessage)
func WithIgnoreId ¶ added in v0.2.4
func WithIgnoreId(id ...string) BroadcastConf
func WithSendToSelf ¶
func WithSendToSelf() BroadcastConf
func WithSender ¶
func WithSender(sender string) BroadcastConf
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetReadChan ¶
func (*Client) NextWriter ¶
func (c *Client) NextWriter(messageType int) (io.WriteCloser, error)
func (*Client) Unregister ¶
type Current ¶
func (*Current) SetSeekRate ¶
type ElementJsonMessage ¶ added in v0.2.4
type ElementJsonMessage struct {
*pb.ElementMessage
}
func (*ElementJsonMessage) Encode ¶ added in v0.2.4
func (em *ElementJsonMessage) Encode(w io.Writer) error
func (*ElementJsonMessage) MessageType ¶ added in v0.2.4
func (em *ElementJsonMessage) MessageType() int
func (*ElementJsonMessage) String ¶ added in v0.2.4
func (em *ElementJsonMessage) String() string
type ElementMessage ¶
type ElementMessage struct {
*pb.ElementMessage
}
func (*ElementMessage) MessageType ¶
func (em *ElementMessage) MessageType() int
func (*ElementMessage) String ¶
func (em *ElementMessage) String() string
type FormatErrMovieAlreadyExist ¶
type FormatErrMovieAlreadyExist uint64
func (FormatErrMovieAlreadyExist) Error ¶
func (e FormatErrMovieAlreadyExist) Error() string
type FormatErrMovieNotFound ¶
type FormatErrMovieNotFound uint64
func (FormatErrMovieNotFound) Error ¶
func (e FormatErrMovieNotFound) Error() string
type Movie ¶
type Movie struct {
BaseMovieInfo
PullKey string `json:"pullKey"`
CreatedAt int64 `json:"createdAt"`
// contains filtered or unexported fields
}
Url will be `PullKey` when Live and Proxy are true
func NewMovieWithBaseMovie ¶
func NewMovieWithBaseMovie(id uint64, baseMovie BaseMovieInfo, conf ...MovieConf) (*Movie, error)
func (*Movie) SetChannel ¶
func (*Movie) SetCreator ¶
type MovieConf ¶
type MovieConf func(m *Movie)
func WithChannel ¶
func WithCreator ¶
func WithPullKey ¶
type MovieInfo ¶
type MovieInfo struct {
Id uint64 `json:"id"`
BaseMovieInfo BaseMovieInfo `json:"base"`
PullKey string `json:"pullKey"`
CreatedAt int64 `json:"createdAt"`
Creator string `json:"creator"`
}
type PingMessage ¶
type PingMessage struct{}
func (*PingMessage) MessageType ¶
func (pm *PingMessage) MessageType() int
func (*PingMessage) String ¶
func (pm *PingMessage) String() string
type Room ¶
type Room struct {
// contains filtered or unexported fields
}
func (*Room) ChangeCurrentMovie ¶
Seek will be set to 0
func (*Room) CheckPassword ¶
func (*Room) CheckVersion ¶
func (*Room) ClearMovies ¶
func (Room) GetAndClear ¶
func (m Room) GetAndClear() (movies []*Movie)
func (Room) GetAndDelMovie ¶
func (Room) GetMovieWithPullKey ¶
func (*Room) GetOrNewUser ¶
func (*Room) LateActiveTime ¶
func (*Room) NeedPassword ¶
func (*Room) PushBackMovie ¶
func (*Room) PushFrontMovie ¶
func (*Room) SetPassword ¶
func (*Room) SetPasswordAndCloseAll ¶ added in v0.2.4
func (*Room) SetRootUser ¶
func (*Room) SetSeekRate ¶
func (*Room) SetVersion ¶
func (*Room) UnRegClient ¶
func (*Room) UpdateActiveTime ¶
func (r *Room) UpdateActiveTime()
type RoomConf ¶
type RoomConf func(r *Room)
func WithHidden ¶
func WithRootUser ¶
func WithVersion ¶
type Rooms ¶ added in v0.2.4
type Rooms struct {
// contains filtered or unexported fields
}
func (*Rooms) CreateRoom ¶ added in v0.2.4
func (*Rooms) ListHidden ¶ added in v0.2.4
func (*Rooms) ListNonHidden ¶ added in v0.2.4
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) CheckPassword ¶
func (*User) CheckVersion ¶
func (*User) EditMovie ¶ added in v0.2.4
func (u *User) EditMovie(id uint64, movie BaseMovieInfo) error
func (*User) LastActTime ¶
func (*User) NewMovieWithBaseMovie ¶
func (u *User) NewMovieWithBaseMovie(baseMovie BaseMovieInfo, conf ...MovieConf) (*Movie, error)
func (*User) SetPassword ¶
func (*User) SetVersion ¶
func (*User) UpdateLastAct ¶
Click to show internal directories.
Click to hide internal directories.