简体   繁体   中英

Has a simple method of live streaming video from an apache2 HTTPS server (raspberry pi) evolved?

I am an old duffer who is attempting to set-up a raspberry pi 3 to live stream video to an HTTPS site. After a big struggle with raspbian strech, apache2 and obtaining a security certificate I have managed to host the HTTPS domain on the raspberry but I cannot get the video to display outside my local network. I have edited the index page at the domain to embed the live video and this shows the live stream when I load into chrome from a windows PC on the local network but although the page loads from outside the local network no video displays. The web address is https://rydepier.com The strange thing is the video stream is available at the 8081 port at my WAN IP for anyone to view. Is there not a simple way to embed this in the HTML5 page?

The video stream is coming from a USB camera attached to the pi via the 'motion' service and is (as far as I know) h264 encoded with no mp4 wrapper

Here is the code for the index page (very messy from an HTML newbie) The mp4 video tagged is locally stored in the HTML file on the pi

<html>

<head>

    <title>Number 4 Homepage </title>

    <style>

        body

        {

            margin: 20px;

            padding: 0px;

        }

        img

        {

            width: 90%;

            <!height: 50%;>

        }

    </style>

</head>

<body>

    <h1>Greetings from Number 4</h1>

    <p>Live view from the Mezanine Deck.</p>



    <img style="-webkit-user-select: none;" src="http://192.168.1.10:8081/">        <h1>Solstice 2019.</h1>

    <video width="640" height="480" controls>

    <source src="vid2.MP4" type="video/mp4">



    Your browser does not support the video tag.

    </video>

</body>

The reason that you cannot access the video from outside is that the method you are using to access it is through a local IP address. Without going in too much detail, the local addresses (private IPs) in the address range 192.168.0.0 – 192.168.255.255 are going to be unique on that network but are not publically accessible to those on the internet. That's similar to how my files in the C:\\Users directory are accessible to me, but I need to put it on a server somewhere if I want it to be accessible to someone else.

The solution is that you have to access from the public IP. Instead of finding that manually, you can actually replace the 192.168.1.10:8081 with rydepier.com:8081. DNS will translate the domain into its proper public IP address, and video will stream everywhere.

In fact, I know this because I cannot access the private IP address video stream but I can access it at http://rydepier.com:8081

Replace

<img style="-webkit-user-select: none;" src="http://192.168.1.10:8081/">        <h1>Solstice 2019.</h1>

WITH

<img style="-webkit-user-select: none;" src="http://rydepier.com:8081/">        <h1>Solstice 2019.</h1>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM