🎭 Stream API Methods Playing Hide and Seek in Go SDK
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start with the getstream.NewClient initialization and LiveStreamController.StartStream snippets in the issue, then compare their methods and ID types with the current getstream-go API. Done means the reported livestream creation path compiles with the stated Go SDK version, or the supported usage is documented.
Written by the indexing model from the issue text.
Description
Hello i am trying to build a project to learn by building a backend clone of Tiktok i am trying to learn
What's Popping? 🎯
Trying to build a sick livestreaming feature but the Stream Go SDK methods are playing hard to get:
lc.streamClient.Callundefinedlc.streamClient.Video()undefined- Type mismatches with user IDs (string vs int)
Expected Behavior 🎪
Should be able to create livestreams like a boss using:
how i initialize the stream Video Livestream API
package config
import (
"os"
"github.com/GetStream/getstream-go"
)
func InitStreamVideo() (*getstream.Stream, error) {
apiKey := os.Getenv("STREAM_API_KEY")
apiSecret := os.Getenv("STREAM_API_SECRET")
client, err := getstream.NewClient(apiKey, apiSecret)
if err != nil {
return nil, err
}
return client, nil
}
The controller than handle these
package controllers
import (
"Tiktok/internal/database"
"Tiktok/internal/models"
"Tiktok/internal/utils"
"context"
"strconv"
"github.com/GetStream/getstream-go"
"github.com/go-playground/validator"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
)
type LiveStreamController struct {
db database.Service
validate *validator.Validate
streamClient *getstream.Client
}
type StartStreamRequest struct {
Title string `json:"title" validate:"required"`
Description string `json:"description" validate:"required"`
}
func (lc *LiveStreamController) StartStream(c *fiber.Ctx) error {
ctx := context.Background()
claims := c.Locals("user").(*utils.Claims)
var req StartStreamRequest
if err := c.BodyParser(&req); err != nil {
return utils.SendErrorResponse(c, fiber.StatusBadRequest, "Invalid request", err.Error())
}
userID := strconv.Itoa(claims.UserID)
callID := uuid.New().String()
// Create livestream call
call := lc.streamClient.Video().Call("livestream", callID)
response, err := call.GetOrCreate(ctx, &getstream.GetOrCreateCallRequest{
Data: &getstream.CallRequest{
CreatedByID: getstream.PtrTo(userID),
Members: []getstream.MemberRequest{
{UserID: userID, Role: getstream.PtrTo("host")},
},
Custom: map[string]interface{}{
"title": req.Title,
"description": req.Description,
},
},
})
if err != nil {
return utils.SendErrorResponse(c, fiber.StatusInternalServerError, "Failed to create stream", err.Error())
}
// Save to database
stream := &models.LiveStream{
UserID: claims.UserID,
Title: req.Title,
Description: req.Description,
CallID: callID,
Status: "backstage",
StreamKey: response.StreamKey,
RtmpUrl: response.RtmpUrl,
}
if err := lc.db.CreateLiveStream(ctx, stream); err != nil {
return utils.SendErrorResponse(c, fiber.StatusInternalServerError, "Failed to save stream", err.Error())
}
return c.JSON(fiber.Map{
"status": "success",
"data": stream,
})
}
Current Behavior 🎪
Getting compiler errors faster than a Twitch chat during a fail moment
SDK Version
- GetStream Go SDK: latest
- Go version: latest
- Framework: Fiber
The Dream 🌟
Just trying to make the next big streaming platform here! Help a dev out!
- Dominant language
- Go
- Stars
- 8
- Forks
- 3
- Avg merge
- 7h 29m
- Merged PRs (30d)
- 78
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/getstream-go
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/getstream-go#172 · 19 comments ·
Maintainers usually reply within 1 day
-
Timestamp struct used in models.go seems incoherent with the used date formatPossibly taken @skb1129 claimed this 129 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
GetStream/getstream-go#26 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GetStream/getstream-go
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
siyuan-note/siyuan#21692 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
router-for-me/CLIProxyAPI#8147 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
rossoctl/context-guru#1413 ·
Maintainers usually reply within 1 day