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

videojs.Hls.xhr.beforeRequest doesn't work in Safari iOS #7226

Closed
Raino opened this issue May 10, 2021 · 11 comments
Closed

videojs.Hls.xhr.beforeRequest doesn't work in Safari iOS #7226

Raino opened this issue May 10, 2021 · 11 comments

Comments

@Raino
Copy link

Raino commented May 10, 2021

Hello everyone!
I searched for information on this issue and found only old discussions of this problem (#1280, #1384).
It all came down to the fact that Safari on iOS does not support custom JS handlers and uses only its own, which is why the videojs.Hls.xhr.beforeRequest function cannot work. After that, I read that Apple has introduced support for the FullScreen API in Safari since iOS 12.
I tried to play around with

videojs.options.hls.overrideNative = true;
videojs.options.html5.nativeAudioTracks = false;
videojs.options.html5.nativeVideoTracks = false;

but it did not bring any result.
Maybe I messed up something and the FullScreen API doesn't affect how HLS works?
Perhaps there are some solutions to this problem with the operation of videojs.Hls.xhr. beforeRequest in Safari on iOS in 2021, or there are some workarounds for using videojs.Hls.xhr.beforeRequest?

@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

Unfortunately, iPhones do not support the fullscreen API nor Media Source Extensions, the API behind our playback engine. MSE not being supported means our playback engine cannot run and thus beforeRequest isn't available.
The Fullscreen API also doesn't work, but that's unrelated to beforeRequest.

@gkatsev gkatsev closed this as completed May 10, 2021
@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

To add, the fullscreen API is available on iPads but not iPhones.

@Raino
Copy link
Author

Raino commented May 10, 2021

@gkatsev Why isn't the Fullscreen API supported by iOS? The Internet says that it is supported. Is there any other way to update SRC videojs without beforeRequest and without restarting the player? A kind of "on the fly"

@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

To be clear, it's supported but only on iPads, not on iPhones. Why? Weird decisions from Apple.

What do you mean update src without restarting the player? You can pass a new source to the player via player.src() or player.loadMedia()

@Raino
Copy link
Author

Raino commented May 10, 2021

@gkatsev To replace the src player on the go, I used

videojs.Hls.xhr.beforeRequest = function(options){
	options.uri = ...

Is there a cross-browser solution with the same meaning?

@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

I would highly recommend against using that method to change the source of the player. Instead, you should be setting a new source via the player.src() method.

player.src({
  src: 'http://example.com/video.m3u8',
  type: 'application/x-mpegurl'
});

@video-archivist-bot
Copy link

Hey! We've detected some video files in a comment on this issue. If you'd like to permanently archive these videos and tie them to this project, a maintainer of the project can reply to this issue with the following commands:

@Raino
Copy link
Author

Raino commented May 10, 2021

@gkatsev I tried it. This method constantly stops the player and interrupts it. This is hardly a "substitution" of src. I need this to update the stream keys

@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

So your stream is token signed or something, and you need to update it every so often for it to be able to continue playing?
Unfortunately, that isn't something you can do on iPhones. Basically your only bet there is a proxy.

@Raino
Copy link
Author

Raino commented May 10, 2021

@gkatsev Which proxy are you talking about? Is it possible to do something by means of video.js?

@gkatsev
Copy link
Member

gkatsev commented May 10, 2021

There isn't anything you can do client-side for iPhones due to platform limitations.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants