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

[v5] CommonMediaRequest #4299

Merged
merged 32 commits into from
Jan 8, 2024
Merged

[v5] CommonMediaRequest #4299

merged 32 commits into from
Jan 8, 2024

Conversation

bbert
Copy link
Contributor

@bbert bbert commented Oct 13, 2023

This PR integrates the CommonMediaRequest and CommonMediaResponse API from SVTA CommonMediaLibrary, available from version 0.5.0, to make dash.js relying on this reference API to enable applications to intercept requests and responses and to read stats/metrics of all requests.

See issue #4152

Pull request on SVTA Github to include CommonMediaRequest and CommonMediaResponse API : streaming-video-technology-alliance/common-media-library#18

What has been done so far:

  • add MediaPlayer API ro register requests and responses interceptors as specified in CommonMediaLibrary
  • refactor HTTPLoader, XHRLoader and FetchLoader to rely CommonMediaRequest and CommonMediaResponse
  • Apply the request and response interceptors from HTTPLoader
  • Add a sample application (in typescript) that adds a request interceptor (to update video segment request url by adding a query parameter) and a response interceptor (to add a response header)

image

image

To test the sample:

  1. Go to folder samples/network-interceptor
  2. Build the project: npm install then npm run build
  3. Open file localhost:3000/samples/network-interceptor/index.html (once npm start is running on project)

What remains to be done:

  • update/complete the CommonMediaRequest and CommonMediaResponse if needed
  • apply the interceptors also on licence requests/responses
  • remove the RequestModifier API

! Note:
Npm package @svta/common-media-library declared in package.json does not integrate yet the request package.
To enable building and sample running, you need:

  1. to clone@svta/common-media-library
  2. checkout branch common-media-request
  3. build the project
  4. Manually copy the dist files into node_modules/@svta/common-media-library and into samples/network-interceptor/node_modules/@svta/common-media-library

…nse API

- use CommonMediaRequest and CommonMediaResponse as base types for processing requests and responses
- apply request and response plugins
- mutualize RequestModifier usage in HTTPLoader and apply RequestModifier before request plugins
- update CmsdModel since response headers are now returned as a record of key:value
bbert added 2 commits October 25, 2023 11:20
- rename Request/ResponsePlugin to Request/ResponseInterceptor
- Request/ResponseInterceptor resolve Promise with returned request/response
- rename sample request-plugin to network-interceptor
@dsilhavy dsilhavy added this to the 5.0.0 milestone Nov 1, 2023
@dsilhavy dsilhavy self-requested a review November 1, 2023 10:58
- HTTLoader.load returned a Promise resolved once the inner loader (e.g. XHR) is loaded in order to get the XMLHttpRequest
- HTTLoader.load returned a Promise resolved once the inner loader (e.g. XHR) is loaded in order to get the XMLHttpRequest
@dsilhavy dsilhavy merged commit 262b536 into v5.0.0 Jan 8, 2024
@bbert bbert deleted the feature/v5-common-media-request branch January 22, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants