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

Implement HEADER transmission mode for CMCD data #3537

Open
wilaw opened this issue Feb 15, 2021 · 3 comments · Fixed by #3554
Open

Implement HEADER transmission mode for CMCD data #3537

wilaw opened this issue Feb 15, 2021 · 3 comments · Fixed by #3554

Comments

@wilaw
Copy link
Member

wilaw commented Feb 15, 2021

It was assumed that CMCD would always be more efficient to implement via query args, since the use of custom headers required an OPTIONs preflight request to be made to the origin. This is true for media objects requested via discreet GET requests. However, if range requests are used, such as with ondemand addressing in DASH, the the browser makes a new OPTIONS preflight for the range header with each new 'URL'. Since the query rgs are included in the definition of the URL, the browser ends up making a preflight request ahead of every single media sement request as soon as CMCD data is added. This is inefficient.

A solution is for dash.js to offer the HEADER mode of transmission, in which the CMCD data is carried in one of 4 headers (CMCD-Request,CMCD-Object,CMCD-Status,CMCD-Session). The first time these headers are sent, the browser will make a preflight request. This request, if successful, will be cached for the time defined by the Access-Control-Max-Age response header, which is usually longer than the content duration. This results in only one preflight request being made (satisfying the check for both the CMCD and range request headers) which is more efficient than the query arg mode for that ondemand profile.

Specifically, what is requested is

  1. API to choose the HEADER mode of CMCD transmission. Default can still be query arg.
  2. Code to package CMCD data in to correct headers and then add it to the outgoing requests.
  3. Error reporting and log warnings if the Access-Control-Allow-Headers to not give permission for the CMCD headers.
  4. Log warnings if the Access-Control-Max-Age is not set.
  5. Log suggestion to use header mode if it is noticed that query args are being used with ondemand profile.
@dsilhavy dsilhavy added this to the 3.3.0 milestone Feb 15, 2021
@dsilhavy dsilhavy linked a pull request Feb 26, 2021 that will close this issue
@dsilhavy dsilhavy reopened this Mar 30, 2021
@dsilhavy
Copy link
Collaborator

  • Header mode has been implemented here: [WIP] CMCD as HTTP headers #3554 . It can be tested in the reference client by selecting transmission mode "header" in the CMCD options.
  • I leave this ticket open until the following enhancements have been made:
    • Introduce mode "dynamic" to make dash.js select the best mode depending on the segment format (for instance prefer header mode in SegmentBase Range Request case)
    • Error reporting and log warnings if the Access-Control-Allow-Headers to not give permission for the CMCD headers.
    • Log warnings if the Access-Control-Max-Age is not set.
    • Log suggestion to use header mode if it is noticed that query args are being used with ondemand profile.

@dsilhavy dsilhavy modified the milestones: 3.2.2, 4.0.0 Mar 30, 2021
@dsilhavy
Copy link
Collaborator

@wilaw We are currently working on the dynamic mode. For that purpose, we want to check if the CDN supports the CMCD headers. If thats the case we can switch between query parameter mode and header mode.

In order to be able to access this information the following additional header field needs to be set:
Access-Control-Expose-Headers: allows a server to indicate which response headers should be made available to scripts running in the browser, in response to a cross-origin request.

Could you add this to the CDN with the values: Access-Control-Allow-Headers and Access-Control-Max-Age. This would enable us to check if CMCD headers are allowed by the CDN.

@wilaw
Copy link
Member Author

wilaw commented May 13, 2021

I could add this value, however the player is always going to encounter situations where the header is not present and it needs to be robust over those. The same is true if it tries to add a custom hearer to send the data. So I suggest the dynamic mode be built such that it tries to write the custom headers and reacts to the error if it can't.

@dsilhavy dsilhavy modified the milestones: 4.0.0, 4.0.1 Jun 9, 2021
@dsilhavy dsilhavy modified the milestones: 4.0.1, 4.1.0 Jun 27, 2021
@dsilhavy dsilhavy modified the milestones: 4.1.0, 4.1.1 Sep 15, 2021
@dsilhavy dsilhavy modified the milestones: 4.2.0, 4.3.0 Nov 19, 2021
@dsilhavy dsilhavy modified the milestones: 4.2.1, 4.3.0 Dec 20, 2021
@dsilhavy dsilhavy modified the milestones: 4.3.0, 4.3.1 Feb 14, 2022
@dsilhavy dsilhavy removed this from the 4.4.0 milestone Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants