Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Now Playing" video feed #43

Open
DJay-X opened this issue Jun 8, 2017 · 12 comments
Open

"Now Playing" video feed #43

DJay-X opened this issue Jun 8, 2017 · 12 comments

Comments

@DJay-X
Copy link

DJay-X commented Jun 8, 2017

First of all thanks for your great work and sharing. @SphtKr

I use homebridge-itunes with a second homebridge (1st and main is on a Raspi).
Everything works great. macOS 10.12.5 iTunes 12.6.1.25 with an Apple TV 4 to AirPlay to, a Speaker in the Bedroom and one in the Bathroom.
Now I was curious about the "Now Playing" video feed.
I installed the homebridge-camera-ffmpeg plugin, added the lines in the config.json and after a restart the "camera" in the Eve App.
Then I find a switch "Now Playing" in the App but can't figure out how it works?! There is no picture what I would expect. What am I doing wrong?

Do I have to change the line into something other and into what?
"source": "-re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg",

And when I have fixes this thanks to your support, I was wondering if there would be any chance to see Artwork of a track or album playing as still image in the future?

Thanks in advance for your help and reply.

@martinorob
Copy link

Add

"enable_now_playing": "true",

to the iTunes now playing platforms!

Example:

{
"platform": "Camera-ffmpeg",
"enable_now_playing": "true",
"cameras": [{
"name": "iTunes Now Playing",
"videoConfig": {
"source": "-re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg",
"maxStreams": 2,
"maxWidth": 480,
"maxHeight": 480,
"maxFPS": 2
}
}

@DJay-X
Copy link
Author

DJay-X commented Oct 5, 2017

@martinorob Thanks a lot for your reply. With your help I was able to add a Camera "Now Playing" to my Home App. But unfortunately not showing anything.
I use this instance of Homebridge on my iMac only with homebridge-itunes and now homebridge-camera-ffmpeg. So my config.json on the Mac is sort of clearly arranged. :)
Could the "source" be the mistake? I'm completely unaware of where the .jpg is.
Thanks again.

{
    "bridge": {
        "name": "Mac Homebridge",
        "username": "BB:22:3D:F3:CF:31",
        "port": 12345,
        "pin": "123-45-678"
    },
    "accessories": [
                                        ],
    
    "platforms": [
                  {
                  "platform": "iTunes",
                  "enable_now_playing": "true"
                  },
                  {
                  "platform": "Camera-ffmpeg",
                  "cameras": [
                              {
                              "name": "Now Playing",
                              "videoConfig": {
                              "source": "-re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg",
                              "maxStreams": 2,
                              "maxWidth": 480,
                              "maxHeight": 480,
                              "maxFPS": 2
                              }
                              }
                              ]
                  }
                  ]
}

@martinorob
Copy link

martinorob commented Oct 5, 2017

Your configuration is broken.

{
    "bridge": {
        "name": "Mac Homebridge",
        "username": "BB:22:3D:F3:CF:31",
        "port": 12345,
        "pin": "123-45-678"
    },
    "accessories": [
                                        ],
    
    "platforms": [
                  {
                  "platform": "iTunes",
                 WRONG ->>>>>> "enable_now_playing": "true"
                  },
                  {
                  "platform": "Camera-ffmpeg",
 OK!!!->>>>>> "enable_now_playing": "true",
                     "cameras": [
                              {
                              "name": "Now Playing",
                              "videoConfig": {
                              "source": "-re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg",
                              "maxStreams": 2,
                              "maxWidth": 480,
                              "maxHeight": 480,
                              "maxFPS": 2
                              }
                              }
                              ]
                  }
                  ]
}

then simply create a fake jpg file with

touch /tmp/homebridge-itunes-nowplaying.jpg

then kill Homebridge and restart Homebridge.
open your Now Playing webcam from the Home app (to view it on fullscreen and also to refresh the image).

@DJay-X
Copy link
Author

DJay-X commented Oct 7, 2017

Thanks again. But unfortunately I'm not sure what I am doing wrong. 😕🤷🏼‍♂️
When I check Finder, in the directory /tmp/ there is the homebridge-itunes-nowplaying.jpg I created. But always just with the time I created it. So it's not updating. Also there is a new file homebridge-itunes-nowplaying.txt which is updating steady with the playing state, titele etc. while playing a song in iTunes. But in the Home app the Camera "Now Playing" always shows no response with the crossed out camera symbol. 🤔
Thank in advance for any further support.

    "platforms": [
                  {
                  "platform": "iTunes"
                  },
                  {
                  "platform": "Camera-ffmpeg",
                  "enable_now_playing": "true",
                  "cameras": [
                              {
                              "name": "Now Playing",
                              "videoConfig": {
                              "source": "-re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg",
                              "maxStreams": 2,
                              "maxWidth": 480,
                              "maxHeight": 480,
                              "maxFPS": 2
                              }
                              }
                              ]
                  }
                  ]
}

@martinorob
Copy link

Do you have https://github.com/khaost/homebridge-camera-ffmpeg installed true?

@DJay-X
Copy link
Author

DJay-X commented Oct 8, 2017

I'm not sure what you mean by "true"?

├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

Installed on my iMac
sudo npm install -g homebridge-camera-ffmpeg

Anything special I have to take notice of?

@martinorob
Copy link

What do you see in debug log?

https://github.com/nfarina/homebridge/wiki/Basic-Trouble-Shooting

@DJay-X
Copy link
Author

DJay-X commented Oct 9, 2017

Hmm.. what should I look for? Anything specific?
Here's snipped of the debug log.
I appreciate your time you are investing and your help @martinorob

[2017-10-9 21:35:47] Loaded plugin: homebridge-camera-ffmpeg
[2017-10-9 21:35:47] Registering platform 'homebridge-camera-ffmpeg.Camera-ffmpeg'
[2017-10-9 21:35:47] ---
[2017-10-9 21:35:47] Loaded plugin: homebridge-itunes
[2017-10-9 21:35:47] Registering platform 'homebridge-itunes.iTunes'
[2017-10-9 21:35:47] ---
[2017-10-9 21:35:47] Loaded config.json with 0 accessories and 2 platforms.
[2017-10-9 21:35:47] ---
[2017-10-9 21:35:47] Loading 2 platforms...
[2017-10-9 21:35:47] [iTunes] Initializing iTunes platform...
[2017-10-9 21:35:47] [Camera-ffmpeg] Initializing Camera-ffmpeg platform...
[2017-10-9 21:35:47] Loading 0 accessories...
  iTunes Queue depth 1 +0ms
  iTunes tell application "iTunes" to get player state +1ms
  iTunes Queue depth 1 +6ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 31) +0ms
  iTunes Queue depth 2 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 31) +0ms
  iTunes Queue depth 3 +0ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 32) +0ms
  iTunes Queue depth 4 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 32) +0ms
  iTunes Queue depth 5 +1ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 139099) +0ms
  iTunes Queue depth 6 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 139099) +0ms
  iTunes Queue depth 7 +0ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 139097) +0ms
  iTunes Queue depth 8 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 139097) +0ms
  iTunes Queue depth 9 +0ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 139100) +0ms
  iTunes Queue depth 10 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 139100) +0ms
  iTunes Queue depth 11 +1ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 139095) +0ms
  iTunes Queue depth 12 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 139095) +0ms
  iTunes Queue depth 13 +0ms
  iTunes tell application "iTunes" to get selected of (AirPlay device id 139098) +0ms
  iTunes Queue depth 14 +0ms
  iTunes tell application "iTunes" to get sound volume of (AirPlay device id 139098) +0ms
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
                       
    ┌────────────┐     
    │ xxx-xx-xxx                          │     
    └────────────┘     
                       
  iTunes Queue depth 15 +17ms
  iTunes tell application "iTunes" to get {player state, sound volume, exists current track} +0ms
  iTunes Queue depth 16 +1ms
  iTunes tell application "iTunes"
  iTunes set apDevMap to {}
  iTunes repeat with aDevice in (AirPlay devices)
  iTunes copy {aDevice's id, aDevice's name, aDevice's network address, aDevice's selected, aDevice's sound volume} to the end of the apDevMap
  iTunes end repeat
  iTunes get apDevMap
  iTunes end tell
  iTunes  +0ms
  EventedHTTPServer Server listening on port 51826 +0ms
[2017-10-9 21:35:47] Homebridge is running on port 51826.
  EventedHTTPServer Server listening on port 49558 +2ms
[2017-10-9 21:35:47] Now Playing is running on port 49558.
  iTunes Queue depth 16 +57ms
  iTunes Queue depth 15 +73ms
  iTunes Queue depth 14 +74ms
  iTunes Queue depth 13 +74ms
  iTunes Queue depth 12 +76ms
  iTunes Queue depth 11 +74ms
  iTunes Queue depth 10 +77ms
  iTunes Queue depth 9 +78ms
  iTunes Queue depth 8 +73ms
  iTunes Queue depth 7 +73ms
  iTunes Queue depth 6 +73ms
  iTunes Queue depth 5 +76ms
  iTunes Queue depth 4 +73ms
  iTunes Queue depth 3 +74ms
  iTunes Queue depth 2 +73ms
  iTunes Queue depth 2 +77ms
  iTunes tell application "iTunes"
  iTunes set theResult to {exists current track}
  iTunes if exists current track then
  iTunes 	set end of theResult to name of current track
  iTunes 	set end of theResult to album of current track
  iTunes 	set end of theResult to artist of current track
  iTunes 	set end of theResult to duration of current track
  iTunes 	set end of theResult to player position
  iTunes end if
  iTunes get theResult
  iTunes end tell +0ms
  iTunes Queue depth 2 +0ms
  iTunes Queue depth 1 +95ms
  iTunes Queue depth 0 +80ms
  iTunes Queue depth 1 +654ms
  iTunes tell application "iTunes" to get {player state, sound volume, exists current track} +1ms
  iTunes Queue depth 1 +2ms
  iTunes tell application "iTunes"
  iTunes set apDevMap to {}
  iTunes repeat with aDevice in (AirPlay devices)
  iTunes copy {aDevice's id, aDevice's name, aDevice's network address, aDevice's selected, aDevice's sound volume} to the end of the apDevMap
  iTunes end repeat
  iTunes get apDevMap
  iTunes end tell
  iTunes  +0ms
EventedHTTPServer [::ffff:192.168.178.23] HTTP request: /resource +10s
  HAPServer [xx:xx:xx:xx:xx:xx] HAP Request: POST /resource +1ms
Snapshot -re -loop 1 -framerate 1 -r 1 -i /tmp/homebridge-itunes-nowplaying.jpg -t 1 -s 480x270 -f image2 -
  EventedHTTPServer [::ffff:192.168.178.23] HTTP Response is finished +18ms

@martinorob
Copy link

Can you stop homebridge
delete ~/.homebridge/accessories/cachedAccessories
delete the Now Playing webcam accessori from your home application
restart homebridge
re add Now Playing webcam to home application?

@DJay-X
Copy link
Author

DJay-X commented Feb 11, 2018

@martinorob I hope not to bother. After some time of homebridge abstinence, I unfortunately have to come back with the missing video feed issue. :(

I noticed when I start homebridge manually live video works Home App ans shows the Album Artwork etc. In the folder /tmp the file homebridge-itunes-nowplaying.jpg is updated frequent. Together with homebridge-itunes-artwork.jpg, homebridge-itunes-nowplaying.txt and homebridge-itunes-artwork.tmp

But when I start homebridge with launchctl load ~/Library/LaunchAgents/com.homebridge.server.plist the file homebridge-itunes-nowplaying.jpg is not updated anymore. The other three files are still updating. In Home App the camera is not giving response.

Thanks again for your help and the time you are investing.

@martinorob
Copy link

Try to put the full path for the jpg..

like "/Volumes/SSD750GB/tmp/homebridge-itunes-nowplaying.jpg"

@DJay-X
Copy link
Author

DJay-X commented Feb 12, 2018

Thanks. But that doesn't solve it.
As mentioned the three other files are updating what I can see in Finder.

bildschirmfoto 2018-02-12 um 13 10 15

Only the homebridge-itunes-nowplaying.jpg stays the same when homebridge runs as
launchctl load ~/Library/LaunchAgents/com.homebridge.server.plist

Changing the file in the config.json to homebridge-itunes-artwork.jpg helped neither.
Camera still not responding.
Ending homebridge with launchctl unload ~/Library/LaunchAgents/com.homebridge.server.plist and just start it again with homebridge and put back the path to /tmp/homebridge-itunes-nowplaying.jpg and everything works great ant the live view is switched on immediately.

So I assume it's more something how homebridge starts then just the path to a file in the config.json.
🤔🤷🏼‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants