Prerequisites
To get the most out of this guide, you’ll need to:
Use the SDK
Now that you have the SDK installed and initialized, you can use it in your app.
Let’s create a stream.
Try it yourself
Learn how to create your first stream using the Livepeer Go SDK.
Prerequisites
Initialize the SDK
package main
import (
"context"
livepeer "github.com/livepeer/livepeer-go"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
lpClient := livepeer.New(
livepeer.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
}
Use the SDK
package main
import (
"context"
livepeer "github.com/livepeer/livepeer-go"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
lpClient := livepeer.New(
livepeer.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := lpClient.Stream.Create(ctx, components.NewStreamPayload{
Name: "test_stream",
})
if err != nil {
log.Fatal(err)
}
if res.Stream != nil {
log.Printf("Stream created successfully")
}
}
Try it yourself
Was this page helpful?