controllers

package
v0.0.0-...-f38834e Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const MediaControllerNamespace string = "urn:x-cast:com.google.cast.media"
View Source
const SystemEventPing string = "PING"
View Source
const SystemEventPong string = "PONG"

Variables

This section is empty.

Functions

func NewMediaConnection

func NewMediaConnection(client *primitives.Client, receiverController *ReceiverController, namespace string, sourceID string) *mediaConnection

NewMediaConnection constructor for application sessions.

Types

type ApplicationData

type ApplicationData struct {
	ID        string //ID used for application to be launched/manipulated on chromecast.
	Namespace string //Namespace for communication channel for application on chromecast.
}

ApplicationData describes the connection information about an application you can run on a chromecast.

type ConnectionController

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

ConnectionController is for basic connect and close caommands connection to a chromecast

func NewConnectionController

func NewConnectionController(client *primitives.Client, sourceID, destinationID string) *ConnectionController

NewConnectionController constructor for connection controllers

func (*ConnectionController) Close

func (c *ConnectionController) Close()

Close is the final command to close a connection to a chromecast

func (*ConnectionController) Connect

func (c *ConnectionController) Connect()

Connect is initial command to create a connection to a chromecast

type DashCastController

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

DashCastController is the controller for the commands unique to the dashcast.

func NewDashCastController

func NewDashCastController(client primitives.Client, sourceID, destinationID string) *DashCastController

NewDashCastController is a constructor for a dash cast controller.

func (*DashCastController) Load

func (d *DashCastController) Load(url string, reloadTime time.Duration, forceLaunch bool) error

Load loads a url, reloads it every few seconds. Forces launch of the url if you tell it to. Setting force to True may load pages which block iframe embedding, but will prevent reload from working and will cause calls to load_url() to reload the app.

type HeartbeatController

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

HeartbeatController is used to maintain a connection to a chromecast via sending keepalive messages.

func NewHeartbeatController

func NewHeartbeatController(client *primitives.Client, sourceID, destinationID string) *HeartbeatController

NewHeartbeatController is a constructor for a heartbeat controller.

func (*HeartbeatController) Start

func (c *HeartbeatController) Start()

Start begins the keepalive event stream. Essentially, we send a ping event, then the chromecast will start sending pongs back. We would then need to consistently return ping events every specified interval period.

func (*HeartbeatController) Stop

func (c *HeartbeatController) Stop()

Stop maintaining the keepalive.

type InitializationError

type InitializationError struct {
}

InitializationError struct for initialization failure of youtube/chromecast applications.

func (InitializationError) Error

func (e InitializationError) Error() string

type MediaController

type MediaController struct {
	Incoming       chan []*media.MediaStatus
	MediaSessionID int
	// contains filtered or unexported fields
}

MediaController is a type of chromecast controller. Use it to load, play, pause, stop media. Use it to enable or disable subtitles.

func NewMediaController

func NewMediaController(client *primitives.Client, sourceID string, receiverController *ReceiverController) *MediaController

NewMediaController is the constructors for the media controller

func (*MediaController) DisableSubtitles

func (c *MediaController) DisableSubtitles(timeout time.Duration) (*api.CastMessage, error)

TODO DisableSubtitles sends the disable subtitles command to the chromecast

func (*MediaController) EnableSubtitles

func (c *MediaController) EnableSubtitles(timeout time.Duration) (*api.CastMessage, error)

TODO EnableSubtitles sends the enable subtitles command to the chromecast

func (*MediaController) GetStatus

func (c *MediaController) GetStatus(timeout time.Duration) ([]*media.MediaStatus, error)

GetStatus attempts to request the chromecast return the status of the current media controller channel

func (*MediaController) Load

func (c *MediaController) Load(url string, contentTypeString string, timeout time.Duration) (*api.CastMessage, error)

TODO Load sends a load request to play a generic media event

func (*MediaController) Next

func (c *MediaController) Next(timeout time.Duration) (*api.CastMessage, error)

Next goes to the next video

func (*MediaController) Pause

func (c *MediaController) Pause(timeout time.Duration) (*api.CastMessage, error)

Pause sends the pause command to the chromecast

func (*MediaController) Play

func (c *MediaController) Play(timeout time.Duration) (*api.CastMessage, error)

Play sends the play command so that the chromecast session is resumed

func (*MediaController) Previous

func (c *MediaController) Previous(timeout time.Duration) (*api.CastMessage, error)

Previous goes to the previous video

func (*MediaController) Rewind

func (c *MediaController) Rewind(timeout time.Duration) (*api.CastMessage, error)

Rewind to the beginning.

func (*MediaController) Seek

func (c *MediaController) Seek(seconds float64, timeout time.Duration) (*api.CastMessage, error)

Seek to some time in the video

func (*MediaController) Skip

func (c *MediaController) Skip(timeout time.Duration) (*api.CastMessage, error)

Skip to the end

func (*MediaController) Stop

func (c *MediaController) Stop(timeout time.Duration) (*api.CastMessage, error)

Stop sends the stop command to the chromecast

type ReceiverController

type ReceiverController struct {
	Incoming chan *receiver.ReceiverStatus
	// contains filtered or unexported fields
}

ReceiverController is a chromecast controller for the receiver namespace. This involves

func NewReceiverController

func NewReceiverController(client *primitives.Client, sourceID, destinationID string) *ReceiverController

NewReceiverController is for building a new receiver controller

func (*ReceiverController) GetStatus

func (c *ReceiverController) GetStatus(timeout time.Duration) (*receiver.ReceiverStatus, error)

GetStatus attempts to receive the current status of the controllers chromecast device.

func (*ReceiverController) GetVolume

func (c *ReceiverController) GetVolume(timeout time.Duration) (*receiver.Volume, error)

GetVolume gets the volume on the controller's chromecast.

func (*ReceiverController) LaunchApplication

func (c *ReceiverController) LaunchApplication(appID *string, timeout time.Duration, forceLaunch bool)

LaunchApplication attempts to launch an application on the chromecast. forceLaunch forces the app to run even if something is already running.

func (*ReceiverController) SetVolume

func (c *ReceiverController) SetVolume(volume *receiver.Volume, timeout time.Duration) (*api.CastMessage, error)

SetVolume sets the volume on the controller's chromecast.

func (*ReceiverController) StopApplication

func (c *ReceiverController) StopApplication(sessionID *string, timeout time.Duration)

TODO: so application termination requires sessionID, need to figure out how to rewrite code to work with that. Actually, you know what? we could do it so that there is a wrapper that sends requests to these thingies.

type YoutubeController

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

YoutubeController is the controller for the commands unique to the dashcast.

func NewYoutubeController

func NewYoutubeController(client *primitives.Client, sourceID string, receiver *ReceiverController) *YoutubeController

NewYoutubeController is a constructor for a dash cast controller.

func (*YoutubeController) AddToQueue

func (c *YoutubeController) AddToQueue(videoID string)

AddToQueue adds the video to the end of the current playlist

func (*YoutubeController) ClearPlaylist

func (c *YoutubeController) ClearPlaylist()

ClearPlaylist of current videos in the chromecast playlist

func (*YoutubeController) PlayNext

func (c *YoutubeController) PlayNext(videoID string)

PlayNext adds a video to be played next in the current playlist

func (*YoutubeController) PlayVideo

func (c *YoutubeController) PlayVideo(videoID string, listID string) error

PlayVideo initializes a new queue and plays the video

func (*YoutubeController) RemoveFromQueue

func (c *YoutubeController) RemoveFromQueue(videoID string)

RemoveFromQueue removes a video from the video playlist

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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