-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stream token as query string / HLS config for less buffering (#4)
* Set more secuirty headers * Modify HLS.js options for less buffering * Pass stream token as query param
- Loading branch information
1 parent
abc6352
commit 3986c5a
Showing
8 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ResponseCookies } from 'next/dist/compiled/@edge-runtime/cookies' | ||
import { cookies, headers } from 'next/headers' | ||
|
||
import { STREAM_TOKEN_COOKIE_NAME } from '../constants' | ||
|
||
export function getStreamToken(): string { | ||
const headersStore = headers() | ||
const cookiesStore = cookies() | ||
const responseCookies = new ResponseCookies(headersStore as Headers) | ||
|
||
const streamTokenCookie = | ||
cookiesStore.get(STREAM_TOKEN_COOKIE_NAME) ?? | ||
responseCookies.get(STREAM_TOKEN_COOKIE_NAME) | ||
|
||
return streamTokenCookie?.value as string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters