cast

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Known Payload headers
	ConnectHeader     = PayloadHeader{Type: "CONNECT"}
	CloseHeader       = PayloadHeader{Type: "CLOSE"}
	GetStatusHeader   = PayloadHeader{Type: "GET_STATUS"}
	PongHeader        = PayloadHeader{Type: "PONG"}         // Response to PING payload
	LaunchHeader      = PayloadHeader{Type: "LAUNCH"}       // Launches a new chromecast app
	StopHeader        = PayloadHeader{Type: "STOP"}         // Stop playing current media
	PlayHeader        = PayloadHeader{Type: "PLAY"}         // Plays / unpauses the running app
	PauseHeader       = PayloadHeader{Type: "PAUSE"}        // Pauses the running app
	SeekHeader        = PayloadHeader{Type: "SEEK"}         // Seek into the running app
	VolumeHeader      = PayloadHeader{Type: "SET_VOLUME"}   // Sets the volume
	LoadHeader        = PayloadHeader{Type: "LOAD"}         // Loads an application onto the chromecast
	QueueLoadHeader   = PayloadHeader{Type: "QUEUE_LOAD"}   // Loads an application onto the chromecast
	QueueUpdateHeader = PayloadHeader{Type: "QUEUE_UPDATE"} // Loads an application onto the chromecast
	SkipHeader        = PayloadHeader{Type: "SKIP_AD"}      // Skip add based off https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages#.SKIP_AD
)

Functions

This section is empty.

Types

type Application

type Application struct {
	AppId        string `json:"appId"`
	DisplayName  string `json:"displayName"`
	IsIdleScreen bool   `json:"isIdleScreen"`
	SessionId    string `json:"sessionId"`
	StatusText   string `json:"statusText"`
	TransportId  string `json:"transportId"`
}

type Conn

type Conn interface {
	Start(addr string, port int) error
	MsgChan() chan *pb.CastMessage
	Close() error
	SetDebug(debug bool)
	LocalAddr() (addr string, err error)
	Send(requestID int, payload Payload, sourceID, destinationID, namespace string) error
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection() *Connection

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) LocalAddr

func (c *Connection) LocalAddr() (addr string, err error)

func (*Connection) MsgChan

func (c *Connection) MsgChan() chan *pb.CastMessage

func (*Connection) Send

func (c *Connection) Send(requestID int, payload Payload, sourceID, destinationID, namespace string) error

func (*Connection) SetDebug

func (c *Connection) SetDebug(debug bool)

func (*Connection) Start

func (c *Connection) Start(addr string, port int) error

type CustomData

type CustomData struct {
	PlayerState int `json:"playerState"`
}

type Image

type Image struct {
	URL    string `json:"url"`
	Height int    `json:"height"`
	Width  int    `json:"width"`
}

type LaunchRequest

type LaunchRequest struct {
	PayloadHeader
	AppId string `json:"appId"`
}

type LoadMediaCommand

type LoadMediaCommand struct {
	PayloadHeader
	Media       MediaItem   `json:"media"`
	CurrentTime int         `json:"currentTime"`
	Autoplay    bool        `json:"autoplay"`
	QueueData   QueueData   `json:"queueData"`
	CustomData  interface{} `json:"customData"`
}

type Media

type Media struct {
	MediaSessionId int        `json:"mediaSessionId"`
	PlayerState    string     `json:"playerState"`
	CurrentTime    float32    `json:"currentTime"`
	IdleReason     string     `json:"idleReason"`
	Volume         Volume     `json:"volume"`
	CurrentItemId  int        `json:"currentItemId"`
	LoadingItemId  int        `json:"loadingItemId"`
	CustomData     CustomData `json:"customData"`

	Media MediaItem `json:"media"`
}

type MediaHeader

type MediaHeader struct {
	PayloadHeader
	MediaSessionId int     `json:"mediaSessionId"`
	CurrentTime    float32 `json:"currentTime"`
	RelativeTime   float32 `json:"relativeTime,omitempty"`
	ResumeState    string  `json:"resumeState"`
}

type MediaItem

type MediaItem struct {
	ContentId   string        `json:"contentId"`
	ContentType string        `json:"contentType"`
	StreamType  string        `json:"streamType"`
	Duration    float32       `json:"duration"`
	Metadata    MediaMetadata `json:"metadata"`
}

type MediaMetadata

type MediaMetadata struct {
	MetadataType int     `json:"metadataType"`
	Artist       string  `json:"artist"`
	Title        string  `json:"title"`
	Subtitle     string  `json:"subtitle"`
	Images       []Image `json:"images"`
	ReleaseDate  string  `json:"releaseDate"`
}

type MediaStatusResponse

type MediaStatusResponse struct {
	PayloadHeader
	Status []Media `json:"status"`
}

type Payload

type Payload interface {
	SetRequestId(id int)
}

type PayloadHeader

type PayloadHeader struct {
	Type      string `json:"type"`
	RequestId int    `json:"requestId,omitempty"`
}

func (*PayloadHeader) SetRequestId

func (p *PayloadHeader) SetRequestId(id int)

type QueueData

type QueueData struct {
	StartIndex int `json:"startIndex"`
}

type QueueLoad

type QueueLoad struct {
	PayloadHeader
	MediaSessionId int             `json:"mediaSessionId,omitempty"`
	CurrentTime    float32         `json:"currentTime"`
	StartIndex     int             `json:"startIndex"`
	RepeatMode     string          `json:"repeatMode"`
	Items          []QueueLoadItem `json:"items"`
}

type QueueLoadItem

type QueueLoadItem struct {
	Media            MediaItem `json:"media"`
	Autoplay         bool      `json:"autoplay"`
	PlaybackDuration int       `json:"playbackDuration"`
}

type QueueUpdate

type QueueUpdate struct {
	PayloadHeader
	MediaSessionId int `json:"mediaSessionId,omitempty"`
	Jump           int `json:"jump,omitempty"`
}

type ReceiverStatusRequest

type ReceiverStatusRequest struct {
	PayloadHeader
	Applications []Application `json:"applications"`

	Volume Volume `json:"volume"`
}

type ReceiverStatusResponse

type ReceiverStatusResponse struct {
	PayloadHeader
	Status struct {
		Applications []Application `json:"applications"`
		Volume       Volume        `json:"volume"`
	} `json:"status"`
}

type SetVolume

type SetVolume struct {
	PayloadHeader
	Volume Volume `json:"volume"`
}

type Volume

type Volume struct {
	Level float32 `json:"level,omitempty"`
	Muted bool    `json:"muted"`
}

Directories

Path Synopsis
Package api is a generated protocol buffer package.
Package api is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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