livepeer / LivepeerDesktop

Desktop Application For Livepeer (Out of date)
GNU General Public License v3.0
16 stars 5 forks source link

🚀 LivePeer Desktop - React #9

Closed buildog closed 7 years ago

buildog commented 7 years ago

logowithpunchline Todo

ericxtang commented 7 years ago

Hi @buildog - I gave it a spin and looked at the code. I wasn't expecting anyone to be building this, so the new node has a slightly different API. I'm gonna go through it this week and either re-create the endpoints, or create a newer version / upgrade the code here.

Anything I can help you with? I'm excited for this :)

buildog commented 7 years ago

@ericxtang

So, the only missing endpoint is peersCount, which is bypassed for the moment

It worked, well at least without FFMPEG/LIVEPEER errors, then I tried to play via command line, and I got this error that I can't get rid of:

I0817 12:18:25.345324    1310 network_node.go:71] Created node: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7 at [/ip4/127.0.0.1/tcp/15000 /ip6/::1/tcp/15000 /ip4/192.168.0.198/tcp/15000]
I0817 12:18:25.346900    1310 basic_network.go:192] 

Setting up protocol: /livepeer_video/0.0.1
E0817 12:18:25.471958    1310 livepeernode.go:72] Cannot connect to node: dial attempt failed: <peer.ID NTs29e> --> <peer.ID XeYaU3> dial attempt failed: dial tcp4 52.15.174.204:15000: getsockopt: connection refused
E0817 12:18:25.472242    1310 livepeer.go:147] Cannot connect to bootstrap node: dial attempt failed: <peer.ID NTs29e> --> <peer.ID XeYaU3> dial attempt failed: dial tcp4 52.15.174.204:15000: getsockopt: connection refused
ericxtang commented 7 years ago

@buildog just checked for the error - the testnet bootnode went down during the evening due to a bug. I restarted it and am looking into the bug now. Can you try it again?

buildog commented 7 years ago

it works @ericxtang , except the stream command line,

MacBook-Pro-de-Adrien:angular builldog$ /Users/builldog/Documents/buildog/LivepeerDesktop/node_modules/livepeer-static/bin/darwin/x64/livepeer stream -id 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb79b09afbe4818eb4a9d862c8b7650b3ca4a76677a64aea28deb72dddea2b36088 
ERROR: logging before flag.Parse: I0817 17:06:13.178498    7621 livepeer.go:413] url: http://localhost:8935/stream/122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb79b09afbe4818eb4a9d862c8b7650b3ca4a76677a64aea28deb72dddea2b36088.m3u8
ERROR: logging before flag.Parse: I0817 17:06:13.178528    7621 livepeer.go:416] Couldn't start the stream.  Make sure a local Livepeer node is running on port 8935

node is running, broadcast too, port is ok, and I can curl the streamID and http://localhost:8935/stream/xxxx.m3u8, didn't tried with ffplay

ericxtang commented 7 years ago

@buildog hmm...

From the error message, it feels like the stream is not available. This is possibly because the streamID assignment mechanism has changed... It might require a node-side change to fix this. Since the ID for the HLS stream is a random string, we don't know it ahead of time.

There is a new endpoint called /streamID, that should give you the most recent HLS stream. This can be a short-term fix. It wouldn't work if the client was publishing multiple streams, but we'll need a more robust solution for that.

p.s. You can get the node info by curl http://localhost:8935/status, and it should print out all the local streams.

buildog commented 7 years ago

yeah I got it with /streamID endpoint, already fixed on this PR. Here is the full process:

start

MacBook-Pro-de-Adrien:~ builldog$ /Users/builldog/Downloads/livepeer-darwin
I0817 18:41:06.733153    9832 network_node.go:71] Created node: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7 at [/ip4/127.0.0.1/tcp/15000 /ip6/::1/tcp/15000 /ip4/192.168.0.198/tcp/15000]
I0817 18:41:06.733829    9832 basic_network.go:192] 

Setting up protocol: /livepeer_video/0.0.1
I0817 18:41:07.408400    9832 basic_notifiee.go:33] Notifiee - Connected.  Local: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7 - Remote: 12208a4eb428aa57a74ef0593612adb88077c75c71ad07c3c26e4e7a8d4860083b01
I0817 18:41:07.632060    9832 livepeer.go:196] ***Livepeer is in off-chain mode***
I0817 18:41:07.632090    9832 livepeer.go:200] 

Setting up Media Server
I0817 18:41:07.633935    9832 lpms.go:58] Starting HTTP Server at :8935
I0817 18:41:07.633905    9832 lpms.go:54] Starting LPMS Server at ::1935
I0817 18:41:30.407588    9832 listener.go:32] RTMP server got upstream: rtmp://localhost:1935/movie
I0817 18:41:30.408026    9832 mediaserver.go:170] 

Segmenting rtmp stream:
122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7c572c7c17905b527e3a40db4cb31bef2572682f3b983e444c24c830da16720b9 
to hls stream:
122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902

I0817 18:41:30.408121    9832 lpms.go:100] Segment RTMP Req: rtmp://localhost:1935/stream/122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7c572c7c17905b527e3a40db4cb31bef2572682f3b983e444c24c830da16720b9
I0817 18:41:30.412341    9832 video_segmenter.go:92] Ffmpeg path: 
I0817 18:41:30.438148    9832 player.go:52] LPMS got RTMP request @ rtmp://localhost:1935/stream/122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7c572c7c17905b527e3a40db4cb31bef2572682f3b983e444c24c830da16720b9

broadcast

MacBook-Pro-de-Adrien:~ builldog$ /Users/builldog/Downloads/livepeer-darwin broadcast
ERROR: logging before flag.Parse: I0817 18:41:27.610941    9850 livepeer.go:449] Now broadcasting - 
ERROR: logging before flag.Parse: I0817 18:41:30.618834    9850 livepeer.go:461] StreamID: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902

stream

MacBook-Pro-de-Adrien:~ builldog$ /Users/builldog/Downloads/livepeer-darwin stream -id 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902
ERROR: logging before flag.Parse: I0817 18:43:42.327012    9924 livepeer.go:413] url: http://localhost:8935/stream/122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902.m3u8
ERROR: logging before flag.Parse: I0817 18:43:42.327040    9924 livepeer.go:416] Couldn't start the stream.  Make sure a local Livepeer node is running on port 8935

http://localhost:8935/status

idk why there is 2 streams listed, tried with both ID > same result

StreamDB: 
Streams:
VariantID:122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7c572c7c17905b527e3a40db4cb31bef2572682f3b983e444c24c830da16720b9, StreamID: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7c572c7c17905b527e3a40db4cb31bef2572682f3b983e444c24c830da16720b9, Type: 1155558
VariantID:122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902, StreamID: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902, Type: 1155556, len: 13

VideoNetwork: 

broadcasters:map[122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902:StreamID: 122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902, working: true, q: 0, listeners: 0]

subscribers:map[]

relayers:map[]

http://localhost:8935/streamID

122001d8fc6116e2fee245fc20af37056d46a6947b83a85fc0998d5756f3983fbdb7f2b4acc4da966f30c5c035192dbed452740f4ac176205827681339bac8432902 
ericxtang commented 7 years ago

@buildog yeah it's a little confusing - 2 streams is normal. One of them is the RTMP stream that's going into the node, one of them is the HLS stream that the node is broadcasting to the network. The RTMP stream is only local - other nodes will never see or need it.

buildog commented 7 years ago

ok, so the front-end follow the same logic as go-livepeer, every thing look ok now so I move the PR from WIP to ready. You just have to update https://github.com/livepeer/livepeer-static/blob/master/bin/darwin/x64/livepeer

And let me know when peerCount is back so I can un-comment the code

ericxtang commented 7 years ago

@buildog Just checked in the new versions so peersCount should be back.

buildog commented 7 years ago

^peerCount works as well as the livepeer-static fix, @ericxtang thanks!

buildog commented 7 years ago

^fixed the monitor args @ericxtang

dob commented 7 years ago

This is working pretty well for me. One bug that I am seeing is that I quit the electron app, but the livepeer process is still running in the background, along with some electron helper process:

dob@junkyard-dog~/development/livepeer/LivepeerDesktop: ps aux | grep 'livepeer'
dob               8065   0.0  0.0  2432804   1980 s002  S+   11:19AM   0:00.00 grep livepeer
dob               8032   0.0  0.2 556687020  38208 s002  S    11:16AM   0:00.43 /Users/dob/development/livepeer/LivepeerDesktop/node_modules/livepeer-static/bin/darwin/x64/livepeer -monitor -monitorhost http://viz.livepeer.org:8081/metrics
dob               8030   0.0  0.4  3326408  61808 s002  S    11:16AM   0:00.17 /Users/dob/development/livepeer/LivepeerDesktop/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper --type=renderer --no-sandbox --primordial-pipe-token=9834DDEDE589388056CD33EA941E7226 --lang=en-US --app-path=/Users/dob/development/livepeer/LivepeerDesktop/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar --node-integration=true --webview-tag=true --no-sandbox --background-page --enable-pinch --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --content-image-texture-target=0,0,3553;0,1,3553;0,2,3553;0,3,3553;0,4,3553;0,5,3553;0,6,3553;0,7,3553;0,8,3553;0,9,3553;0,10,34037;0,11,34037;0,12,34037;0,13,3553;0,14,3553;0,15,3553;1,0,3553;1,1,3553;1,2,3553;1,3,3553;1,4,3553;1,5,3553;1,6,3553;1,7,3553;1,8,3553;1,9,3553;1,10,34037;1,11,34037;1,12,34037;1,13,3553;1,14,3553;1,15,3553;2,0,3553;2,1,3553;2,2,3553;2,3,3553;2,4,3553;2,5,3553;2,6,3553;2,7,3553;2,8,3553;2,9,3553;2,10,34037;2,11,34037;2,12,34037;2,13,3553;2,14,3553;2,15,3553;3,0,3553;3,1,3553;3,2,3553;3,3,3553;3,4,3553;3,5,34037;3,6,3553;3,7,3553;3,8,3553;3,9,3553;3,10,3553;3,11,3553;3,12,34037;3,13,3553;3,14,34037;3,15,34037;4,0,3553;4,1,3553;4,2,3553;4,3,3553;4,4,3553;4,5,34037;4,6,3553;4,7,3553;4,8,3553;4,9,3553;4,10,3553;4,11,3553;4,12,34037;4,13,3553;4,14,34037;4,15,34037 --service-request-channel-token=9834DDEDE589388056CD33EA941E7226 --renderer-client-id=6
dob               8029   0.0  0.4  3326408  61284 s002  S    11:16AM   0:00.17 /Users/dob/development/livepeer/LivepeerDesktop/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper --type=renderer --no-sandbox --primordial-pipe-token=1C6C0F5F84F5CDE2221F8637B45320C5 --lang=en-US --app-path=/Users/dob/development/livepeer/LivepeerDesktop/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar --node-integration=true --webview-tag=true --no-sandbox --background-page --enable-pinch --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --content-image-texture-target=0,0,3553;0,1,3553;0,2,3553;0,3,3553;0,4,3553;0,5,3553;0,6,3553;0,7,3553;0,8,3553;0,9,3553;0,10,34037;0,11,34037;0,12,34037;0,13,3553;0,14,3553;0,15,3553;1,0,3553;1,1,3553;1,2,3553;1,3,3553;1,4,3553;1,5,3553;1,6,3553;1,7,3553;1,8,3553;1,9,3553;1,10,34037;1,11,34037;1,12,34037;1,13,3553;1,14,3553;1,15,3553;2,0,3553;2,1,3553;2,2,3553;2,3,3553;2,4,3553;2,5,3553;2,6,3553;2,7,3553;2,8,3553;2,9,3553;2,10,34037;2,11,34037;2,12,34037;2,13,3553;2,14,3553;2,15,3553;3,0,3553;3,1,3553;3,2,3553;3,3,3553;3,4,3553;3,5,34037;3,6,3553;3,7,3553;3,8,3553;3,9,3553;3,10,3553;3,11,3553;3,12,34037;3,13,3553;3,14,34037;3,15,34037;4,0,3553;4,1,3553;4,2,3553;4,3,3553;4,4,3553;4,5,34037;4,6,3553;4,7,3553;4,8,3553;4,9,3553;4,10,3553;4,11,3553;4,12,34037;4,13,3553;4,14,34037;4,15,34037 --service-request-channel-token=1C6C0F5F84F5CDE2221F8637B45320C5 --renderer-client-id=4
dob commented 7 years ago

Also, for what it's worth, the peer count is still showing 0 for me, even though I can see it connected to peers through the console and the viz.livepeer.org visualization. Maybe that's a future enhancement.

buildog commented 7 years ago

thanks doug for the feedback, I'll check the peerCount and the exit command asap

dob commented 7 years ago

The livepeer and electron processes do seem to eventually go away on their own. Maybe after a minute or so.

On Fri, Aug 18, 2017 at 11:39 AM, buildog notifications@github.com wrote:

thanks doug for the feedback, I'll check the peerCount and the exit command asap

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/livepeer/LivepeerDesktop/pull/9#issuecomment-323387769, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAolUXNSD1dSF76m3j3yG2Ap_97TIdiks5sZbA6gaJpZM4O1iJx .

buildog commented 7 years ago

@dob hotfix to exit the LP process should be fixed too, but I'm not satisfied by the fix so I'll improve that.

ericxtang commented 7 years ago

@buildog I think this PR is at a pretty good place, and we should merge it.

I want to understand the workflow a little better before we do that. Some of these questions are because of my lack of understanding in Electron.

Thanks!

buildog commented 7 years ago

Hey Eric,

Sorry for the delay, I missed this notification. Almost all the answers are inside the readme, but not easy to read on a PR, so you can take a look at https://github.com/buildog/LivepeerDesktop/blob/release/react/README.md

So yeah, there is a dev environment (with hot replacement), a build command for production, a start command for non packaged app and a packaging command for the diverses plateforms.

You never work directly on the main.js / dist files, it's generated from the dist commands via webpack.

So dev workflow is (without github stuffs) :

ericxtang commented 7 years ago

Looks great! I'm gonna merge this :)