A simple video streaming application made with Dart, JS, HTML, CSS &
Recently I wrote an article, explaining how to deploy it using systemd in LAN, which can be found here.
what does it do ?
- A streaming service, intended to run in small network(s) ( may be in your home network ), which lets you stream movies to any device present in that network & having a standard browser installed ( yeah HTML5 support required )
- Backend, fully written in Dart, leveraging power of dart:io & dart:isolate
- Audio-Video playing is done using HTML5 element, which can play mp4 & webm video(s) generally
how can I use it ?
- If you're on Linux, then I've already compiled streamZ into an executable binary ( using dart2native compiler ), which can be simply run on any Linux Machine, cause that executable binary is one self-sufficient one ( but not yet platform-agnostic, which will change is near future ).
- Then download this compressed file, and unzip it into a suitable location on your machine.
- You'll get a directory tree like below
$ wget https://github.com/itzmeanjan/streamZ/releases/download/v1.0.1/streamZ.zip # consider downloading zip, using wget from terminal $ cd $ unzip streamZ.zip # unzipping it $ cd streamZ # getting into actual directory $ tree -h . ├── [4.0K] final │ └── [7.8M] streamZ └── [4.0K] frontend ├── [4.0K] images │ └── [ 318] favicon.ico ├── [4.0K] pages │ └── [1.0K] index.html ├── [4.0K] scripts │ └── [9.7K] index.js └── [4.0K] styles └── [2.0K] index.css 6 directories, 5 files
- Now get into
./finaldirectory & run executable binary, which will start a media streaming server on http://0.0.0.0:8000
$ cd final $ ./streamZ # running movie steaming server [+]streamZ_v1.0.0 listening ( streamZ0 ) ... [+]streamZ_v1.0.0 listening ( streamZ1 ) ...
- To check, open browser from same machine & type http://localhost:8000 into address bar, you'll get a list of all movies present under ~/Videos/ directory, which is default video storing directory on Linux running machines.
- You can also access this streaming service by opening _http://x.x.x.x:8000/_,on any device's browser, present in LAN
x.x.x.xis nothing but Local IP Address of machine, running streamZ
- If you want to dig deeper, simply fork this repo & clone it in you machine
- Make sure you've installed Dart SDK & you're on *nix platform
- Because I gonna use systemd.service to keep this streaming service alive in background, always, even after system restarts it'll auto start itself
- You need to make sure, you've ~/Videos/ directory present on your system, cause we'll read from that directory ( every 30 minutes ), to ensure all mp4 & webm videos, present in aforementioned directory, are listed in movie playlist
- If you're having a lot of traffic, consider using multiple Isolates to handle traffic efficiently. Just update
int count = 2;on line 100 of
./bin/main.dartto whatever value you intend to use, that many Isolate(s) will be created on boot, they'll distributedly handle whole traffic coming in.
- I've also written one systemd unit file, which can be used for deploying streamZ, so that it'll keep running always ( autostart after failure & system boot )
- Consider using so, by modifying this systemd unit file
how does it look like ?
Feel free to check source code to dig deeper ( it's pretty well documented )
Hope it helps ...