Documentation
¶
Index ¶
- func GetDeviceID() (string, error)
- type AcFunLive
- func (ac *AcFunLive) AddManager(managerUID int64) error
- func (ac *AcFunLive) AuthorKick(liveID string, kickedUID int64) error
- func (ac *AcFunLive) CancelWearMedal() error
- func (ac *AcFunLive) CancelWearMedalWithLiverUID(liverUID int64) error
- func (ac *AcFunLive) ChangeTitleAndCover(title, coverFile, liveID string) error
- func (ac *AcFunLive) CheckLiveAuth() (bool, error)
- func (ac *AcFunLive) CopyEventHandlers(anotherAC *AcFunLive)
- func (ac *AcFunLive) DeleteManager(managerUID int64) error
- func (ac *AcFunLive) FetchKuaiShouAPI(url string, form *fasthttp.Args, sign bool) (body []byte, e error)
- func (ac *AcFunLive) GetAllGiftList() (map[int64]GiftDetail, error)
- func (ac *AcFunLive) GetAllKickHistory(liveID string) ([]KickHistory, error)
- func (ac *AcFunLive) GetAllLiveList() ([]UserLiveInfo, error)
- func (ac *AcFunLive) GetBillboard(uid int64) ([]BillboardUser, error)
- func (ac *AcFunLive) GetDanmu() (danmu []DanmuMessage)
- func (ac *AcFunLive) GetDeviceID() string
- func (ac *AcFunLive) GetGiftList(liveID string) (map[int64]GiftDetail, error)
- func (ac *AcFunLive) GetKickHistory(liveID string, count, page int) (list []KickHistory, lastPage bool, e error)
- func (ac *AcFunLive) GetLiveCutInfo(uid int64, liveID string) (*LiveCutInfo, error)
- func (ac *AcFunLive) GetLiveCutStatus() (bool, error)
- func (ac *AcFunLive) GetLiveData(days int) (*LiveData, error)
- func (ac *AcFunLive) GetLiveID() string
- func (ac *AcFunLive) GetLiveInfo() *LiveInfo
- func (ac *AcFunLive) GetLiveList(count, page int) (liveList []UserLiveInfo, lastPage bool, err error)
- func (ac *AcFunLive) GetLiveStatus() (*LiveStatus, error)
- func (ac *AcFunLive) GetLiveTypeList() ([]LiveType, error)
- func (ac *AcFunLive) GetLiverUID() int64
- func (ac *AcFunLive) GetLuckList(liveID, redpackID, redpackBizUnit string) ([]LuckyUser, error)
- func (ac *AcFunLive) GetManagerList() ([]Manager, error)
- func (ac *AcFunLive) GetMedalDetail(uid int64) (*MedalDetail, error)
- func (ac *AcFunLive) GetMedalList() ([]Medal, error)
- func (ac *AcFunLive) GetMedalRankList(uid int64) (medalRankList *MedalRankList, e error)
- func (ac *AcFunLive) GetPlayback(liveID string) (*Playback, error)
- func (ac *AcFunLive) GetPushConfig() (*PushConfig, error)
- func (ac *AcFunLive) GetStreamInfo() *StreamInfo
- func (ac *AcFunLive) GetSummary(liveID string) (*Summary, error)
- func (ac *AcFunLive) GetTokenInfo() *TokenInfo
- func (ac *AcFunLive) GetTranscodeInfo(streamName string) ([]TranscodeInfo, error)
- func (ac *AcFunLive) GetUserID() int64
- func (ac *AcFunLive) GetUserInfo(uid int64) (*UserProfileInfo, error)
- func (ac *AcFunLive) GetUserLiveInfo(uid int64) (*UserLiveInfo, error)
- func (ac *AcFunLive) GetWalletBalance() (accoins int, bananas int, e error)
- func (ac *AcFunLive) GetWatchingList(liveID string) ([]WatchingUser, error)
- func (ac *AcFunLive) ManagerKick(liveID string, kickedUID int64) error
- func (ac *AcFunLive) OnAuthorChatAccept(handler func(*AcFunLive, *AuthorChatAccept))
- func (ac *AcFunLive) OnAuthorChatCall(handler func(*AcFunLive, *AuthorChatCall))
- func (ac *AcFunLive) OnAuthorChatChangeSoundConfig(handler func(*AcFunLive, *AuthorChatChangeSoundConfig))
- func (ac *AcFunLive) OnAuthorChatEnd(handler func(*AcFunLive, *AuthorChatEnd))
- func (ac *AcFunLive) OnAuthorChatReady(handler func(*AcFunLive, *AuthorChatReady))
- func (ac *AcFunLive) OnBananaCount(handler func(ac *AcFunLive, allBananaCount string))
- func (ac *AcFunLive) OnChatAccept(handler func(*AcFunLive, *ChatAccept))
- func (ac *AcFunLive) OnChatCall(handler func(*AcFunLive, *ChatCall))
- func (ac *AcFunLive) OnChatEnd(handler func(*AcFunLive, *ChatEnd))
- func (ac *AcFunLive) OnChatReady(handler func(*AcFunLive, *ChatReady))
- func (ac *AcFunLive) OnComment(handler func(*AcFunLive, *Comment))
- func (ac *AcFunLive) OnDanmuStop(handler func(*AcFunLive, error))
- func (ac *AcFunLive) OnDisplayInfo(handler func(*AcFunLive, *DisplayInfo))
- func (ac *AcFunLive) OnEnterRoom(handler func(*AcFunLive, *EnterRoom))
- func (ac *AcFunLive) OnFollowAuthor(handler func(*AcFunLive, *FollowAuthor))
- func (ac *AcFunLive) OnGift(handler func(*AcFunLive, *Gift))
- func (ac *AcFunLive) OnJoinClub(handler func(*AcFunLive, *JoinClub))
- func (ac *AcFunLive) OnKickedOut(handler func(ac *AcFunLive, kickedOutReason string))
- func (ac *AcFunLive) OnLike(handler func(*AcFunLive, *Like))
- func (ac *AcFunLive) OnManagerState(handler func(*AcFunLive, ManagerState))
- func (ac *AcFunLive) OnRecentComment(handler func(*AcFunLive, []Comment))
- func (ac *AcFunLive) OnRedpackList(handler func(*AcFunLive, []Redpack))
- func (ac *AcFunLive) OnRichText(handler func(*AcFunLive, *RichText))
- func (ac *AcFunLive) OnShareLive(handler func(*AcFunLive, *ShareLive))
- func (ac *AcFunLive) OnThrowBanana(handler func(*AcFunLive, *ThrowBanana))
- func (ac *AcFunLive) OnTopUsers(handler func(*AcFunLive, []TopUser))
- func (ac *AcFunLive) OnViolationAlert(handler func(ac *AcFunLive, violationContent string))
- func (ac *AcFunLive) SetLiveCutStatus(canCut bool) error
- func (ac *AcFunLive) SetLiverUID(uid int64) (newAC *AcFunLive, err error)
- func (ac *AcFunLive) StartDanmu(ctx context.Context, event bool) <-chan error
- func (ac *AcFunLive) StartLive(title, coverFile, streamName string, portrait, panoramic bool, ...) (liveID string, e error)
- func (ac *AcFunLive) StopLive(liveID string) (*StopPushInfo, error)
- func (ac *AcFunLive) WearMedal(uid int64) error
- func (ac *AcFunLive) WriteASS(ctx context.Context, s SubConfig, file string, newFile bool)
- type AuthorChatAccept
- type AuthorChatCall
- type AuthorChatChangeSoundConfig
- type AuthorChatEnd
- type AuthorChatPlayerInfo
- type AuthorChatReady
- type BillboardUser
- type ChatAccept
- type ChatCall
- type ChatEnd
- type ChatEndType
- type ChatMediaType
- type ChatReady
- type Comment
- type Cookies
- type DailyData
- type DanmuClient
- type DanmuClientType
- type DanmuCommon
- type DanmuMessage
- type DisplayInfo
- type DrawGiftInfo
- type DrawPoint
- type EnterRoom
- type FollowAuthor
- type Gift
- type GiftDetail
- type JoinClub
- type KickHistory
- type Like
- type LiveCutInfo
- type LiveData
- type LiveDetail
- type LiveInfo
- type LiveSchedule
- type LiveStat
- type LiveStatus
- type LiveType
- type LuckyUser
- type Manager
- type ManagerState
- type ManagerType
- type Medal
- type MedalDegree
- type MedalDetail
- type MedalInfo
- type MedalRankList
- type Option
- type Playback
- type PushConfig
- type QRCode
- type Redpack
- type RedpackDisplayStatus
- type RichText
- type RichTextImage
- type RichTextPlain
- type RichTextSegment
- type RichTextUserInfo
- type ShareLive
- type SharePlatformType
- type SoundConfigChangeType
- type StopPushInfo
- type StreamInfo
- type StreamURL
- type SubConfig
- type Summary
- type TCPDanmuClient
- func (client *TCPDanmuClient) Close(message string) error
- func (client *TCPDanmuClient) Dial(address string) error
- func (client *TCPDanmuClient) NewDanmuClient() DanmuClient
- func (client *TCPDanmuClient) Read(p []byte) (n int, err error)
- func (client *TCPDanmuClient) Type() DanmuClientType
- func (client *TCPDanmuClient) Write(p []byte) (n int, err error)
- type ThrowBanana
- type TokenInfo
- type TopUser
- type TranscodeInfo
- type UserInfo
- type UserLiveInfo
- type UserMedalInfo
- type UserProfile
- type UserProfileInfo
- type WatchingUser
- type WebSocketDanmuClient
- func (client *WebSocketDanmuClient) Close(message string) error
- func (client *WebSocketDanmuClient) Dial(address string) error
- func (client *WebSocketDanmuClient) NewDanmuClient() DanmuClient
- func (client *WebSocketDanmuClient) Read(p []byte) (n int, err error)
- func (client *WebSocketDanmuClient) Type() DanmuClientType
- func (client *WebSocketDanmuClient) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AcFunLive ¶
type AcFunLive struct {
// contains filtered or unexported fields
}
AcFunLive 就是直播间弹幕系统相关信息,支持并行
func NewAcFunLive ¶
NewAcFunLive 新建一个 *AcFunLive
func (*AcFunLive) AddManager ¶
AddManager 主播添加房管,需要登陆 AcFun 帐号
func (*AcFunLive) AuthorKick ¶
AuthorKick 主播踢人,需要登陆 AcFun 帐号,需要设置主播 uid
func (*AcFunLive) CancelWearMedal ¶
CancelWearMedal 取消佩戴守护徽章,需要登陆 AcFun 帐号
func (*AcFunLive) CancelWearMedalWithLiverUID ¶
CancelWearMedalWithLiverUID 取消佩戴守护徽章,需要登陆 AcFun 帐号,liverUID 必须是登陆帐号正在佩戴的守护徽章的主播 uid
func (*AcFunLive) ChangeTitleAndCover ¶
ChangeTitleAndCover 更改直播间标题和封面,coverFile 为直播间封面图片(可以是 gif)的本地路径或网络链接。 title 为空时会没有标题,coverFile 为空时只更改标题,需要登陆主播的 AcFun 帐号。
func (*AcFunLive) CheckLiveAuth ¶
CheckLiveAuth 检测登陆帐号是否有直播权限,需要登陆主播的 AcFun 帐号
func (*AcFunLive) CopyEventHandlers ¶
CopyEventHandlers 弹幕获取采用事件响应模式时复制 anotherAC 的事件处理函数到 ac
func (*AcFunLive) DeleteManager ¶
DeleteManager 主播删除房管,需要登陆 AcFun 帐号
func (*AcFunLive) FetchKuaiShouAPI ¶
func (ac *AcFunLive) FetchKuaiShouAPI(url string, form *fasthttp.Args, sign bool) (body []byte, e error)
FetchKuaiShouAPI 获取快手 API 的响应,测试用
func (*AcFunLive) GetAllGiftList ¶
func (ac *AcFunLive) GetAllGiftList() (map[int64]GiftDetail, error)
GetAllGiftList 返回全部礼物的数据
func (*AcFunLive) GetAllKickHistory ¶
func (ac *AcFunLive) GetAllKickHistory(liveID string) ([]KickHistory, error)
GetAllKickHistory 返回主播正在直播的那一场踢人的全部历史记录,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetAllLiveList ¶
func (ac *AcFunLive) GetAllLiveList() ([]UserLiveInfo, error)
GetAllLiveList 返回全部正在直播的直播间列表
func (*AcFunLive) GetBillboard ¶
func (ac *AcFunLive) GetBillboard(uid int64) ([]BillboardUser, error)
GetBillboard 返回指定 uid 的主播最近七日内的礼物贡献榜前 50 名观众的详细信息
func (*AcFunLive) GetDanmu ¶
func (ac *AcFunLive) GetDanmu() (danmu []DanmuMessage)
GetDanmu 返回弹幕数据 danmu,danmu 为 nil 时说明弹幕获取结束(出现错误或者主播下播),需要先调用 StartDanmu(ctx, false)。 一个 AcFunLive 只能同时调用 GetDanmu() 一次。
func (*AcFunLive) GetGiftList ¶
func (ac *AcFunLive) GetGiftList(liveID string) (map[int64]GiftDetail, error)
GetGiftList 返回指定主播直播间的礼物数据
func (*AcFunLive) GetKickHistory ¶
func (ac *AcFunLive) GetKickHistory(liveID string, count, page int) (list []KickHistory, lastPage bool, e error)
GetKickHistory 返回主播正在直播的那一场踢人的历史记录,count 为每页的数量,page 为第几页(从 0 开始数起),lastPage 说明是否最后一页,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetLiveCutInfo ¶
func (ac *AcFunLive) GetLiveCutInfo(uid int64, liveID string) (*LiveCutInfo, error)
GetLiveCutInfo 获取 uid 指定主播的直播剪辑信息,只在主播直播时才能请求,需要直播的 liveID,需要登陆 AcFun 帐号
func (*AcFunLive) GetLiveCutStatus ¶
GetLiveCutStatus 查询是否允许观众剪辑直播录像,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetLiveData ¶
GetLiveData 返回前 days 日到目前为止所有直播的统计数据,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetLiveInfo ¶
GetLiveInfo 返回直播间的状态信息,需要先调用 StartDanmu(ctx, false)
func (*AcFunLive) GetLiveList ¶
func (ac *AcFunLive) GetLiveList(count, page int) (liveList []UserLiveInfo, lastPage bool, err error)
GetLiveList 返回正在直播的直播间列表,count 为每页的直播间数量,page 为第几页(从 0 开始数起),lastPage 说明是否最后一页
func (*AcFunLive) GetLiveStatus ¶
func (ac *AcFunLive) GetLiveStatus() (*LiveStatus, error)
GetLiveStatus 返回直播状态,需要登陆主播的 AcFun 帐号并启动直播后调用
func (*AcFunLive) GetLiveTypeList ¶
GetLiveTypeList 返回直播分类列表
func (*AcFunLive) GetLiverUID ¶
GetLiverUID 返回主播的 uid,有可能是 0
func (*AcFunLive) GetLuckList ¶
GetLuckList 返回抢到红包的用户列表,需要登陆 AcFun 帐号,redpackBizUnit 为空时默认为 ztLiveAcfunRedpackGift
func (*AcFunLive) GetManagerList ¶
GetManagerList 返回主播的房管列表,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetMedalDetail ¶
func (ac *AcFunLive) GetMedalDetail(uid int64) (*MedalDetail, error)
GetMedalDetail 返回登陆帐号拥有的指定主播的守护徽章详细信息,需要登陆 AcFun 帐号
func (*AcFunLive) GetMedalList ¶
GetMedalList 返回登陆用户拥有的守护徽章列表,最多返回亲密度最高的 300 个,需要登陆 AcFun 帐号
func (*AcFunLive) GetMedalRankList ¶
func (ac *AcFunLive) GetMedalRankList(uid int64) (medalRankList *MedalRankList, e error)
GetMedalRankList 返回 uid 指定主播的守护榜(守护徽章亲密度排名前 50 名的用户),可用于获取指定主播的守护徽章名字
func (*AcFunLive) GetPlayback ¶
GetPlayback 返回直播回放的相关信息,目前部分直播没有回放
func (*AcFunLive) GetPushConfig ¶
func (ac *AcFunLive) GetPushConfig() (*PushConfig, error)
GetPushConfig 返回推流设置,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetStreamInfo ¶
func (ac *AcFunLive) GetStreamInfo() *StreamInfo
GetStreamInfo 返回直播的直播源信息,不需要调用 StartDanmu()
func (*AcFunLive) GetSummary ¶
GetSummary 返回直播总结信息
func (*AcFunLive) GetTokenInfo ¶
GetTokenInfo 返回直播间 token 相关信息,不需要调用 StartDanmu()
func (*AcFunLive) GetTranscodeInfo ¶
func (ac *AcFunLive) GetTranscodeInfo(streamName string) ([]TranscodeInfo, error)
GetTranscodeInfo 返回转码信息,推流后调用,返回的 info 长度不为 0 说明推流成功,需要登陆主播的 AcFun 帐号
func (*AcFunLive) GetUserInfo ¶
func (ac *AcFunLive) GetUserInfo(uid int64) (*UserProfileInfo, error)
GetUserInfo 返回 uid 指定用户的信息
func (*AcFunLive) GetUserLiveInfo ¶
func (ac *AcFunLive) GetUserLiveInfo(uid int64) (*UserLiveInfo, error)
GetUserLiveInfo 返回 uid 指定用户的直播信息,可能会出现超时等各种网络原因的错误
func (*AcFunLive) GetWalletBalance ¶
GetWalletBalance 返回钱包里 AC 币和拥有的香蕉的数量,需要登陆 AcFun 帐号
func (*AcFunLive) GetWatchingList ¶
func (ac *AcFunLive) GetWatchingList(liveID string) ([]WatchingUser, error)
GetWatchingList 返回直播间排名前 50 的在线观众信息列表
func (*AcFunLive) ManagerKick ¶
ManagerKick 房管踢人,需要登陆 AcFun 帐号,需要设置主播 uid
func (*AcFunLive) OnAuthorChatAccept ¶
func (ac *AcFunLive) OnAuthorChatAccept(handler func(*AcFunLive, *AuthorChatAccept))
OnAuthorChatAccept 处理主播接受连麦,可以多次调用
func (*AcFunLive) OnAuthorChatCall ¶
func (ac *AcFunLive) OnAuthorChatCall(handler func(*AcFunLive, *AuthorChatCall))
OnAuthorChatCall 处理主播发起连麦,可以多次调用
func (*AcFunLive) OnAuthorChatChangeSoundConfig ¶
func (ac *AcFunLive) OnAuthorChatChangeSoundConfig(handler func(*AcFunLive, *AuthorChatChangeSoundConfig))
OnAuthorChatChangeSoundConfig 处理主播连麦声音设置更改,可以多次调用
func (*AcFunLive) OnAuthorChatEnd ¶
func (ac *AcFunLive) OnAuthorChatEnd(handler func(*AcFunLive, *AuthorChatEnd))
OnAuthorChatEnd 处理连麦结束,可以多次调用
func (*AcFunLive) OnAuthorChatReady ¶
func (ac *AcFunLive) OnAuthorChatReady(handler func(*AcFunLive, *AuthorChatReady))
OnAuthorChatReady 处理主播接受连麦的信息,可以多次调用
func (*AcFunLive) OnBananaCount ¶
OnBananaCount 处理直播间获得的香蕉数,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnChatAccept ¶
func (ac *AcFunLive) OnChatAccept(handler func(*AcFunLive, *ChatAccept))
OnChatAccept 处理用户接受连麦,可以多次调用
func (*AcFunLive) OnChatCall ¶
OnChatCall 处理主播发起连麦,可以多次调用
func (*AcFunLive) OnChatReady ¶
OnChatReady 处理用户接受连麦的信息,可以多次调用
func (*AcFunLive) OnDanmuStop ¶
OnDanmuStop 处理获取弹幕结束,有可能是网络原因导致连接超时无法获取弹幕,直播不一定结束,可以多次调用
func (*AcFunLive) OnDisplayInfo ¶
func (ac *AcFunLive) OnDisplayInfo(handler func(*AcFunLive, *DisplayInfo))
OnDisplayInfo 处理直播间的一些数据,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnEnterRoom ¶
OnEnterRoom 处理用户进场,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnFollowAuthor ¶
func (ac *AcFunLive) OnFollowAuthor(handler func(*AcFunLive, *FollowAuthor))
OnFollowAuthor 处理用户关注主播,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnJoinClub ¶
OnJoinClub 处理用户加入主播守护团,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnKickedOut ¶
OnKickedOut 处理被踢出直播间,可以多次调用
func (*AcFunLive) OnManagerState ¶
func (ac *AcFunLive) OnManagerState(handler func(*AcFunLive, ManagerState))
OnManagerState 处理登陆帐号的房管状态,可以多次调用
func (*AcFunLive) OnRecentComment ¶
OnRecentComment 处理 APP 进直播间时显示的最近发的弹幕,可以多次调用
func (*AcFunLive) OnRedpackList ¶
OnRedpackList 处理直播间的红包列表,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnRichText ¶
OnRichText 处理富文本,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnShareLive ¶
OnShareLive 处理分享直播间到其他平台的弹幕,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnThrowBanana ¶
func (ac *AcFunLive) OnThrowBanana(handler func(*AcFunLive, *ThrowBanana))
OnThrowBanana 处理用户投蕉,现在基本用 OnGift 代替,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnTopUsers ¶
OnTopUsers 处理直播间礼物榜在线前三的信息,handler 需要支持并行处理,可以多次调用
func (*AcFunLive) OnViolationAlert ¶
OnViolationAlert 处理直播间警告,可以多次调用
func (*AcFunLive) SetLiveCutStatus ¶
SetLiveCutStatus 设置是否允许观众剪辑直播录像,需要登陆主播的 AcFun 帐号,主播直播时无法设置
func (*AcFunLive) SetLiverUID ¶
SetLiverUID 设置主播 uid,返回一个新的 *AcFunLive,不会复制弹幕获取采用事件响应模式时的事件处理函数
func (*AcFunLive) StartDanmu ¶
StartDanmu 获取弹幕,ctx 用来结束弹幕的获取,event 为 true 时采用事件响应模式。 event 为 false 时最好调用 GetDanmu() 或 WriteASS() 以清空弹幕队列。 一个 AcFunLive 只能同时调用 StartDanmu() 一次。
func (*AcFunLive) StartLive ¶
func (ac *AcFunLive) StartLive(title, coverFile, streamName string, portrait, panoramic bool, liveType *LiveType) (liveID string, e error)
StartLive 启动直播,title 为直播间标题,coverFile 为直播间封面图片(可以是 gif)的本地路径或网络链接,portrait 为是否手机直播,panoramic 为是否全景直播。 推流成功服务器开始转码(用 GetTranscodeInfo() 判断)后调用,title 和 coverFile 不能为空,需要登陆主播的 AcFun 帐号。
func (*AcFunLive) StopLive ¶
func (ac *AcFunLive) StopLive(liveID string) (*StopPushInfo, error)
StopLive 停止直播,需要登陆主播的 AcFun 帐号
type AuthorChatAccept ¶
type AuthorChatAccept struct {
ChatID string `json:"chatID"` // 连麦 ID
SignalInfo string `json:"signalInfo"`
}
AuthorChatAccept 主播接受连麦
type AuthorChatCall ¶
type AuthorChatCall struct {
Inviter AuthorChatPlayerInfo `json:"inviter"` // 发起连麦的主播的用户信息
ChatID string `json:"chatID"` // 连麦 ID
CallTime int64 `json:"callTime"` // 连麦发起时间,是以毫秒为单位的 Unix 时间
}
AuthorChatCall 主播发起连麦
type AuthorChatChangeSoundConfig ¶
type AuthorChatChangeSoundConfig struct {
ChatID string `json:"chatID"` // 连麦 ID
SoundConfigChangeType SoundConfigChangeType `json:"soundConfigChangeType"` // 声音设置更改的类型
}
AuthorChatChangeSoundConfig 主播连麦更改声音设置
type AuthorChatEnd ¶
type AuthorChatEnd struct {
ChatID string `json:"chatID"` // 连麦 ID
EndType ChatEndType `json:"endType"` // 连麦结束类型
EndLiveID string `json:"endLiveID"` // 结束连麦的直播 ID
}
AuthorChatEnd 主播连麦结束
type AuthorChatPlayerInfo ¶
type AuthorChatPlayerInfo struct {
UserInfo `json:"userInfo"`
LiveID string `json:"liveID"` // 直播 ID
EnableJumpPeerLiveRoom bool `json:"enableJumpPeerLiveRoom"` // 允许跳转到连麦的主播直播间?
}
AuthorChatPlayerInfo 主播之间连麦的主播信息
type AuthorChatReady ¶
type AuthorChatReady struct {
Inviter AuthorChatPlayerInfo `json:"inviter"` // 发起连麦的主播的用户信息
Invitee AuthorChatPlayerInfo `json:"invitee"` // 接受连麦的主播的用户信息
ChatID string `json:"chatID"` // 连麦 ID
}
AuthorChatReady 主播接受连麦的信息
type BillboardUser ¶
type BillboardUser WatchingUser
BillboardUser 就是礼物贡献榜上的用户的信息,没有 AnonymousUser、Medal 和 ManagerType
type ChatAccept ¶
type ChatAccept struct {
ChatID string `json:"chatID"` // 连麦 ID
MediaType ChatMediaType `json:"mediaType"` // 连麦类型
SignalInfo string `json:"signalInfo"`
}
ChatAccept 用户接受连麦
type ChatCall ¶
type ChatCall struct {
ChatID string `json:"chatID"` // 连麦 ID
LiveID string `json:"liveID"` // 直播 ID
CallTime int64 `json:"callTime"` // 连麦发起时间,是以毫秒为单位的 Unix 时间
}
ChatCall 主播发起连麦
type ChatEnd ¶
type ChatEnd struct {
ChatID string `json:"chatID"` // 连麦 ID
EndType ChatEndType `json:"endType"` // 连麦结束类型
}
ChatEnd 连麦结束
type ChatEndType ¶
type ChatEndType int32
ChatEndType 连麦结束类型
const ( // ChatEndUnknown 未知的连麦结束类型 ChatEndUnknown ChatEndType = iota // ChatEndCancelByAuthor 连麦发起者(主播)取消连麦 ChatEndCancelByAuthor // ChatEndByAuthor 连麦发起者(主播)结束连麦 ChatEndByAuthor // ChatEndByGuest 被连麦的人结束连麦 ChatEndByGuest // ChatEndGuestReject 被连麦的人拒绝连麦 ChatEndGuestReject // ChatEndGuestTimeout 等待连麦超时 ChatEndGuestTimeout // ChatEndGuestHeartbeatTimeout 被连麦的人 Heartbeat 超时 ChatEndGuestHeartbeatTimeout // ChatEndAuthorHeartbeatTimeout 连麦发起者(主播)Heartbeat 超时 ChatEndAuthorHeartbeatTimeout // ChatEndPeerLiveStopped 直播下播? ChatEndPeerLiveStopped )
type ChatMediaType ¶
type ChatMediaType int32
ChatMediaType 连麦类型
const ( // ChatMediaUnknown 未知的连麦类型 ChatMediaUnknown ChatMediaType = iota // ChatMediaAudio 语音连麦 ChatMediaAudio // ChatMediaVideo 视频连麦 ChatMediaVideo )
type ChatReady ¶
type ChatReady struct {
ChatID string `json:"chatID"` // 连麦 ID
Guest UserInfo `json:"guest"` // 被连麦的帐号信息,目前没有房管类型
MediaType ChatMediaType `json:"mediaType"` // 连麦类型
}
ChatReady 用户接受连麦的信息
type Comment ¶
type Comment struct {
DanmuCommon `json:"danmuInfo"`
Content string `json:"content"` // 弹幕文字内容
}
Comment 用户发的弹幕
type Cookies ¶
Cookies 就是 AcFun 帐号的 cookies
func LoginWithQRCode ¶
func LoginWithQRCode(qrCodeCallback func(QRCode), scannedCallback func()) (cookies Cookies, e error)
LoginWithQRCode 扫描二维码登陆,通过 qrCodeCallback 获取要扫描的二维码,二维码被成功扫描时 scannedCallback 会被调用 返回的 cookies 为 nil 时说明登陆二维码失效或者用户取消扫码登陆
func (Cookies) MarshalJSON ¶
MarshalJSON 实现 json 的 Marshaler 接口
func (*Cookies) UnmarshalJSON ¶
UnmarshalJSON 实现 json 的 Unmarshaler 接口
type DailyData ¶
type DailyData struct {
Date string `json:"date"` // 直播日期,格式类似"20210206"
LiveTimes int `json:"liveTimes"` // 当日直播次数
LiveStat `json:"liveStat"`
}
DailyData 就是单日直播统计数据
type DanmuClient ¶
type DanmuClient interface {
// New 返回新的弹幕客户端
NewDanmuClient() DanmuClient
// Type 返回弹幕客户端类型
Type() DanmuClientType
// Dial 连接弹幕服务器,address 是地址,在调用 Close() 后可重复调用
Dial(address string) error
// 读接口
io.Reader
// 写接口
io.Writer
// Close 关闭连接
Close(message string) error
}
DanmuClient 弹幕客户端
type DanmuClientType ¶
type DanmuClientType uint8
DanmuClientType 弹幕客户端类型
const ( // 弹幕客户端使用 WebSocket 连接 WebSocketDanmuClientType DanmuClientType = iota // 弹幕客户端使用 TCP 连接 TCPDanmuClientType )
type DanmuCommon ¶
type DanmuCommon struct {
SendTime int64 `json:"sendTime"` // 弹幕发送时间,是以毫秒为单位的 Unix 时间
UserInfo `json:"userInfo"`
}
DanmuCommon 弹幕通用部分
type DanmuMessage ¶
type DanmuMessage interface {
GetSendTime() int64 // 获取弹幕发送时间
GetUserInfo() *UserInfo // 获取 UserInfo
}
DanmuMessage 弹幕的接口
type DisplayInfo ¶
type DisplayInfo struct {
WatchingCount string `json:"watchingCount"` // 直播间在线观众数量
LikeCount string `json:"likeCount"` // 直播间点赞总数
LikeDelta int `json:"likeDelta"` // 点赞增加数量
}
DisplayInfo 就是直播间的一些数据
type DrawGiftInfo ¶
type DrawGiftInfo struct {
ScreenWidth int64 `json:"screenWidth"` // 手机屏幕宽度
ScreenHeight int64 `json:"screenHeight"` // 手机屏幕高度
DrawPoint []DrawPoint `json:"drawPoint"`
}
DrawGiftInfo 涂鸦礼物信息
type DrawPoint ¶
type DrawPoint struct {
MarginLeft int64 `json:"marginLeft"` // 到手机屏幕左边的距离
MarginTop int64 `json:"marginTop"` // 到手机屏幕顶部的距离
ScaleRatio float64 `json:"scaleRatio"` // 放大倍数?
Handup bool `json:"handup"`
PointWidth int64 `json:"pointWidth"` // 点的宽度?
PointHeight int64 `json:"pointHeight"` // 点的高度?
}
DrawPoint 单个涂鸦礼物的位置
type FollowAuthor ¶
type FollowAuthor DanmuCommon
FollowAuthor 用户关注主播的弹幕
func (*FollowAuthor) GetUserInfo ¶
func (d *FollowAuthor) GetUserInfo() *UserInfo
GetUserInfo 获取弹幕的用户信息
type Gift ¶
type Gift struct {
DanmuCommon `json:"danmuInfo"`
GiftDetail `json:"giftDetail"`
Count int32 `json:"count"` // 礼物单次赠送的数量,礼物总数是 Count * Combo
Combo int32 `json:"combo"` // 礼物连击数量,礼物总数是 Count * Combo
Value int64 `json:"value"` // 礼物价值,付费礼物时单位为 AC 币*1000,免费礼物(香蕉)时单位为礼物数量
ComboID string `json:"comboID"` // 礼物连击 ID
SlotDisplayDuration int64 `json:"slotDisplayDuration"` // 应该是礼物动画持续的时间,单位为毫秒,送礼物后在该时间内再送一次可以实现礼物连击
ExpireDuration int64 `json:"expireDuration"`
DrawGiftInfo DrawGiftInfo `json:"drawGiftInfo"` // 礼物涂鸦
}
Gift 用户赠送礼物的弹幕
type GiftDetail ¶
type GiftDetail struct {
GiftID int64 `json:"giftID"` // 礼物 ID
GiftName string `json:"giftName"` // 礼物名字
ARLiveName string `json:"arLiveName"` // 不为空时礼物属于虚拟偶像区的特殊礼物
PayWalletType int `json:"payWalletType"` // 1 为付费礼物,2 为免费礼物
Price int `json:"price"` // 礼物价格,付费礼物时单位为 AC 币,免费礼物(香蕉)时为 1
WebpPic string `json:"webpPic"` // 礼物的 webp 格式图片(动图)
PngPic string `json:"pngPic"` // 礼物的 png 格式图片(大)
SmallPngPic string `json:"smallPngPic"` // 礼物的 png 格式图片(小)
AllowBatchSendSizeList []int `json:"allowBatchSendSizeList"` // 网页或 APP 单次能够赠送的礼物数量列表
CanCombo bool `json:"canCombo"` // 是否能连击
CanDraw bool `json:"canDraw"` // 是否能涂鸦
MagicFaceID int `json:"magicFaceID"`
VupArID int `json:"vupArID"`
Description string `json:"description"` // 礼物的描述
RedpackPrice int `json:"redpackPrice"` // 礼物红包价格总额,单位为 AC 币
CornerMarkerText string `json:"cornerMarkerText"`
}
GiftDetail 就是礼物的详细信息
type JoinClub ¶
type JoinClub struct {
JoinTime int64 `json:"joinTime"` // 用户加入守护团的时间,是以毫秒为单位的 Unix 时间
FansInfo UserInfo `json:"fansInfo"` // 用户的信息
UperInfo UserInfo `json:"uperInfo"` // 主播的信息
}
JoinClub 用户加入主播的守护团,FansInfo 和 UperInfo 都没有 Avatar、Medal 和 ManagerType
func (*JoinClub) GetSendTime ¶
GetSendTime 获取弹幕发送时间,实际上返回的是用户加入守护团的时间
func (*JoinClub) GetUserInfo ¶
GetUserInfo 获取弹幕的用户信息,实际上返回的是加入守护团的用户的信息
type KickHistory ¶
type KickHistory struct {
UserID int64 `json:"userID"` // 被踢用户的 uid
Nickname string `json:"nickname"` // 被踢用户的名字
KickTime int64 `json:"kickTime"` // 用户被踢的时间,是以毫秒为单位的 Unix 时间
}
KickHistory 就是踢人历史记录
type LiveCutInfo ¶
type LiveCutInfo struct {
Status bool `json:"status"` // 是否允许剪辑直播录像(主播允许观众剪辑观众才能剪辑,主播直播时总是能剪辑自己的直播)
URL string `json:"url"` // 剪辑直播的地址,直接访问可能出现登陆问题,需要访问跳转地址
RedirectURL string `json:"redirectURL"` // 跳转直播剪辑的地址,访问一次后链接里的 token 就会失效
}
LiveCutInfo 就是直播剪辑信息
type LiveData ¶
type LiveData struct {
BeginDate string `json:"beginDate"` // 统计开始的日期
EndDate string `json:"endDate"` // 统计结束的日期
Overview LiveStat `json:"overview"` // 全部直播的统计概况
LiveDetail map[string][]LiveDetail `json:"liveDetail"` // 单场直播统计数据,key 为直播日期,格式类似"20210206"
DailyData []DailyData `json:"dailyData"` // 单日直播统计数据
}
LiveData 就是直播统计数据
type LiveDetail ¶
type LiveDetail struct {
LiveStartTime int64 `json:"liveStartTime"` // 直播开始的时间,是以毫秒为单位的 Unix 时间
LiveEndTime int64 `json:"liveEndTime"` // 直播结束的时间,是以毫秒为单位的 Unix 时间
LiveStat `json:"liveStat"`
}
LiveDetail 就是单场直播统计数据
type LiveInfo ¶
type LiveInfo struct {
KickedOut string `json:"kickedOut"` // 被踢理由?
ViolationAlert string `json:"violationAlert"` // 直播间警告?
LiveManagerState ManagerState `json:"liveManagerState"` // 登陆帐号的房管状态
AllBananaCount string `json:"allBananaCount"` // 直播间香蕉总数
DisplayInfo `json:"displayInfo"`
TopUsers []TopUser `json:"topUsers"` // 礼物榜在线前三
RecentComment []Comment `json:"recentComment"` // APP 进直播间时显示的最近发的弹幕
RedpackList []Redpack `json:"redpackList"` // 红包列表
}
LiveInfo 就是直播间的相关状态信息
type LiveSchedule ¶
type LiveSchedule struct {
ActivityID int `json:"activityID"` // 活动 ID
Profile UserProfile `json:"profile"` // 主播的用户信息
Title string `json:"title"` // 预告标题
Cover string `json:"cover"` // 预告封面
LiveStartTime int64 `json:"liveStartTime"` // 直播开始的时间,是以毫秒为单位的 Unix 时间
LiveType LiveType `json:"liveType"` // 直播分类
Reserve bool `json:"reserve"` // 登陆帐号是否预约了该直播
ReserveNumber int `json:"reserveNumber"` // 已预约用户的数量
}
LiveSchedule 就是直播预告
type LiveStat ¶
type LiveStat struct {
Duration int64 `json:"duration"` // 直播时长,单位为毫秒
MaxPopularityValue int `json:"maxPopularityValue"`
WatchCount int `json:"watchCount"` // 观看过直播的人数总数
DiamondCount int `json:"diamondCount"` // 直播收到的付费礼物对应的钻石数量,100 钻石=1AC 币
CommentCount int `json:"commentCount"` // 直播弹幕数量
BananaCount int `json:"bananaCount"` // 直播收到的香蕉数量
}
LiveStat 就是直播统计数据
type LiveStatus ¶
type LiveStatus struct {
LiveID string `json:"liveID"` // 直播 ID
StreamName string `json:"streamName"` // 直播源名字
Title string `json:"title"` // 直播间标题
LiveCover string `json:"liveCover"` // 直播间封面
LiveStartTime int64 `json:"liveStartTime"` // 直播开始的时间,是以毫秒为单位的 Unix 时间
Panoramic bool `json:"panoramic"` // 是否全景直播
BizUnit string `json:"bizUnit"` // 通常是"acfun"
BizCustomData string `json:"bizCustomData"` // 直播分类,格式是 json
}
LiveStatus 就是直播状态
type LiveType ¶
type LiveType struct {
CategoryID int `json:"categoryID"` // 直播主分类 ID
CategoryName string `json:"categoryName"` // 直播主分类名字
SubCategoryID int `json:"subCategoryID"` // 直播次分类 ID
SubCategoryName string `json:"subCategoryName"` // 直播次分类名字
}
LiveType 就是直播分类
type LuckyUser ¶
type LuckyUser struct {
UserInfo `json:"userInfo"`
GrabAmount int `json:"grabAmount"` // 抢红包抢到的 AC 币
}
LuckyUser 就是抢到红包的用户,没有 Medal 和 ManagerType
type Manager ¶
type Manager struct {
UserInfo `json:"userInfo"`
CustomData string `json:"customData"` // 用户的一些额外信息,格式为 json
Online bool `json:"online"` // 是否直播间在线?
}
Manager 就是房管的用户信息,目前没有 Medal 和 ManagerType
type ManagerState ¶
type ManagerState int32
ManagerState 就是房管状态
const ( // ManagerStateUnknown 未知的房管状态,通常说明登陆用户不是房管 ManagerStateUnknown ManagerState = iota // ManagerAdded 登陆用户被添加房管权限? ManagerAdded // ManagerRemoved 登陆用户被移除房管权限? ManagerRemoved // IsManager 登陆用户是房管 IsManager )
type ManagerType ¶
type ManagerType int32
ManagerType 就是房管类型
const ( // NotManager 不是房管 NotManager ManagerType = iota // NormalManager 是房管 NormalManager )
type Medal ¶
type Medal struct {
MedalInfo `json:"medalInfo"`
UperName string `json:"uperName"` // UP 主的名字
UperAvatar string `json:"uperAvatar"` // UP 主的头像
WearMedal bool `json:"wearMedal"` // 是否正在佩戴该守护徽章
FriendshipDegree int `json:"friendshipDegree"` // 目前守护徽章的亲密度
JoinClubTime int64 `json:"joinClubTime"` // 加入守护团的时间,是以毫秒为单位的 Unix 时间
CurrentDegreeLimit int `json:"currentDegreeLimit"` // 守护徽章目前等级的亲密度的上限
MedalCount int `json:"medalCount"` // 指定用户拥有的守护徽章数量
}
Medal 就是指定用户的守护徽章信息
type MedalDegree ¶
type MedalDegree struct {
UperID int64 `json:"uperID"` // UP 主的 uid
GiftDegree int `json:"giftDegree"` // 本日送直播礼物增加的亲密度
GiftDegreeLimit int `json:"giftDegreeLimit"` // 本日送直播礼物增加的亲密度上限
PeachDegree int `json:"peachDegree"` // 本日投桃增加的亲密度
PeachDegreeLimit int `json:"peachDegreeLimit"` // 本日投桃增加的亲密度上限
LiveWatchDegree int `json:"liveWatchDegree"` // 本日看直播时长增加的亲密度
LiveWatchDegreeLimit int `json:"liveWatchDegreeLimit"` // 本日看直播时长增加的亲密度上限
BananaDegree int `json:"bananaDegree"` // 本日投蕉增加的亲密度
BananaDegreeLimit int `json:"bananaDegreeLimit"` // 本日投蕉增加的亲密度上限
}
MedalDegree 就是守护徽章的亲密度信息
type MedalDetail ¶
type MedalDetail struct {
Medal Medal `json:"medal"` // 守护徽章信息
MedalDegree MedalDegree `json:"medalDegree"` // 守护徽章亲密度信息
UserRank string `json:"userRank"` // 登陆用户的主播守护徽章亲密度的排名
}
MedalDetail 就是登陆用户的守护徽章的详细信息
type MedalInfo ¶
type MedalInfo struct {
UperID int64 `json:"uperID"` // UP 主的 uid
UserID int64 `json:"userID"` // 用户的 uid
ClubName string `json:"clubName"` // 守护徽章名字
Level int `json:"level"` // 守护徽章等级
}
MedalInfo 就是守护徽章信息
type MedalRankList ¶
type MedalRankList struct {
HasFansClub bool `json:"hasFansClub"` // 主播是否有守护团
RankList []UserMedalInfo `json:"rankList"` // 主播守护徽章等级列表
ClubName string `json:"clubName"` // 守护徽章名字
MedalCount int `json:"medalCount"` // 拥有主播守护徽章的用户的数量
HasMedal bool `json:"hasMedal"` // 登陆用户是否有主播的守护徽章
UserFriendshipDegree int `json:"userFriendshipDegree"` // 登陆用户的主播守护徽章的亲密度
UserRank string `json:"userRank"` // 登陆用户的主播守护徽章的排名
}
MedalRankList 就是主播守护徽章等级列表
func GetMedalRankList ¶
func GetMedalRankList(uid int64, deviceID string) (medalRankList *MedalRankList, e error)
GetMedalRankList 返回 uid 指定主播的守护榜(守护徽章亲密度排名前 50 名的用户),可用于获取指定主播的守护徽章名字
type Playback ¶
type Playback struct {
Duration int64 `json:"duration"` // 录播视频时长,单位是毫秒
URL string `json:"url"` // 录播源链接,目前分为阿里云和腾讯云两种,目前阿里云的下载速度比较快
BackupURL string `json:"backupURL"` // 备份录播源链接
M3U8Slice string `json:"m3u8Slice"` // m3u8
Width int `json:"width"` // 录播视频宽度
Height int `json:"height"` // 录播视频高度
}
Playback 就是直播回放的相关信息
func (*Playback) Distinguish ¶
Distinguish 返回阿里云和腾讯云链接,目前阿里云的下载速度比较快
type PushConfig ¶
type PushConfig struct {
StreamName string `json:"streamName"` // 直播源名字(ID)
StreamPullAddress string `json:"streamPullAddress"` // 拉流地址,也就是直播源地址
StreamPushAddress []string `json:"streamPushAddress"` // 推流地址,目前分为阿里云和腾讯云两种
Panoramic bool `json:"panoramic"` // 是否全景直播
Interval int64 `json:"interval"` // 查询转码信息的时间间隔,单位为毫秒
RTMPServer string `json:"rtmpServer"` // RTMP 服务器
StreamKey string `json:"streamKey"` // 直播码/串流密钥
}
PushConfig 就是推流设置
type QRCode ¶
type QRCode struct {
ExpireTime int64 `json:"expireTime"` // 二维码失效时间,是以毫秒为单位的 Unix 时间
ImageData string `json:"imageData"` // 二维码数据,是以 Base64 编码的 PNG 图片
}
QRCode 登陆二维码
type Redpack ¶
type Redpack struct {
UserInfo `json:"userInfo"` // 发红包的用户
DisplayStatus RedpackDisplayStatus `json:"displayStatus"` // 红包的状态
GrabBeginTime int64 `json:"grabBeginTime"` // 开始抢红包的时间,是以毫秒为单位的 Unix 时间
GetTokenLatestTime int64 `json:"getTokenLatestTime"` // 抢红包的用户获得 token 的最晚时间?是以毫秒为单位的 Unix 时间
RedpackID string `json:"redpackID"` // 红包 ID
RedpackBizUnit string `json:"redpackBizUnit"` // "ztLiveAcfunRedpackGift"代表的是观众,"ztLiveAcfunRedpackAuthor"代表的是主播?
RedpackAmount int64 `json:"redpackAmount"` // 红包的总价值,单位是 AC 币
SettleBeginTime int64 `json:"settleBeginTime"` // 抢红包的结束时间,是以毫秒为单位的 Unix 时间
}
Redpack 红包信息
type RedpackDisplayStatus ¶
type RedpackDisplayStatus int32
RedpackDisplayStatus 红包状态
const ( // RedpackShow 红包出现? RedpackShow RedpackDisplayStatus = iota // RedpackGetToken 可以获取红包 token? RedpackGetToken // RedpackGrab 可以抢红包 RedpackGrab )
type RichText ¶
type RichText struct {
SendTime int64 `json:"sendTime"` // 富文本的发送时间,是以毫秒为单位的 Unix 时间,可能为 0
Segments []RichTextSegment `json:"segments"` // 富文本各部分,类型是 RichTextUserInfo、RichTextPlain 或 RichTextImage
}
RichText 富文本,目前是用于发红包和抢红包的相关消息
func (*RichText) GetUserInfo ¶
GetUserInfo 获取弹幕的用户信息,返回第一个 RichTextUserInfo 的 UserInfo,否则返回 nil
type RichTextImage ¶
type RichTextImage struct {
Pictures []string `json:"pictures"` // 图片
AlternativeText string `json:"alternativeText"` // 可选的文本?
AlternativeColor string `json:"alternativeColor"` // 可选的文本颜色?
}
RichTextImage 富文本里的图片
func (*RichTextImage) RichTextType ¶
func (*RichTextImage) RichTextType() string
RichTextType 返回 RichText 的类型,也就是 "RichTextImage"
type RichTextPlain ¶
RichTextPlain 富文本里的文字
func (*RichTextPlain) RichTextType ¶
func (*RichTextPlain) RichTextType() string
RichTextType 返回 RichText 的类型,也就是 "RichTextPlain"
type RichTextSegment ¶
type RichTextSegment interface {
RichTextType() string
}
RichTextSegment 副文本片段的接口
type RichTextUserInfo ¶
RichTextUserInfo 富文本里的用户信息
func (*RichTextUserInfo) RichTextType ¶
func (*RichTextUserInfo) RichTextType() string
RichTextType 返回 RichText 的类型,也就是 "RichTextUserInfo"
type SharePlatformType ¶
type SharePlatformType int32
SharePlatformType 就是分享的平台类型
const ( // PlatformUnknown 未知平台 PlatformUnknown SharePlatformType = iota // PlatformQQ 分享给 QQ 好友或群 PlatformQQ // PlatformQzone 分享到 QQ 空间 PlatformQzone // PlatformWeibo 分享到新浪微博? PlatformWeibo // PlatformWeChat 分享给微信好友或群 PlatformWeChat // PlatformWeChatMoments 分享到微信朋友圈 PlatformWeChatMoments // PlatformAcFunMoment 分享到 AcFun 动态 PlatformAcFunMoment )
type SoundConfigChangeType ¶
type SoundConfigChangeType int32
SoundConfigChangeType 声音设置更改的类型
const ( // SoundConfigChangeUnknown 未知的声音设置更改的类型 SoundConfigChangeUnknown SoundConfigChangeType = iota // SoundConfigChangeOpenSound 打开声音 SoundConfigChangeOpenSound // SoundConfigChangeCloseSound 关闭声音 SoundConfigChangeCloseSound )
type StopPushInfo ¶
type StopPushInfo struct {
Duration int64 `json:"duration"` // 直播时长,单位为毫秒
EndReason string `json:"endReason"` // 停止直播的原因
}
StopPushInfo 停止直播返回的信息
type StreamInfo ¶
type StreamInfo struct {
LiveID string `json:"liveID"` // 直播 ID
Title string `json:"title"` // 直播间标题
LiveStartTime int64 `json:"liveStartTime"` // 直播开始的时间,是以毫秒为单位的 Unix 时间
Panoramic bool `json:"panoramic"` // 是否全景直播
StreamList []StreamURL `json:"streamList"` // 直播源列表
StreamName string `json:"streamName"` // 直播源名字(ID)
}
StreamInfo 就是直播的直播源信息
type StreamURL ¶
type StreamURL struct {
URL string `json:"url"` // 直播源链接
Bitrate int `json:"bitrate"` // 直播源码率,不一定是实际码率
QualityType string `json:"qualityType"` // 直播源类型,一般是"SMOOTH"、"STANDARD"、"HIGH"、"SUPER"、"BLUE_RAY"
QualityName string `json:"qualityName"` // 直播源类型的中文名字,一般是"流畅"、"高清"、"超清"、"蓝光 4M"、"蓝光 5M"、"蓝光 6M"、"蓝光 7M"、"蓝光 8M"
}
StreamURL 就是直播源相关信息
type SubConfig ¶
type SubConfig struct {
Title string `json:"title"` // 字幕标题
PlayResX int `json:"playResX"` // 视频分辨率
PlayResY int `json:"playResY"` // 视频分辨率
FontSize int `json:"fontSize"` // 字体大小
StartTime int64 `json:"startTime"` // 直播录播开始的时间,是以纳秒为单位的 Unix 时间
}
SubConfig 是字幕的详细设置
type Summary ¶
type Summary struct {
Duration int64 `json:"duration"` // 直播时长,单位为毫秒
LikeCount string `json:"likeCount"` // 点赞总数
WatchCount string `json:"watchCount"` // 观看过直播的人数总数
GiftCount int `json:"giftCount"` // 直播收到的付费礼物数量
DiamondCount int `json:"diamondCount"` // 主播收到的实际钻石数量(扣除平台相关费用),100 钻石=1AC 币
BananaCount int `json:"bananaCount"` // 直播收到的香蕉数量
}
Summary 就是直播的总结信息
type TCPDanmuClient ¶
type TCPDanmuClient struct {
// contains filtered or unexported fields
}
TCPDanmuClient 使用 TCP 连接的弹幕客户端
func (*TCPDanmuClient) Dial ¶
func (client *TCPDanmuClient) Dial(address string) error
Dial 连接弹幕服务器,address 是地址
func (*TCPDanmuClient) NewDanmuClient ¶
func (client *TCPDanmuClient) NewDanmuClient() DanmuClient
NewDanmuClient 返回新的 TCPDanmuClient
func (*TCPDanmuClient) Read ¶
func (client *TCPDanmuClient) Read(p []byte) (n int, err error)
Read 读数据
func (*TCPDanmuClient) Type ¶
func (client *TCPDanmuClient) Type() DanmuClientType
Type 返回弹幕客户端类型 TCPDanmuClientType
type ThrowBanana ¶
type ThrowBanana struct {
DanmuCommon `json:"danmuInfo"`
BananaCount int `json:"bananaCount"` // 投蕉数量
}
ThrowBanana 用户投蕉的弹幕,没有 Avatar、Medal 和 ManagerType,现在基本不用这个,通常用 Gift 代替
func (*ThrowBanana) GetUserInfo ¶
func (d *ThrowBanana) GetUserInfo() *UserInfo
GetUserInfo 获取弹幕的用户信息
type TokenInfo ¶
type TokenInfo struct {
UserID int64 `json:"userID"` // 登陆模式或游客模式的 uid
SecurityKey string `json:"securityKey"` // 密钥,第一次发送 ws 信息时用
ServiceToken string `json:"serviceToken"` // 令牌
DeviceID string `json:"deviceID"` // 设备 ID
Cookies Cookies `json:"cookies"` // AcFun 帐号的 cookies
}
TokenInfo 就是 AcFun 直播的 token 相关信息
func GetTokenInfo ¶
GetTokenInfo 返回 TokenInfo,cookies 可以利用 Login() 获取,为 nil 时为游客模式
type TranscodeInfo ¶
type TranscodeInfo struct {
StreamURL `json:"streamURL"`
Resolution string `json:"resolution"` // 直播视频分辨率
FrameRate int `json:"frameRate"` // 直播视频 FPS?
Template string `json:"template"` // 直播模板?
}
TranscodeInfo 就是转码信息
type UserInfo ¶
type UserInfo struct {
UserID int64 `json:"userID"` // 用户 uid
Nickname string `json:"nickname"` // 用户名字
Avatar string `json:"avatar"` // 用户头像
Medal MedalInfo `json:"medal"` // 用户正在佩戴的守护徽章
ManagerType ManagerType `json:"managerType"` // 用户是否房管
}
UserInfo 就是用户信息
func NewUserInfo ¶
func NewUserInfo(userInfo *acproto.ZtLiveUserInfo) *UserInfo
NewUserInfo 创建 UserInfo
type UserLiveInfo ¶
type UserLiveInfo struct {
Profile UserProfile `json:"profile"` // 用户信息
LiveType LiveType `json:"liveType"` // 直播分类
LiveID string `json:"liveID"` // 直播 ID
StreamName string `json:"streamName"` // 直播源名字(ID)
Title string `json:"title"` // 直播间标题
LiveStartTime int64 `json:"liveStartTime"` // 直播开始的时间,是以毫秒为单位的 Unix 时间
Portrait bool `json:"portrait"` // 是否手机直播
Panoramic bool `json:"panoramic"` // 是否全景直播
LiveCover string `json:"liveCover"` // 直播间封面
OnlineCount int `json:"onlineCount"` // 直播间在线人数
LikeCount int `json:"likeCount"` // 直播间点赞总数
HasFansClub bool `json:"hasFansClub"` // 主播是否有守护团
DisableDanmakuShow bool `json:"disableDanmakuShow"` // 是否禁止显示弹幕?
PaidShowUserBuyStatus bool `json:"paidShowUserBuyStatus"` // 登陆帐号是否购买了付费直播?
}
UserLiveInfo 就是用户直播信息
func GetAllLiveList ¶
func GetAllLiveList(deviceID string) ([]UserLiveInfo, error)
GetAllLiveList 返回全部正在直播的直播间列表
func GetLiveList ¶
func GetLiveList(count, page int, deviceID string) (liveList []UserLiveInfo, lastPage bool, err error)
GetLiveList 返回正在直播的直播间列表,count 为每页的直播间数量,page 为第几页(从 0 开始数起),lastPage 说明是否最后一页
func GetUserLiveInfo ¶
func GetUserLiveInfo(uid int64, deviceID string) (*UserLiveInfo, error)
GetUserLiveInfo 返回 uid 指定用户的直播信息,可能会出现超时等各种网络原因的错误
type UserMedalInfo ¶
type UserMedalInfo struct {
UserProfile `json:"profile"`
FriendshipDegree int `json:"friendshipDegree"` // 用户守护徽章的亲密度
Level int `json:"level"` // 用户守护徽章的等级
}
UserMedalInfo 就是用户的守护徽章信息
type UserProfile ¶
type UserProfile struct {
UserID int64 `json:"userID"` // 用户 uid
Nickname string `json:"nickname"` // 用户名字
Avatar string `json:"avatar"` // 用户头像
AvatarFrame string `json:"avatarFrame"` // 用户头像挂件
FollowingCount int `json:"followingCount"` // 用户关注数量
FansCount int `json:"fansCount"` // 用户粉丝数量
ContributeCount int `json:"contributeCount"` // 用户投稿数量
Signature string `json:"signature"` // 用户签名
VerifiedText string `json:"verifiedText"` // 用户认证信息
IsJoinUpCollege bool `json:"isJoinUpCollege"` // 用户是否加入阿普学院
IsFollowing bool `json:"isFollowing"` // 登陆帐号是否关注了用户
IsFollowed bool `json:"isFollowed"` // 用户是否关注了登陆帐号
}
UserProfile 就是用户信息
type UserProfileInfo ¶
type UserProfileInfo struct {
UserID int64 `json:"userID"` // 用户 uid
Nickname string `json:"nickname"` // 用户名字
Avatar string `json:"avatar"` // 用户头像
AvatarFrame string `json:"avatarFrame"` // 用户头像挂件
FollowingCount string `json:"followingCount"` // 用户关注数量
FansCount string `json:"fansCount"` // 用户粉丝数量
ContributeCount string `json:"contributeCount"` // 用户投稿数量
Signature string `json:"signature"` // 用户签名
VerifiedText string `json:"verifiedText"` // 用户认证信息
IsJoinUpCollege bool `json:"isJoinUpCollege"` // 用户是否加入阿普学院
IsFollowing bool `json:"isFollowing"` // 登陆帐号是否关注了用户
IsFollowed bool `json:"isFollowed"` // 用户是否关注了登陆帐号
LiveID string `json:"liveID"` // 直播 ID
LikeCount int `json:"likeCount"` // 最近一次直播的点赞总数
}
UserProfileInfo 就是用户信息
func GetUserInfo ¶
func GetUserInfo(uid int64, deviceID string) (*UserProfileInfo, error)
GetUserInfo 返回 uid 指定用户的信息
type WatchingUser ¶
type WatchingUser struct {
UserInfo `json:"userInfo"`
AnonymousUser bool `json:"anonymousUser"` // 是否匿名用户
DisplaySendAmount string `json:"displaySendAmount"` // 赠送的全部礼物的价值,单位是 AC 币,注意不一定是纯数字的字符串
CustomData string `json:"customData"` // 用户的一些额外信息,格式为 json
}
WatchingUser 就是观看直播的用户的信息,目前没有 Medal
type WebSocketDanmuClient ¶
type WebSocketDanmuClient struct {
// contains filtered or unexported fields
}
WebSocketDanmuClient 使用 WebSocket 连接的弹幕客户端
func (*WebSocketDanmuClient) Close ¶
func (client *WebSocketDanmuClient) Close(message string) error
Close 关闭连接
func (*WebSocketDanmuClient) Dial ¶
func (client *WebSocketDanmuClient) Dial(address string) error
Dial 连接弹幕服务器,address 是地址
func (*WebSocketDanmuClient) NewDanmuClient ¶
func (client *WebSocketDanmuClient) NewDanmuClient() DanmuClient
NewDanmuClient 返回新的 WebSocketDanmuClient
func (*WebSocketDanmuClient) Read ¶
func (client *WebSocketDanmuClient) Read(p []byte) (n int, err error)
Read 读数据
func (*WebSocketDanmuClient) Type ¶
func (client *WebSocketDanmuClient) Type() DanmuClientType
Type 返回弹幕客户端类型 WebSocketDanmuClientType