mirror of
https://github.com/AynaLivePlayer/liveroom-sdk.git
synced 2025-12-08 05:32:49 +08:00
update api. openblive
This commit is contained in:
@@ -13,7 +13,7 @@ const apiServer = "http://0.0.0.0:9090"
|
||||
|
||||
func main() {
|
||||
provider := openblive.NewOpenBLiveClientProvider(apiServer, 1661006726438)
|
||||
room := provider(liveroom.LiveRoomConfig{
|
||||
room, _ := provider(liveroom.LiveRoomConfig{
|
||||
Room: "YOUR_CLIENT_KEY",
|
||||
Provider: openblive.ProviderName,
|
||||
})
|
||||
|
||||
42
example/webdm/webdm.go
Normal file
42
example/webdm/webdm.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"liveroom"
|
||||
"liveroom/provider/openblive"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
const apiServer = "http://0.0.0.0:9090"
|
||||
|
||||
func main() {
|
||||
provider := web.NewOpenBLiveClientProvider(apiServer, 1661006726438)
|
||||
room := provider(liveroom.LiveRoomConfig{
|
||||
Room: "YOUR_CLIENT_KEY",
|
||||
Provider: openblive.ProviderName,
|
||||
})
|
||||
room.OnMessage(func(msg *liveroom.Message) {
|
||||
fmt.Println(msg.User.Username, msg.User.Uid, msg.User.Medal.Name, msg.Message)
|
||||
})
|
||||
room.OnStatusChange(
|
||||
func(connected bool) {
|
||||
if connected {
|
||||
fmt.Println("Connected")
|
||||
} else {
|
||||
fmt.Println("Disconnected")
|
||||
}
|
||||
})
|
||||
room.OnDisconnect(
|
||||
func(liveroom liveroom.LiveRoom) {
|
||||
fmt.Println("Disconnected AAAAAAAa")
|
||||
})
|
||||
fmt.Println("connect", room.Connect())
|
||||
quit := make(chan os.Signal)
|
||||
signal.Notify(quit, os.Interrupt, os.Kill)
|
||||
<-quit
|
||||
fmt.Println("disconnect", room.Disconnect())
|
||||
time.Sleep(3 * time.Second)
|
||||
fmt.Println("Bye")
|
||||
}
|
||||
Reference in New Issue
Block a user