Code Monkey home page Code Monkey logo

goplay2's Introduction

OpenAirplay 0.0.32

Stream from a Linux computer to an Airplay Receiver.

OpenAirplay is a python implementation of the Apple Airplay client, intended to mimic the OSX Airplay integration.

I have always been annoyed about how iOS, Mac OSX, and all of Apples proprietary hardware/software has inhibited so many of us technology savvy people.

Project Status:

No longer under active development.

I no longer attend my highschool full of Apple devices, so I have no platform to test this project on.

If someone wants to fund this project, buy me a 2nd gen Apple TV or later so I can actually get back to work on this project.

Otherwise, I have no need or ability to continue development, so if you are able and willing, send over some PRs or code edits.

https://github.com/robobenklein/openairplay/milestones

Project Details:

Right now it's Python 3 using the QT system from PyQt4.
It is designed in an Ubuntu Unity environment, but the application should work on any platform with Python 3 and a system tray.
From my last testing, this ran fine on my Dad's Windows 8 laptop, and I've tested Ubuntu 14.04 to 15.10.

Requirements:

See the dependencies.md file for installing the needed software.

Why I'm doing this:

(From 2015:)
I go to a school where everyone has iPads as their learning tool, which are horrid for coding/programming and software development, but make a good classroom common tool. As a result, there is an Apple TV in every single room for the students to quickly present whatever is on their screen, and the teachers can show their presentations with their assigned Macbooks.

I am one of two people at this school who use Linux (Ubuntu) and who bring their laptops every day. I use mine for school work fairly often, as I understand how much I can do in Linux and not iOS. But whenever some task comes up where I'd need to airplay my work to an Apple TV, I'm being restrained to my iPad.

What this aims to be:

This application is designed to sit in your System Tray just like in OSX, with a drop down list of available Airplay Recievers, and allow you to:

  • Stream your desktop
  • Send a photo/picture
  • Play a video
  • Stream Music
    And whatever else the users and developers of this project wish it to be.

Want to help?

I'm always looking for contributors, if you can help with any of these I'd love to work with you.

  • Python network discovery protocols (for finding listings of devices)
  • Airplay/Media protocols
  • Python Qt (thinking about things like screen capture)
  • And developers to help make this work for non-Ubuntu OSs.

goplay2's People

Contributors

albanseurat avatar dubo-dubon-duponey avatar eliseomartelli avatar noelhibbard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goplay2's Issues

Thanks for making this a reality! Requests: Multiple instances, Audio output routing, Volume Control

Extremely excited about this initiative. Thanks so much for all the work you're putting into this. Tested it out on OSX and got it working no problem.

My use case is that I'd love to be able to run several airplay receivers at the same time with different names and then route audio to from each to different virtual devices. I could do the routing in a separate program like Loopback but would need to be able to direct the output of goplay to a specific output device (ex. "audio capture 1").

Let me know if this is possible. I think the features needed would be:

  1. Running goplay on different ports so you can run multiple instances (command line param?)
  2. Pointing audio output at a specific output device
  3. Unrelated but I noticed that changing the volume doesn't do anything. Is this something that could be supported so you can still control volume from the sending device?

Random question out of curiosity, why do all apps work except Spotify?

Thanks again and happy to help test.

Build fails on Mac OS

arya@Aryas-Mac-mini goplay2 % neofetch
                    'c.          [email protected]
                 ,xNMM.          -------------------------
               .OMMMMo           OS: macOS 11.6 20G165 arm64
               OMMM0,            Host: Macmini9,1
     .;loddo:' loolloddol;.      Kernel: 20.6.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 1 hour, 18 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 126 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: iTerm2
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: Monaco 12
    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Apple M1
       .cooc,.    .,coo:.        Memory: 1381MiB / 8192MiB




arya@Aryas-Mac-mini goplay2 % brew install portaudio fdk-aac go
Updating Homebrew...
Warning: portaudio 19.7.0 is already installed and up-to-date.
To reinstall 19.7.0, run:
  brew reinstall portaudio
Warning: fdk-aac 2.0.2 is already installed and up-to-date.
To reinstall 2.0.2, run:
  brew reinstall fdk-aac
Warning: go 1.17.2 is already installed and up-to-date.
To reinstall 1.17.2, run:
  brew reinstall go

arya@Aryas-Mac-mini goplay2 % go build
# goplay2/codec
codec/aac.go:32:10: fatal error: 'aacdecoder_lib.h' file not found
#include "aacdecoder_lib.h"
         ^~~~~~~~~~~~~~~~~~
1 error generated.

Error after several minutes

Hello, after 45min - 1 hours
I have a lot of error
Capture d’écran 2021-08-23 à 00 23 59
I have take testing on divers Apple Device. I think this issue can come when divers Apple devices is connected in same time AirPlay.

Sorry for bad english :)

Dockerfile broken

Hey Alban

Thanks a lot for this project!!!

Seems like the provided Dockerfile currently does not build (no makefile).

Happy to send a PR for a working one though.

build failure on Raspberry Pi B+

Architecture: armv7l

pi@raspBplus-api:~/Development/goplay2 $ cat /etc/issue
Raspbian GNU/Linux 10 \n \l

pi@raspBplus-api:~/Development/goplay2 $ go version
go version go1.16.6 linux/arm

pi@raspBplus-api:~/Development/goplay2 $ ./goplay2 -i eth0 -n pitunes

2021/08/04 23:38:56 pitunes/config.json is not valid - at new file will be created at program exit
2021/08/04 23:38:56 Starting goplay for device Pi: 24e650f4-3d3f-4832-ad39-6a1c3bff81a6, guid: 24e650f4-3d3f-4832-ad39-6a1c3bff81a6, Psi: 24e650f4-3d3f-4832-ad39-6a1c3bff81a6
2021/08/04 23:38:56 dial unix /run/user/1000/pulse/native: connect: no such file or directory
2021/08/04 23:38:56 Warning : impossible to store config file pitunes/config.json
panic: dial unix /run/user/1000/pulse/native: connect: no such file or directory

goroutine 1 [running]:
log.Panic(0x293deb0, 0x1, 0x1)
	/usr/local/go/src/log/log.go:354 +0x84
goplay2/codec.NewStream(0x2f8f00, 0x64)
	/home/pi/Development/goplay2/codec/pulseaudio.go:45 +0x80
goplay2/audio.NewPlayer(0x289a828, 0x28980c0, 0x147ae)
	/home/pi/Development/goplay2/audio/player.go:32 +0x40
main.main()
	/home/pi/Development/goplay2/main.go:71 +0x950

What am I missing?

Failed building docker image on Raspi 4

The docker build makes it to Step 5/10. The trouble seems to begin at go test.

go build
go test
--- FAIL: TestLcEncode (0.00s)
    enc_test.go:120: Flush failed, size is 195
--- FAIL: TestLcFlush (0.00s)
    enc_test.go:208: Flush failed, size is 195
--- FAIL: ExampleAacEncoder_LC (0.00s)
got:
FrameSize: 1024
AAC: 139
AAC: 227
Flushing
AAC: 195
AAC: 173
AAC: 0
want:
FrameSize: 1024
AAC: 139
AAC: 227
Flushing
AAC: 195
AAC: 176
AAC: 0
FAIL
exit status 1
FAIL	github.com/albanseurat/go-fdkaac	0.031s
make[1]: *** [Makefile:13: test] Error 1
make[1]: Leaving directory '/go/pkg/mod/github.com/albanseurat/[email protected]'
make: *** [Makefile:6: deps] Error 2
The command '/bin/sh -c GOOS=linux make' returned a non-zero code: 2

SIGSEGV when switching songs fast

When switching song fast I get a segfault. After looking at Filter on audio/ring.go I didn't see anything wrong (I'm not that experienced in Go, tbh).

I'm running features/audio-sync commit d110dd6

If you need any other info I'll gladly provide everything needed.

Have a nice day!

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4216b9d]

goroutine 10 [running]:
container/list.(*Element).Next(...)
	/usr/local/Cellar/go/1.16.6/libexec/src/container/list/list.go:32
goplay2/audio.(*Ring).Filter(0xc000216000, 0xc000285ea0)
	/Users/eliseomartelli/Projects/goplay2/audio/ring.go:155 +0x13d
goplay2/audio.(*Player).skipUntil(0xc000012a50, 0x0, 0xb6cb71)
	/Users/eliseomartelli/Projects/goplay2/audio/player.go:123 +0x105
goplay2/audio.(*Player).Run(0xc000012a50)
	/Users/eliseomartelli/Projects/goplay2/audio/player.go:110 +0x485
main.main.func1(0xc000012a50, 0xc00001cfa0)
	/Users/eliseomartelli/Projects/goplay2/main.go:71 +0x2b
created by main.main
	/Users/eliseomartelli/Projects/goplay2/main.go:70 +0x97d

Stopped working with iOS version 15.1

arya@Aryas-Mac-mini goplay2 % ./goplay2 -n Airplay2 -i en0
2021/10/27 13:10:07 Airplay2/config.json is not valid - at new file will be created at program exit
2021/10/27 13:10:07 Starting goplay for device Pi: bf832c73-77c2-47b5-9212-544192fb2a17, guid: bf832c73-77c2-47b5-9212-544192fb2a17, Psi: bf832c73-77c2-47b5-9212-544192fb2a17
2021/10/27 13:11:29 request received : GET /info body 70
2021/10/27 13:11:29 response sent : body 374
2021/10/27 13:11:29 request received : POST /pair-verify body 37
2021/10/27 13:11:29 response sent : body 140
2021/10/27 13:11:29 request received : POST /pair-setup body 6
2021/10/27 13:11:29 response sent : body 409
2021/10/27 13:11:29 request received : POST /pair-setup body 457
2021/10/27 13:11:29 response sent : body 69
2021/10/27 13:11:29 request received : POST /pair-setup body 159
2021/10/27 13:11:29 response sent : body 143
2021/10/27 13:11:29 request received : POST /pair-verify body 37
2021/10/27 13:11:29 server.go:82: Error:Error handling RSTP request Invalid internal pairing verify step Waiting

Issues with CFLAGS and LDFLAGS

Hey @AlbanSeurat

This https://github.com/openairplay/goplay2/blob/main/codec/aac.go#L27-L30 is problematic.

  • on linux, the use of a static version of libfdk is forced
  • on mac & linux, the path information (-I, -L) may or may not work / make sense, override proper system values to something undesirable

Both points are problematic for cross-compilation and for systems that do not ship a static version of libfdk - typically Debian Buster in the Dockerfile already requires live-patching the source (https://github.com/openairplay/goplay2/pull/19/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R9)

Suggestion would be to leave the responsibility of picking these to the build system / command (eg: "-extldflags -static(-pie)") for people who would really want to be specific about these.

For most normal people, things will just continue building by default, and this should make life easier for advanced users (looking for cross-compilation, or more control over static vs. dynamic).

Let me know your thoughts and if you agree I can send a small PR to change that.

Don't run.

Hello, this is my issue
pi@raspberrypi:/home/raye/goplay2 $ ./goplay2 -sink default:b1

2021/08/22 19:15:04 goplay/config.json is not valid - at new file will be created at program exit
2021/08/22 19:15:04 Starting goplay for device Pi: ca7e2ab8-ff55-49a2-b6ae-84385eb0323e, guid: ca7e2ab8-ff55-49a2-b6ae-84385eb0323e, Psi: ca7e2ab8-ff55-49a2-b6ae-84385eb0323e
2021/08/22 19:15:04 dial unix /run/user/1000/pulse/native: connect: connection refused
2021/08/22 19:15:04 Warning : impossible to store config file goplay/config.json
panic: dial unix /run/user/1000/pulse/native: connect: connection refused

goroutine 1 [running]:
log.Panic(0xd3feb0, 0x1, 0x1)
/usr/local/go/src/log/log.go:354 +0x84
goplay2/codec.NewStream(0x2875b8, 0x64)
/home/raye/goplay2/codec/pulseaudio.go:45 +0x80
goplay2/audio.NewPlayer(0xc9e438, 0xc94150, 0x147ae)
/home/raye/goplay2/audio/player.go:32 +0x40
main.main()
/home/raye/goplay2/main.go:71 +0x950

What it's wrong ? Thanks

Unable to Pair on iOS 15 beta 6

It seems like something has changed in the pairing mechanism for the latest iOS beta. On attempted casting the following is logged with an error Unable to connect:

2021/08/24 18:50:45 request received : GET /info body 70
2021/08/24 18:50:45 response sent : body 374
2021/08/24 18:50:45 request received : POST /pair-verify body 37
2021/08/24 18:50:45 response sent : body 140
2021/08/24 18:50:45 request received : POST /pair-setup body 6
2021/08/24 18:50:45 response sent : body 409
2021/08/24 18:50:45 request received : POST /pair-setup body 457
2021/08/24 18:50:45 response sent : body 69
2021/08/24 18:50:45 request received : POST /pair-setup body 159
2021/08/24 18:50:45 response sent : body 143
2021/08/24 18:50:45 request received : POST /pair-verify body 37
2021/08/24 18:50:45 server.go:82: Error:Error handling RSTP request Invalid internal pairing verify step Waiting

When paired through the home app there are no errors. However the following is in the log:

2021/08/24 18:57:20 request received : POST /configure body 148
2021/08/24 18:57:20 response sent : body 237
2021/08/24 18:57:20 request received : TEARDOWN rtsp://192.168.1.73/7350123517057450268 body 42
2021/08/24 18:57:20 response sent : body 0
2021/08/24 18:57:20 server.go:37: Error:Event error : EOF
2021/08/24 18:57:20 server.go:76: Error:Error parsing RSTP request EOF 

And the same error when trying to cast.

Casting works on iOS 14.7.1 and macOS devices.

After some seconds or song change, sound is gone

Hi,

tried the latest version. Music App is working, Spotify I dont get any sound at all.
When I'm listening around 40seconds later the sound is gone. And need to reconnect to get it back.
I have built it on a Raspberry PI 3B. Any ideas?
This is the log:

2021/07/28 16:13:28 Starting goplay for device Pi: bca06227-f4ab-48b7-8dcb-f51203092507, guid: bca06227-f4ab-48b7-8dcb-f51203092507, Psi: bca06227-f4ab-48b7-8dcb-f51203092507


2021/07/28 16:13:35 request received : GET /info body 70
2021/07/28 16:13:35 response sent : body 374
2021/07/28 16:13:35 request received : POST /pair-verify body 37
2021/07/28 16:13:35 response sent : body 140
2021/07/28 16:13:35 request received : POST /pair-verify body 106
2021/07/28 16:13:35 response sent : body 3
2021/07/28 16:13:35 request received : POST /fp-setup body 16
2021/07/28 16:13:35 response sent : body 142
2021/07/28 16:13:35 request received : POST /fp-setup body 164
2021/07/28 16:13:35 response sent : body 32
2021/07/28 16:13:35 request received : SETUP rtsp://192.168.1.163/3208386018501087130 body 1044
2021/07/28 16:13:35 response sent : body 76
2021/07/28 16:13:35 request received : GET /info body 0
2021/07/28 16:13:35 response sent : body 374
2021/07/28 16:13:35 request received : GET_PARAMETER rtsp://192.168.1.163/3208386018501087130 body 8
2021/07/28 16:13:35 response sent : body 20
2021/07/28 16:13:35 request received : RECORD rtsp://192.168.1.163/3208386018501087130 body 0
2021/07/28 16:13:35 response sent : body 0
2021/07/28 16:13:35 request received : SETPEERS rtsp://192.168.1.163/3208386018501087130 body 128
2021/07/28 16:13:35 response sent : body 0
2021/07/28 16:13:35 request received : POST /command body 5873
2021/07/28 16:13:35 response sent : body 0
2021/07/28 16:13:35 request received : SETUP rtsp://192.168.1.163/3208386018501087130 body 271
2021/07/28 16:13:35 response sent : body 151
2021/07/28 16:13:35 request received : POST /audioMode body 64
2021/07/28 16:13:35 response sent : body 0
2021/07/28 16:13:36 request received : SETRATEANCHORTIME rtsp://192.168.1.163/3208386018501087130 body 190
2021/07/28 16:13:36 response sent : body 0
2021/07/28 16:13:36 request received : POST /command body 5873
2021/07/28 16:13:36 response sent : body 0
2021/07/28 16:13:37 request received : POST /feedback body 0
2021/07/28 16:13:37 response sent : body 0
---
021/07/28 16:16:57 response sent : body 0
2021/07/28 16:16:59 request received : POST /feedback body 0
2021/07/28 16:16:59 response sent : body 0
2021/07/28 16:17:00 request received : SETRATEANCHORTIME rtsp://192.168.1.163/3208386018501087130 body 53
2021/07/28 16:17:00 response sent : body 0
2021/07/28 16:17:01 request received : POST /feedback body 0
2021/07/28 16:17:01 response sent : body 0
2021/07/28 16:17:03 request received : POST /feedback body 0
2021/07/28 16:17:03 response sent : body 0
2021/07/28 16:17:05 request received : POST /feedback body 0
2021/07/28 16:17:05 response sent : body 0
2021/07/28 16:17:07 request received : POST /feedback body 0
2021/07/28 16:17:07 response sent : body 0
2021/07/28 16:17:09 request received : POST /feedback body 0
2021/07/28 16:17:09 response sent : body 0
---

ALSA output

I see this thing is hard coded for pcm.default for the ALSA output. It would be great to have a command line option for the ALSA output. A cmd line option for the listen port would also be great. I have a few 7.1 ch sound cards in my server and have an elaborate ALSA config that busts them up into several outputs and then I run several instances of shairport-sync and each one is on it's own port and set to output to different ALSA outputs. I would love to be able to do this with AirPlay 2.

Feature request: ability to have configuration in a user specified directory

Right now, the config is always stored under $(pwd)/$name

Having the flexibility to point to a completely different base directory where to store config would be nice and particularly useful in the context of hardened docker images where typically only a specific volume is rw while the rest of the image is read-only.

I'll send a PR as a suggestion to allow this.

Audio delay with HomePod Mini

Hi there,

Audio is great when used on the single speaker but if I try to play on multiple devices such as a HomePod Mini the audio sync is somewhat off. Is this normal? I understand you mentioned improving the multi-room sync somewhere so if it's an issue that will be fixed at some point that's fine and I understand, I was mostly curious if it's something I have done wrong or I can fix on my end.

Thanks in advance

"Error parsing RSTP request close tcp4" when playing to two GoPlay2 devices at once

I have GoPlay2 setup on two Raspberry Pi's right now (a 3 and a 4). Both are on the same network and I have no trouble playing to each one individually. However, when I try to play to both at once from an iPhone, the following error is thrown and they both disconnect:

2021/08/20 14:52:29 server.go:37: Error:Event error : EOF
2021/08/20 14:52:29 server.go:76: Error:Error parsing RSTP request close tcp4 192.168.1.67:7000->192.168.1.64:52259: use of closed network connection
2021/08/20 14:52:29 server.go:76: Error:Error parsing RSTP request close tcp4 192.168.1.67:7000->192.168.1.64:52259: use of closed network connection
2021/08/20 14:52:29 server.go:37: Error:Event error : EOF

In the above error, .67 is the Pi throwing the error and .64 is the phone playing the music.

Also of possible significance, when I attempted to add each device to the Home app, I saw the following error in the log (though they were both added to the app just fine):

2021/08/20 14:51:27 server.go:37: Error:Event error : EOF
2021/08/20 14:51:27 server.go:76: Error:Error parsing RSTP request EOF

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.