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

Can't handle network requests over hls streaming in Safari #6932

Closed
baturays opened this issue Jun 27, 2024 · 11 comments
Closed

Can't handle network requests over hls streaming in Safari #6932

baturays opened this issue Jun 27, 2024 · 11 comments
Labels
type: question A question from the community

Comments

@baturays
Copy link

Have you read the Tutorials?
Yes

Have you read the FAQ and checked for duplicate open issues?
Yes

If the question is related to FairPlay, have you read the tutorial?

Yes

What version of Shaka Player are you using?
4.3.3

What browser and OS are you using?
Ventura - Safari (v16.3)

Please ask your question

Hello,

I have a system on my Safari browser that is protected with a DRM token and uses a CDN token for search parameters. When the CDN token expires, I regenerate it and intercept manifest requests, continuing with updated token parameters. In the playlists I play with Fairplay HLS, manifest requests are made every 6 seconds, and when the CDN token expires, I need to handle this by generating new token parameters and continuing.

However, on the DASH side, the register methods and the player's error events work correctly, but they do not work on the Fairplay HLS side. I cannot intercept manifest requests in any way, nor can I catch the 410 errors (server response due to CDN token expiration) from the network using the player's provided APIs.

I want to establish this logic on the HLS side as I have done with DASH Widevine. I would greatly appreciate your help.

Thank you.

@baturays baturays added the type: question A question from the community label Jun 27, 2024
@avelad
Copy link
Collaborator

avelad commented Jun 27, 2024

Please, use streaming.useNativeHlsOnSafari = false (config option) Thanks!

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 27, 2024
@baturays
Copy link
Author

Hello,

I have made the adjustments as you suggested, but there has been no change. I still cannot handle the requests sent over the network (manifest requests sent every 6 seconds), nor can I handle the 410 error thrown by the server when the CDN token expires. Events like onPlaying, onBuffering, and onRatechange are still working as they should.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 27, 2024
@baturays
Copy link
Author

Please, use streaming.useNativeHlsOnSafari = false (config option) Thanks!

Hello,

I have made the adjustments as you suggested, but there has been no change. I still cannot handle the requests sent over the network (manifest requests sent every 6 seconds), nor can I handle the 410 error thrown by the server when the CDN token expires. Events like onPlaying, onBuffering, and onRatechange are still working as they should.

@avelad
Copy link
Collaborator

avelad commented Jul 1, 2024

I'm sorry, I was wrong, I didn't realize that you're using Fairplay ... try with streaming.useNativeHlsForFairPlay = false but... You have to read the tutorial carefully for FairPlay with MSE; not all providers may support it.

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jul 1, 2024
@baturays
Copy link
Author

baturays commented Jul 1, 2024

I'm sorry, I was wrong, I didn't realize that you're using Fairplay ... try with streaming.useNativeHlsForFairPlay = false but... You have to read the tutorial carefully for FairPlay with MSE; not all providers may support it.

Hello again, we are using Verimatrix, and our DRM integration is implemented as shown in the tutorials. However, the main thing I want to ask is this: The registerRequestFilter and registerResponseFilter methods we use over the Networking engine are not being handled in any way. This seems to be the main issue. Why are these methods, which are also used in the tutorials, not working at all for Fairplay?

@avelad
Copy link
Collaborator

avelad commented Jul 1, 2024

When you use src= (not MSE), the native player is in charge of making the requests, not us. Verimatrix as far as I know does not support MSE, so the behavior you want to achieve is impossible (as far as I know).

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jul 1, 2024
@baturays
Copy link
Author

baturays commented Jul 1, 2024

When you use src= (not MSE), the native player is in charge of making the requests, not us. Verimatrix as far as I know does not support MSE, so the behavior you want to achieve is impossible (as far as I know).

Hi,

I am not using the src= attribute; instead, I am setting the video element through MSE.

The process of loading the video is as follows:

I get the video element and initialize Shaka Player with this element.
Then, I call the Player.load method with a specific URL to load the video.
I found the following code in your documentation regarding Verimatrix FairPlay support and implemented it:

javascript
Copy code
shaka.polyfill.PatchedMediaKeysApple.install();
const FairPlayUtils = shaka.util.FairPlayUtils;
player.getNetworkingEngine()
.registerRequestFilter(FairPlayUtils.verimatrixFairPlayRequest);
player.getNetworkingEngine()
.registerResponseFilter(FairPlayUtils.commonFairPlayResponse);
player.configure('drm.initDataTransform',
FairPlayUtils.verimatrixInitDataTransform);
However, when I implement this code, the registerRequestFilter and registerResponseFilter methods are never invoked. This indicates that Shaka Player is not intercepting and handling the requests.

Do you have any other suggestions or solutions regarding Verimatrix and MSE support? Is there any additional configuration or setting on the browser side that I need to apply?

Thanks.

@avelad
Copy link
Collaborator

avelad commented Jul 1, 2024

According to your code you should be using src= :) Please check the documentation: https://shaka-player-demo.appspot.com/docs/api/tutorial-fairplay.html
Captura de pantalla 2024-07-01 a las 14 37 00

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jul 1, 2024
@baturays
Copy link
Author

baturays commented Jul 1, 2024

Hello,

I set the src= method as suggested, but unfortunately, I didn't notice any change in behavior. My content is in the .ts format. I'm still facing issues with playing FairPlay HLS content using Shaka Player. I'm wondering if there's something crucial that I might be missing in my implementation specific to HLS playlists in the .ts format.

Could you please provide any additional insights or steps that could help me troubleshoot this further?

Thank you.

@avelad
Copy link
Collaborator

avelad commented Jul 1, 2024

It is not possible to do what you want with Shaka Player with what you comment, sorry!

@avelad avelad closed this as completed Jul 1, 2024
@baturays
Copy link
Author

baturays commented Jul 1, 2024

My goal is to ensure that the registerRequestFilter and registerResponseFilter methods work as expected with FairPlay content in Shaka Player. I need to handle network events effectively for my implementation.
As you suggested , i switched to use src= , nothing changed.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question A question from the community
Projects
None yet
Development

No branches or pull requests

3 participants