Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iphone browsers Safari and Chrome not sending custom headers #2098

Open
xoraingroup opened this issue Feb 2, 2023 · 5 comments
Open

Iphone browsers Safari and Chrome not sending custom headers #2098

xoraingroup opened this issue Feb 2, 2023 · 5 comments
Labels

Comments

@xoraingroup
Copy link

What do you want to do with Clappr?
I am trying to set custom headers on an hls stream using demo.

What have you tried so far?
I can see custom headers are being received from android devices while playing it in browser and also desktop browsers including linux, Mac and windows. Some how when using same demo from iphone browsers, it does not send those custom headers.

Setting custom headers as following:

hlsjsConfig: {
            xhrSetup: function (xhr, url) {
                xhr.setRequestHeader("key1", "value1")
                xhr.setRequestHeader("key2", "value2")
            }
        }

Can body help in this? Thank you

@kslimani
Copy link
Contributor

kslimani commented Feb 2, 2023

I think it is because, on iphone, the native html5 video element is used as playback instead of HLSJS one.

@xoraingroup
Copy link
Author

@kslimani thank you for information. I know about this. But Is there any way to handle custom headers using clappr player? Or that would be sending query params in link to compensate for header behaviour in iphone?

@kslimani
Copy link
Contributor

kslimani commented Feb 3, 2023

AFAIK, there is no mechanism in Clappr player which allow you to set custom headers.
Sending key values using query parameters seems the easier approach.

@xoraingroup
Copy link
Author

Right, the first issue is ok now. I am passing parameter in url for hls and it works ok.

How do I add query parameter to ts segment url when browser is trying to download them and feeding it to the player?

Basically what I am trying to do is routing based on either header or query param to send request to proper origin. For hls playlist file its ok now, but the segment is not getting routed, because our caching server dont know where to route the request without header or query information.

Does clappr player have some option to append query parameter to each request it send for hls playlist and ts segments?

@Mrhallah
Copy link

Je vous suggère de vérifier si la démo que vous prenez en charge les en-têtes personnalisés sur les navigateurs iPhone. Si ce n'est pas le cas, vous pouvez essayer d'utiliser une autre démo qui prend en charge les en-têtes personnalisés sur les navigateurs iPhone.

Si la démo prend en charge les en-têtes personnalisés sur les navigateurs iPhone, vous pouvez essayer de définir les en-têtes personnalisés d'une manière différente. Par exemple, vous pouvez essayer d'utiliser la méthode setRequestHeaderdirectement sur l'objet XMLHttpRequest. Voici un exemple de code :

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://example.com/playlist.m3u8', true);
xhr.setRequestHeader('key1', 'value1');
xhr.setRequestHeader('key2', 'value2');
xhr.send();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants