I have a backend api (using express) that handles a streaming video m3u8 file.
http://localhost:3000/api/stream.m3u8
This endpoint will only work with a proper user token
.
router
router.get('/api/stream.m3u8', controller.stream);
controller
exports.stream = function(req, res) {
var token = ''; // ? not sure how to get access to a sent up token
if (!token) res.status(401).json('Not authorized');
// if token is valid, proceed
};
On the front end, I am using videojs.
var player = videojs('my-player', {})
// set source to my backend api m3u8 file
player.src({
src: 'http://localhost:3000/api/stream.m3u8',
type: 'application/x-mpegURL'
});
Is there a way to add a custom header to the videojs plugin to send up data to my backend?