arjhe / django_rtsp_ipc Goto Github PK
View Code? Open in Web Editor NEWip camera
ip camera
# initialize repo
git init
# create ignore file
echo > .gitignore
# to buffer zone
git commit -m "add ignore" .gitignore
# create new project on github
# indicate remote stock
git remote add origin https://github.com/ARJhe/django_rtsp_ipc.git
# push to remote
git push -u origin master
django-admin startproject ipc_server
django-admin startapp streaming
INSTALLED_APPS = [
'streaming.apps.StreamingConfig',
...
[streaming] > [templates] > [streaming] > index.html
<!DOCTYPE html>
<html>
<head>
<title>Live Cam</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video1" autoplay controls="controls"></video>
<script>
if (Hls.isSupported()) {
var video1 = document.getElementById('video1');
var hls1 = new Hls();
// bind them together
hls1.attachMedia(video1);
hls1.on(Hls.Events.MEDIA_ATTACHED, function () {
console.log("video and hls.js are now bound together !");
// load variable from views.py
hls1.loadSource("{{stream_path}}");
hls1.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
console.log("manifest loaded, found " + data.levels.length + " quality level");
});
});
}
</script>
</body>
</html>
under streaming directory create directory and put stream data in it.
[streaming] > [static] > [live] > [stream](put data here)
set index.html view and set variable for hls to fetch data
[streaming] > views.py
from django.shortcuts import render
stream_path = "http://127.0.0.1:8000/static/live/stream/mystream.m3u8"
def home(request):
return render(request, 'streaming/index.html', {'stream_path': stream_path})
[streaming] > urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='streaming_home'),
]
[ipc_server] > urls.py
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
# add url from streaming directory
path('', include('streaming.urls'))
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.