Skip to content

hoseungme/express-hls-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

express-hls-example

Express์™€ HLS๋กœ ๋™์˜์ƒ์„ ์ŠคํŠธ๋ฆฌ๋ฐํ•˜๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

This is an example that stream video using HLS and Node.js

์ฐธ์กฐ

์˜ˆ์ œ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•œ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž…๋‹ˆ๋‹ค. ํ•œ๊ตญ์–ด์™€ ์˜์–ด ์ค‘ ํ•˜๋‚˜๋กœ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

The links below are my blog posts that explain about this example. You can choose between Korean and English.

Node.js, Express, HLS๋กœ ๋™์˜์ƒ ์ŠคํŠธ๋ฆฌ๋ฐํ•˜๊ธฐ (ํ•œ๊ตญ์–ด)

Video Streaming with Node.js / HLS (English)

์‹œ์ž‘ํ•˜๊ธฐ

์ €์žฅ์†Œ๋ฅผ ํด๋ก ํ•ด์ฃผ์„ธ์š”.

Clone this repository.

git clone https://github.com/HoseungJang/express-hls-example.git

์˜์กด์„ฑ์„ ์„ค์น˜ํ•ด์ฃผ์„ธ์š”.

Install dependencies.

cd express-hls-example
npm install

src ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•ด์ฃผ์„ธ์š”.

Go to 'src' directory.

cd src

videos ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•œ ํ›„ mp4 ํ˜•์‹์˜ ๋™์˜์ƒ์„ ๋„ฃ์–ด์ฃผ์„ธ์š”.

๋™์˜์ƒ ํŒŒ์ผ์˜ ์ด๋ฆ„์€ video๋กœ ํ•ด์ฃผ์„ธ์š”.

์—ฌ๊ธฐ๊นŒ์ง€ ์˜ค์…จ๋‹ค๋ฉด src ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด๋ถ€๊ฐ€ ์•„๋ž˜์™€ ๊ฐ™์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

After making 'videos' directory, Put 'video.mp4' file into there.

If you complete this step, 'videos' directory is composed of:

/src
	/videos
		video.mp4
	app.js
	client.html
	ffmpeg.js

ffmpeg.js๋ฅผ ์‹คํ–‰ํ•ด์ฃผ์„ธ์š”.

Run ffmpeg.js.

node ffmpeg.js

end๊ฐ€ ์ถœ๋ ฅ๋˜๋ฉด ffmpeg.js๋ฅผ ์ข…๋ฃŒํ•˜๊ณ  app.js๋ฅผ ์‹คํ–‰ํ•ด์ฃผ์„ธ์š”.

Terminate ffmpeg.js and Run app.js when 'end' is logged.

node app.js

localhost:3000์œผ๋กœ ์ ‘์†ํ•˜๊ณ , ๋™์˜์ƒ์„ ์žฌ์ƒํ•ด๋ณด์„ธ์š”.

F12๋ฅผ ๋ˆ„๋ฅด๊ณ  Network ํƒญ๋„ ํ™•์ธํ•ด๋ณด์„ธ์š”.

Now go to localhost:3000 and play your video.

Press F12 key and check the Network tab.

About

A simple example about HTTP Live Streaming using Node.js and Express

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors