cast

package module
v0.0.0-...-700dddc Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: MIT Imports: 9 Imported by: 7

README

gochromecast

GoDoc Go Report Card Build Status

Description

Library for using chromecast. Contains partial implementations for media player controls, and youtube controls.

Usage

To install the library, run go get github.com/AndreasAbdi/gochromecast

Examples

// A simple example, showing how to find a Chromecast using mdns, and request its status.
package main

import (
"time"
"github.com/AndreasAbdi/gochromecast"
)

func main() {
    devices := make(chan *cast.Device, 100)
    cast.FindDevices(time.Second*5, devices)
    for device := range devices {
        device.PlayMedia("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", "video/mp4")
        time.Sleep(time.Second * 5)
        device.MediaController.Pause(time.Second * 5)
        device.QuitApplication(time.Second * 5)
    }
}

For more examples of how to use it, see the examples folder.

References

References listed in docs. Ported from

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindDevices

func FindDevices(timeout time.Duration, devices chan<- *Device)

FindDevices searches the LAN for chromecast devices via mDNS and sends them to a channel.

Types

type Device

type Device struct {
	ReceiverController *controllers.ReceiverController
	MediaController    *controllers.MediaController
	YoutubeController  *controllers.YoutubeController
	// contains filtered or unexported fields
}

Device Object to run basic chromecast commands

func NewDevice

func NewDevice(host net.IP, port int) (Device, error)

NewDevice is constructor for Device struct

func (*Device) GetMediaStatus

func (device *Device) GetMediaStatus(timeout time.Duration) []*media.MediaStatus

GetMediaStatus of current media controller

func (*Device) GetStatus

func (device *Device) GetStatus(timeout time.Duration) *receiver.Status

GetStatus of the device.

func (*Device) Play

func (device *Device) Play()

Play just plays.

func (*Device) PlayMedia

func (device *Device) PlayMedia(URL string, MIMEType string)

PlayMedia plays a video via the media controller.

func (*Device) PlayYoutubeVideo

func (device *Device) PlayYoutubeVideo(videoID string)

PlayYoutubeVideo launches the youtube app and tries to play the video based on its id.

func (*Device) QuitApplication

func (device *Device) QuitApplication(timeout time.Duration)

QuitApplication that is currently running on the device

Directories

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

Jump to

Keyboard shortcuts

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