Files
core/http/graph/resolver/playout.resolvers.go
Jan Stabenow eb1cc37456 Add GoSRT & improvements (repo-merge)
Commits (Ingo Oppermann):
- Add experimental SRT connection stats and logs
- Hide /config/reload endpoint in reade-only mode
- Add SRT server
- Create v16 in go.mod
- Fix data races, tests, lint, and update dependencies
- Add trailing slash for routed directories (datarhei/restreamer#340)
- Allow relative URLs in content in static routes

Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
2022-06-23 22:13:58 +02:00

40 lines
995 B
Go

package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
import (
"context"
"encoding/json"
"fmt"
"net/http"
"github.com/datarhei/core/v16/http/graph/models"
"github.com/datarhei/core/v16/playout"
)
func (r *queryResolver) PlayoutStatus(ctx context.Context, id string, input string) (*models.RawAVstream, error) {
addr, err := r.Restream.GetPlayout(id, input)
if err != nil {
return nil, fmt.Errorf("unknown process or input: %w", err)
}
path := "/v1/status"
data, err := r.playoutRequest(http.MethodGet, addr, path, "", nil)
if err != nil {
return nil, fmt.Errorf("failed to get status: %w", err)
}
status := playout.Status{}
if err := json.Unmarshal(data, &status); err != nil {
return nil, fmt.Errorf("failed to decode response: %w", err)
}
s := &models.RawAVstream{}
s.UnmarshalPlayout(status)
return s, nil
}