go-chromecast icon indicating copy to clipboard operation
go-chromecast copied to clipboard

Request: play local stream from pipe

Open fungs opened this issue 5 years ago • 4 comments

Hey, I'm trying to connect go-chromecast with mopidy, using it as an audio sink. The way other programs work are by playing media from a pipe (fifo) or via standard input. It seems that is not currently possible with go-chromecast. Of course, this mode has limited seek possibilities.

fungs avatar Oct 28 '20 22:10 fungs

Hello! There is go-chromecast transcode --command="/usr/bin/command" which will run the command and pipe the output via a HTTP response to the Chromecast, would this work for your use-case?

vishen avatar Oct 29 '20 20:10 vishen

I tried go-chromecast transcode --command="cat /tmp/fifo" and piped an mp3 into the fifo but that did not work.

unable to transcode media: command and content-type flags needs to be set when transcoding.

fungs avatar Nov 04 '20 10:11 fungs

Sorry, it needs the --content-type flag set as well (since it is currently unable to determine the media type). Does setting a content type work?

vishen avatar Nov 08 '20 22:11 vishen

Thanks for your hints, this seems to work

mkfifo /tmp/stream
cat test.mp3 > /tmp/stream
go-chromecast transcode --content-type audio/mp3 --command="cat /tmp/stream" -n speaker_id

So basically, do use go-chromecast I would have to write a helper application that would detect if a buffer is filled and what the content type would be and instruct go-chromecast to play from the buffer. I think it would probably be easier to write the input to a cache file with correct media type and let go-chromecast play that file than using the transcode workaround.

When I experimented with mopidy using a pipe as output and forked-daapd as chromecast broadcasting backend, I noted that it is able to detect media type and even volume change through the pipe. I wonder what kind of format was written to the pipe. It seems very usable when you want to integrate different audio components via streaming.

fungs avatar Nov 15 '20 12:11 fungs