first commit
This commit is contained in:
BIN
__pycache__/app.cpython-310.pyc
Normal file
BIN
__pycache__/app.cpython-310.pyc
Normal file
Binary file not shown.
11
app.py
Normal file
11
app.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from flask import Flask, render_template, Response
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
# Main page for the live stream
|
||||||
|
return render_template('index.html')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug=True)
|
||||||
12
templates/base.html
Normal file
12
templates/base.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Live Stream</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block main_content %}
|
||||||
|
{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
20
templates/index.html
Normal file
20
templates/index.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block main_content %}
|
||||||
|
<h1>Live Stream</h1>
|
||||||
|
<video id="localVideo" autoplay playsinline controls></video>
|
||||||
|
<script>
|
||||||
|
// constant containing the video
|
||||||
|
const videoElement = document.getElementById('localVideo');
|
||||||
|
|
||||||
|
// Request access to the user's camera and microphone
|
||||||
|
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
|
||||||
|
.then((stream) => {
|
||||||
|
// Display the stream locally
|
||||||
|
videoElement.srcObject = stream;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error accessing media devices.', error);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user