E
E
Eugene2018-05-15 17:48:06
JavaScript
Eugene, 2018-05-15 17:48:06

How to stream video to TV using JavaScript?

Hello everybody! In general, the question arose: how can I send my video (tv cast) to Smart TV using JavaScript? Somehow this is implemented by YouTube and in general by Google Chrome

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aleksey Solovyev, 2018-05-15
@alsolovyev

Create html:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

raise the server to html://localhost:8080. Open the address of your computer on the TV (something like 192.168.0.240:8080 - see the router settings). See.
But seriously, you obviously need a server that will serve files (this is done by the standard libraries in nodeJS):
const http = require('http');
const fs = require('fs');

http.createServer(function(req, res) {
  res.writeHead(200, {'Content-Type': 'video/mp4'});
  var rs = fs.createReadStream('video.mp4');
  rs.pipe(res);
}).listen(8080);

You start the server. Open the address of your computer on the TV (something like 192.168.0.240:8080 - see the router settings). See.
Now add your own functionality: library \ encoding \ sorting, etc.
Why do it yourself? There is on php - Plex , there is on js (almost like my example above :) ) - a bunch of my bikes or classic
ps Youtube service is written in python

D
Drno, 2018-08-18
@Drno

There is nothing for you to do.
VLC player on PC, RTSP broadcast.
VLC player on TV - RTSP reception....

M
Maxim Timofeev, 2018-05-16
@webinar

Somehow this is implemented by YouTube and in general by Google Chrome

At the browser and service? How do you have 2 completely different things turned out to be the same?
1. You didn't explain what "submit your video" means. The easiest way is to open it from a flash drive, js is not needed here
2. Each Smart TV has an api, find the documentation and write an application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question