hi frnds,
i am doing one tv channel website.I want to add tv(live) to the webpage. please give me some suggestions. if possible give some code.
eg : SNIP
Thanks
Saritha K.
hi frnds,
i am doing one tv channel website.I want to add tv(live) to the webpage. please give me some suggestions. if possible give some code.
eg : SNIP
Thanks
Saritha K.
Short guide for (and anyone else reading): embedding "live TV" on a webpage always needs three pieces — an encoder (camera or OBS), an ingest/hosting point, and a player on the web page. Two practical, commonly used free approaches follow: host on a free streaming platform and embed their player (fast, easy), or self-host an RTMP→HLS pipeline (more control, but bandwidth/infra matters). 's lmgtfy link doesn't help much; concrete steps below.
Easiest (free): use YouTube Live, Twitch, or similar. Create the live event, push with OBS using the service's RTMP key, then paste the service's iframe embed code (replace STREAM_ID). Pros: cross-browser playback, CDN-backed delivery, minimal server work. Cons: platform branding, terms of service, geo/content restrictions.
Self-hosted (open-source stack): run nginx with the RTMP module and generate HLS for the browser. Example nginx rtmp app block:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
hls on;
hls_path /var/www/html/hls;
hls_fragment 3;
hls_playlist_length 10;
}
}
} Push from OBS to rtmp://your-server/live/STREAMKEY. If you prefer ffmpeg to produce HLS, a simple command:
ffmpeg -i rtmp://localhost/live/streamkey \
-c:v libx264 -preset veryfast -b:v 1500k -bufsize 3000k \
-c:a aac -b:a 128k \
-f hls -hls_time 4 -hls_list_size 6 -hls_flags delete_segments \
/var/www/html/hls/stream.m3u8 Embed in the page with a basic HTML5 player and an MSE fallback (hls.js):
<video id="player" controls width="640" height="360">
<source src="/hls/stream.m3u8" type="application/vnd.apple.mpegurl">
</video>
<script src="(include hls.js from a CDN)"></script>
<script>
var v = document.getElementById('player');
if (window.Hls && Hls.isSupported()) {
var hls = new Hls();
hls.loadSource('/hls/stream.m3u8');
hls.attachMedia(v);
} else if (v.canPlayType('application/vnd.apple.mpegurl')) {
v.src = '/hls/stream.m3u8';
}
</script> Quick troubleshooting / cautions: HLS plays natively in Safari; other browsers need hls.js (MSE). Serve .m3u8 with the proper MIME (application/vnd.apple.mpegurl) and set CORS headers if site and stream are on different origins. Open port 1935 for RTMP; serve HLS over HTTP(S) (HTTPS required if your site is HTTPS). Self-hosting scales with bandwidth — heavy viewers will incur real costs — and for sub-3s latency consider WebRTC solutions (more complex). If PHP is required, use it for signing/short-lived stream keys or serving dynamic playlists, not for the heavy streaming itself.
Hi frnds..
Any body help regarding this.
Thnaks
Hi frnds,
I m struggling from last 20 days 4 this conept..
plz anybody help me... i need to add live tv to my webpage....
sry 4 repeating this thread..
hi frnds,
i am doing one tv channel website.I want to add tv(live) to the webpage. please give me some suggestions. if possible give some code.
eg : SNIP
Thanks
Saritha K.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.