Go bindings for AirPlay client
import "github.com/gongo/go-airplay"
client, err := airplay.FirstClient()
if err != nil {
log.Fatal(err)
}
ch := client.Play("http://movie.example.com/go.mp4")
// Block until have played content to the end
<-chIf device is required password:
client.SetPassword("password")Specifying the start position:
// Start from 42% of length of content.
client.PlayAt("http://movie.example.com/go.mp4", 0.42)Other API:
// Seek to 120 seconds from start position.
client.Scrub(120.0)
// Change playback rate
client.Rate(0.0) // pause
client.Rate(1.0) // resumeSee:
// local file
client.Photo("/path/to/gopher.jpg")
// remote file
client.Photo("http://blog.golang.org/gopher/plush.jpg")You can specify the transition want to slide:
client.Photo("/path/to/gopher.jpg", airplay.SlideNone) // eq client.Photo("..")
client.Photo("/path/to/gopher.jpg", airplay.SlideDissolve)
client.Photo("/path/to/gopher.jpg", airplay.SlideRight)
client.Photo("/path/to/gopher.jpg", airplay.SlideLeft)See example/slideshow :
// Get all AirPlay devices in LAN.
devices := airplay.Devices()
// Get the first found AirPlay device in LAN.
device := airplay.FirstDevice()See example/devices :