Documentation ¶
Index ¶
- Variables
- type BaseMovie
- type BroadcastConf
- type Client
- func (c *Client) Broadcast(msg Message, conf ...BroadcastConf)
- 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
- func (c *Current) MarshalJSON() ([]byte, error)
- func (c *Current) Movie() MovieInfo
- func (c *Current) SetMovie(movie MovieInfo)
- func (c *Current) SetSeek(seek, timeDiff float64) Status
- func (c *Current) SetSeekRate(seek, rate, timeDiff float64) Status
- func (c *Current) SetStatus(playing bool, seek, rate, timeDiff float64) Status
- func (c *Current) Status() Status
- type ElementMessage
- type ElementMessageType
- 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 (h Room) ClientNum() int64
- func (r *Room) Close() error
- func (h Room) Closed() bool
- func (r *Room) CreateAt() time.Time
- 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) LateActiveTime() time.Time
- 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) ResetMaxInactivityTime(maxInactivityTime time.Duration)
- 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) 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 (h Room) UnRegClient(user *User) error
- func (r *Room) UpdateActiveTime()
- func (r *Room) UserList() (users []User)
- func (r *Room) Version() uint64
- type RoomConf
- 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) 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) MovieList() []*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 BaseMovie, 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") ErrAdminPassWordEmpty = errors.New("admin password is empty") )
View Source
var ( ErrUsernameEmpty = errors.New("user name is empty") ErrUserPasswordEmpty = errors.New("user password is empty") )
View Source
var (
ErrAlreadyClosed = fmt.Errorf("already closed")
)
Functions ¶
This section is empty.
Types ¶
type BroadcastConf ¶
type BroadcastConf func(*broadcastMessage)
func WithIgnoreID ¶
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) Broadcast ¶
func (c *Client) Broadcast(msg Message, conf ...BroadcastConf)
func (*Client) GetReadChan ¶
func (*Client) NextWriter ¶
func (c *Client) NextWriter(messageType int) (io.WriteCloser, error)
func (*Client) Unregister ¶
type Current ¶
type Current struct {
// contains filtered or unexported fields
}
func (*Current) MarshalJSON ¶
func (*Current) SetSeekRate ¶
type ElementMessage ¶
type ElementMessage struct { Type ElementMessageType `json:"type" yaml:"type"` Sender string `json:"sender,omitempty" yaml:"sender,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"` Seek float64 `json:"seek,omitempty" yaml:"seek,omitempty"` Rate float64 `json:"rate,omitempty" yaml:"rate,omitempty"` Current *Current `json:"current,omitempty" yaml:"current,omitempty"` PeopleNum int64 `json:"peopleNum,omitempty" yaml:"peopleNum,omitempty"` Time int64 `json:"time,omitempty" yaml:"time,omitempty"` }
func (*ElementMessage) MessageType ¶
func (em *ElementMessage) MessageType() int
func (*ElementMessage) String ¶
func (em *ElementMessage) String() string
type ElementMessageType ¶
type ElementMessageType int
const ( Error ElementMessageType = iota + 1 ChatMessage Play Pause CheckSeek TooFast TooSlow ChangeRate ChangeSeek ChangeCurrent ChangeMovieList ChangePeopleNum )
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 { BaseMovie PullKey string `json:"pullKey"` CreateAt int64 `json:"createAt"` LastEditAt int64 `json:"lastEditAt"` // contains filtered or unexported fields }
Url will be `PullKey` when Live and Proxy are true
func NewMovieWithBaseMovie ¶
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"` Url string `json:"url"` Name string `json:"name"` Live bool `json:"live"` Proxy bool `json:"proxy"` RtmpSource bool `json:"rtmpSource"` Type string `json:"type"` Headers map[string][]string `json:"headers"` PullKey string `json:"pullKey"` CreateAt int64 `json:"createAt"` LastEditAt int64 `json:"lastEditAt"` 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) ResetMaxInactivityTime ¶
func (*Room) SetPassword ¶
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 WithMaxInactivityTime ¶
func WithRootUser ¶
func WithVersion ¶
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) CheckPassword ¶
func (*User) CheckVersion ¶
func (*User) LastActTime ¶
func (*User) NewMovieWithBaseMovie ¶
func (*User) SetPassword ¶
func (*User) SetVersion ¶
func (*User) UpdateLastAct ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.