Created
May 1, 2023 05:19
-
-
Save f0-x/1f73eaf9f8840fc8c8ebe73fa8d6fc10 to your computer and use it in GitHub Desktop.
Custom react-player that supports XHR Headers
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
<ReactPlayer | |
url={`/bin.oms/${videoId}`} | |
config={{ | |
file: { | |
hlsOptions: { | |
forceHLS: true, | |
debug: false, | |
xhrSetup: function (xhr, url) { | |
xhr.withCredentials = true; // do send cookies | |
xhr.setRequestHeader( | |
"Authorization", | |
`Basic ${getBasicToken()}` | |
); | |
}, | |
}, | |
}, | |
}} | |
muted={true} | |
controls={true} | |
width="100%" | |
height="100%" | |
style={{ | |
background: "#191F27", | |
}} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment