Reputation: 1783
I have been following this tutorial to stream the video from my Logitech C920 webcam with a Raspberry Pi. Before explaining what my current issue is, I would like to note that the Webcam and the Pi are working fine, i.e. I can successfully stream the video using, for example, VLC and cvlc:
cvlc v4l2:///dev/video0:chroma=h264:width=1920:height=1080 --sout '#standard{access=http,mux=ts,dst=192.168.0.8:8080,name=stream,mime=video/ts}' -vvv
But I would like to watch the stream from a webpage, so I downloaded jwplayer, put it on a folder on my webserver and created this HTML page to watch it:
<html>
<head>
<script src="jwplayer.js"></script>
</head>
<body>
<div id="myElement-teststream">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement-teststream").setup({
playlist: [{
sources@: [{
file: "rtmp:192.168.0.8:1935/live/teststream"
}]
}],
height: 1080,
primary: "flash",
width: 1920
});
</script>
</body>
</html>
192.168.0.8
is the IP address of the Pi. When I go to localhost, however, no players appears, I can only see the div "Loading the player..."
I have launched the streaming server, and this is the output that shows that it is listening on port 1935:
+-----------------------------------------------------------------------------+
| Services|
+---+---------------+-----+-------------------------+-------------------------+
| c | ip | port| protocol stack name | application name |
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 1112| inboundJsonCli| admin|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 1935| inboundRtmp| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 8081| inboundRtmps| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 8080| inboundRtmpt| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 6666| inboundLiveFlv| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 9999| inboundTcpTs| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|udp| 0.0.0.0|10000| inboundUdpTs| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 554| inboundRtsp| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 6665| inboundLiveFlv| proxypublish|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 8989| httpEchoProtocol| samplefactory|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 8988| echoProtocol| samplefactory|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0| 1111| inboundHttpXmlVariant| vptests|
+---+---------------+-----+-------------------------+-------------------------+
/crtmpserver/src/crtmpserver.cpp:277 GO! GO! GO! (2384)
And then I capture with this command:
./capture -F -o -c0|avconv -re -i - -vcodec copy -f rtsp -metadata title=teststream rtsp://192.168.0.8:554/live
Now, I can access the stream with VLC using rtmp://192.168.0.8:1935/live/teststream
, but not from the HTML page.
Everything seems to be working fine, and the webcam lights up blue, but the player just doesn't appear. What am I missing?
Upvotes: 1
Views: 1323
Reputation: 3359
No need for a playlist with one item, and your RTMP URL is malformed. Also no need for the "primary" attribute, because RTMP is a Flash protocol - it can't be displayed in HTML5 mode anyway. So, try this:
<script type="text/javascript">
jwplayer("myElement-teststream").setup({
file: "rtmp://192.168.0.8:1935/live/teststream",
height: 1080,
width: 1920
});
</script>
I'm not a "streaming guy," so I'm not sure about the format of the file. See this page about the setup: http://support.jwplayer.com/customer/portal/articles/1430358-using-rtmp-streaming
Upvotes: 2