Hi,
I have a m3u8 url and i have to pass a token on header without token stream will not play.
I have try this approch but still player is not playing
const requestCallback = (type, request) => {
console.log(‘type-----’, type);
console.log(‘request-------’, request);
// Modify the request
request.headers['Authorization'] = `Bearer ${currentToken}`;
request.method = 'GET';
// Return the processed request via a Promise
const processed = {
body: request.body,
headers: request.headers,
method: request.method,
url: request.url,
};
// console.log('🚀 ~ requestCallback ~ processed:', processed);
return Promise.resolve(processed);
};
const player = usePlayer({
licenseKey: ‘gfhgfhfh’,
networkConfig: {
preprocessHttpRequest: requestCallback,
},
});