Skip to content

๐Ÿš€ ์ƒˆ๋กœ๊ณ ์นจ ์‹œ HLS ERROR

Kang Chaeryeon edited this page Dec 1, 2024 · 1 revision

HLS Error

HLS ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋˜ ์ค‘, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๋ฅผ ๋งˆ์ฃผ์น˜๊ฒŒ ๋˜์—ˆ๋‹ค.

image

๊ทผ๋ฐ ์ •๋ง ํฌํ•œํ•œ ์ ์€ ์žฌ์ƒ์—๋Š” ์ „ํ˜€ ๋ฌด๋ฆฌ๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ. ์ฆ‰, ์ŠคํŠธ๋ฆฌ๋ฐ ๊ธฐ๋Šฅ์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์•˜๋‹ค.

๋‹ค๋งŒ, Error๋ผ๋Š” ๋‹จ์–ด ์ž์ฒด๊ฐ€ ๋ณด๊ธฐ ์‹ซ์–ด์„œ ์™œ ๊ทธ๋Ÿฐ ๊ฒƒ์ธ์ง€ ํŒŒ์•…ํ•ด๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค.

์ƒˆ๋กœ ๊ณ ์นจ ์‹œ ๋ฐ”๋กœ ๋ฐ›์•„์˜ค๋Š” ๊ฒƒ์ด ๋ฌธ์ œ?

image

์žฌ์ƒ ๋ฒ„ํŠผ์„ ๋”ฐ๋กœ ๋ˆ„๋ฅด์ง€ ์•Š์•„๋„, URL ์š”์ฒญ์— ์˜ํ•ด์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฐ”๋กœ m3u8์ด ์‘๋‹ต๋˜๊ณ ,

๊ทธ m3u8ํŒŒ์ผ์„ ์ฝ์–ด์„œ ts ์š”์ฒญ์„ ๋ณด๋‚ธ ํ›„, ์ƒํ™ฉ์— ๋งž๋Š” tsํŒŒ์ผ๋“ค์„ ์‘๋‹ต๋ฐ›๋Š”๋‹ค.

์ด๊ฒƒ์ด ๋ฌธ์ œ์ธ ๊ฒƒ ๊ฐ™์•˜๋‹ค.

์ƒˆ๋กœ ์žฌ์ƒ์„ ํ•  ๋•Œ, ๊ธฐ์กด HLS ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œ๋ฅผ ํ•˜์ง€ ์•Š๊ณ  ์ง„ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•˜๋Š” Error๋ผ๊ณ  ์ถ”์ธก์„ ํ•˜๊ณ , destroyHLS ๋ฉ”์†Œ๋“œ๋ฅผ ์ž‘์„ฑํ•ด๋ณด์•˜๋‹ค.

const hlsRef = useRef<Hls | null>(null);
...

const destroyHls = useCallback(() => {
    if (hlsRef.current) {
      hlsRef.current.destroy();
      hlsRef.current = null;
    }
  }, []);
  
  const initializeHls = (audio: HTMLMediaElement, streamUrl: string) => {
    destroyHls();
    const hls = new Hls(DEFAULT_STREAMING_CONFIG);
    hls.loadSource(streamUrl);
    hls.attachMedia(audio);
		...
  };

์ด๋ ‡๊ฒŒ ์ ์šฉ์„ ํ•ด๋„ ์—ฌ์ „ํžˆ error๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

๋˜ ์›์ธ์ด ๋ฌด์—‡์ธ๊ฐ€ ์ƒ๊ฐํ•ด๋ณด๋‹ˆ,

hlsRef๋ฅผ null๋กœ ๋งŒ๋“ค๊ณ  ์ถ”์ ์„ ์‹œํ‚ค์ง€ ์•Š์•„์„œ ์ƒ๊ธฐ๋Š” ์—๋Ÿฌ ๊ฐ™์•˜๋‹ค. ๋”ฐ๋ผ์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ–ˆ๋‹ค

const hlsRef = useRef<Hls | null>(null);
...

const destroyHls = useCallback(() => {
    if (hlsRef.current) {
      hlsRef.current.destroy();
      hlsRef.current = null;
    }
  }, []);
  
  const initializeHls = (audio: HTMLMediaElement, streamUrl: string) => {
    destroyHls();
    const hls = new Hls(DEFAULT_STREAMING_CONFIG);
    hlsRef.current = hls; // ์ถ”๊ฐ€ ๋ถ€๋ถ„
    hls.loadSource(streamUrl);
    hls.attachMedia(audio);
		...
  };

๋‹ค์Œ๊ณผ ๋ณ€๊ฒฝํ–ˆ๋”๋‹ˆ, ์ƒˆ๋กœ๊ณ ์นจ ์‹œ์™€, ๋‹ค์Œ ๊ณก์œผ๋กœ ๋„˜์–ด๊ฐˆ ๋•Œ์—๋„ error๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์•˜๋‹ค!!!

์•ผํ˜ธ!

inear

๊ธฐ์ˆ  ๊ณต์œ 

๐Ÿš€ ffmpeg๋Š” stderr๋กœ ๋””๋ฒ„๊น…์„ ํ•˜๋Š” ์ด์œ 
๐Ÿš€ HLS ํ”„๋กœํ† ์ฝœ์— ๊ด€ํ•œ ์ •๋ฆฌ ๋ฐ FFmpeg ์‚ฌ์šฉ๊ธฐ
๐Ÿš€ ๋น„ํŠธ๋Š” tsconfig.json์ด ์„ธ ๊ฐœ?
๐Ÿš€ NestJS ๊ธฐ๋ณธ ๊ฐœ๋… - Modules
๐Ÿš€ Socket.io ์ตœ(๊ฐ•)์ ํ™”
๐Ÿš€ ๋„์ปค์™€ nginx์˜ ์‚ฌ์šฉ๊ธฐ
๐Ÿš€ ๋ถ€ํ•˜ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด์ž

๊ฐœ๋ฐœ ์ผ์ง€

๐Ÿš€ FSD ์‚ฌ์šฉ๊ธฐ, ๊ทผ๋ฐ ์ด์ œ ๋‚˜๋งŒ์˜ ๊ทœ์น™์„ ๊ณ๋“ค์ธ
๐Ÿš€ CICD ๊ตฌ์กฐ ์ˆ˜์ •
๐Ÿš€ ์•จ๋ฒ” ๋‹จ์œ„๋กœ ์ŠคํŠธ๋ฆฌ๋ฐ ํ•˜๊ธฐ (with HLS)
๐Ÿš€ HLS๋กœ ์Œ์•… ์ฃผ๊ณ ๋ฐ›๊ธฐ
๐Ÿš€ vite + react + typescript ํ™˜๊ฒฝ์—์„œ path alias ์„ค์ •
๐Ÿš€ React Scan์ด ๋ญ์ฃ ?
๐Ÿš€ ๋กœ์ปฌ ํ™˜๊ฒฝ ๊ฐœ๋ฐœ ๋ชจ๋“œ ๋ฐฐํฌ
๐Ÿš€ ์•จ๋ฒ” ์ „์ฒด๋ฅผ ์ŠคํŠธ๋ฆฌ๋ฐํ•œ๋‹ค๊ณ ? (with HLS)
๐Ÿš€ ์ฝ”๋“œ์˜ ์•ˆ์ •์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด๋ณด์ž

ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…

๐Ÿš€ ์ƒˆ๋กœ๊ณ ์นจ ์‹œ HLS ERROR
๐Ÿš€ input ํƒœ๊ทธ์— ํ•œ๊ธ€ ์ž…๋ ฅ ํ›„, Enter๋ฅผ ๋ˆ„๋ฅด๋ฉด ํ•จ์ˆ˜๊ฐ€ ๋‘๋ฒˆ ํ˜ธ์ถœ๋˜๋Š” ์˜ค๋ฅ˜
๐Ÿš€ nginx proxy pass๋ฅผ ๋ฐ”๊ฟจ๋”๋‹ˆ ์ƒ๊ธด ์—๋Ÿฌ - ์Šค์›จ๊ฑฐ ์ธ์‹ ๋ฌธ์ œ
๐Ÿš€ ๋ฐฐํฌ ํ™˜๊ฒฝ์—์„œ ํด๋ผ์ด์–ธํŠธ-์„œ๋ฒ„ WS handshake
๐Ÿš€ ๋ Œ๋”๋ง ๋ฒ”์ธ์€ ํ•˜๋‚˜!

ํ˜‘์—… ๊ทœ์น™

๐ŸŒˆ ๊ทธ๋ผ์šด๋“œ ๋ฃฐ
๐Ÿฅ” ํŒ€์› ์†Œ๊ฐœ
๐Ÿ”Ž ์ฝ”๋“œ & ๊นƒ ์ปจ๋ฒค์…˜
๐ŸŒณ ๊นƒ branch ์ „๋žต
๐Ÿ“Œ ๋…ธ์…˜ ๋ฌธ์„œ ์ €์žฅ์†Œ

ํ”„๋กœ์ ํŠธ ๊ธฐํš

๐ŸŽจ ํ”ผ๊ทธ๋งˆ
๐Ÿง‘โ€๐Ÿ’ป ๊ธฐํš ๊ณต์œ  ๋ฐœํ‘œ ์ž๋ฃŒ
๐ŸŽค 2์ฃผ์ฐจ ๋ฐœํ‘œ ์ž๋ฃŒ
๐Ÿ˜Ž ๋ฐฑ๋กœ๊ทธ

๋ฐ์ผ๋ฆฌ ์Šคํฌ๋Ÿผ

๐Ÿ“ 1์ฃผ์ฐจ
๐Ÿ“ 2์ฃผ์ฐจ
๐Ÿ“ 3์ฃผ์ฐจ
๐Ÿ“ 4์ฃผ์ฐจ
๐Ÿ“ 5์ฃผ์ฐจ

์ฃผ๊ฐ„ ๊ณ„ํš์„œ

๐Ÿ—“๏ธ 1์ฃผ์ฐจ
๐Ÿ—“๏ธ 2์ฃผ์ฐจ
๐Ÿ—“๏ธ 3์ฃผ์ฐจ
๐Ÿ—“๏ธ 4์ฃผ์ฐจ
๐Ÿ—“๏ธ 5์ฃผ์ฐจ

๊ทธ๋ฃน ํšŒ๊ณ 

โœจ 1์ฃผ์ฐจ
โœจ 2์ฃผ์ฐจ
โœจ 3์ฃผ์ฐจ
โœจ 4์ฃผ์ฐจ


view

Clone this wiki locally