media

package
v0.0.0-...-531a2f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "urn:x-cast:com.google.cast.media"

Variables

This section is empty.

Functions

func CustomData

func CustomData(data interface{}) func(command.Map)

func PreventAutoplay

func PreventAutoplay(c command.Map)

func Seek

func Seek(t time.Duration) func(command.Map)

Types

type App

type App struct {
	*command.App
	// contains filtered or unexported fields
}

func ConnectFromStatus

func ConnectFromStatus(client chromecast.Client, st chromecast.Status) (*App, error)

func LaunchAndConnect

func LaunchAndConnect(client chromecast.Client, id string, statuses ...chromecast.Status) (*App, error)

func (*App) CurrentSession

func (a *App) CurrentSession() (*Session, error)

func (*App) LatestStatus

func (a *App) LatestStatus() []Status

func (App) Load

func (a App) Load(item Item, options ...Option) (<-chan []byte, error)

func (*App) LoadAndGetSession

func (a *App) LoadAndGetSession(item Item, options ...Option) (*Session, error)

func (*App) Status

func (a *App) Status() ([]Status, error)

func (*App) UpdateStatus

func (a *App) UpdateStatus()

type Item

type Item struct {
	ContentID   string `json:"contentId"`
	StreamType  string `json:"streamType"`
	ContentType string `json:"contentType"`
}

type ItemStatus

type ItemStatus struct {
	ContentId   string                 `json:"contentId"`
	StreamType  string                 `json:"streamType"`
	ContentType string                 `json:"contentType"`
	Duration    Seconds                `json:"duration"`
	Metadata    map[string]interface{} `json:"metadata"`
}

type Option

type Option func(command.Map)

Option to customize the loading

type Seconds

type Seconds struct {
	time.Duration
}

func (Seconds) MarshalJSON

func (s Seconds) MarshalJSON() (b []byte, err error)

func (*Seconds) UnmarshalJSON

func (s *Seconds) UnmarshalJSON(b []byte) (err error)

type Session

type Session struct {
	*App
	ID int `json:"mediaSessionId"`
}

func (Session) Pause

func (s Session) Pause(options ...Option) (<-chan bool, error)

func (Session) Play

func (s Session) Play(options ...Option) (<-chan bool, error)

func (Session) Seek

func (s Session) Seek(options ...Option) (<-chan []byte, error)

func (Session) Stop

func (s Session) Stop(options ...Option) (<-chan bool, error)

type Status

type Status struct {
	SessionID              int                    `json:"mediaSessionId"`
	PlaybackRate           float64                `json:"playbackRate"`
	PlayerState            string                 `json:"playerState"`
	CurrentTime            Seconds                `json:"currentTime"`
	SupportedMediaCommands int                    `json:"supportedMediaCommands"`
	Volume                 *chromecast.Volume     `json:"volume,omitempty"`
	Item                   *ItemStatus            `json:"media"`
	CustomData             map[string]interface{} `json:"customData"`
	RepeatMode             string                 `json:"repeatMode"`
	IdleReason             string                 `json:"idleReason"`
}

type URLLoader

type URLLoader func(rawurl string, options ...Option) (func(client chromecast.Client, statuses ...chromecast.Status) (<-chan []byte, error), error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL