akamai / edgeworkers-examples

EdgeWorkers Examples – This repository contains practical examples, that can be used as a starting point for Akamai EdgeWorkers.
Apache License 2.0
138 stars 77 forks source link

Feature/media dash module #165

Closed pjaiprakakamai closed 1 year ago

pjaiprakakamai commented 1 year ago

This commit includes code changes for dash manifest personalization. Refer to class 'DashParser' in media-delivery-dash-parser.js file . This is the class written by us to implement manifest personalization. The other classes in the file refers to the imported library classes to help in parsing of mpd file from string to JSON object , converting JSON object back to string representing dash media presentation description file.

pjaiprakakamai commented 1 year ago

Hi Evan,

Regarding point 1, I’m using dash-mpd-parser( @.***/dash-mpd-parser ) which is published by Akamai developer Shige Fukushima . I see this license file in his repo : https://git.source.akamai.com/projects/A2S/repos/ew-media-dash-mpd-video-bitrate-filter/browse/LICENSE-APACHE-2.0 . Can I use the same license file and add it to the repo ?

Regards, Poornima.

From: evan-hughes @.> Reply-To: akamai/edgeworkers-examples @.> Date: Thursday, November 24, 2022 at 2:15 AM To: akamai/edgeworkers-examples @.> Cc: "Jaiprakash, Poornima" @.>, Author @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

@evan-hughes requested changes on this pull request.

I have the following concerns:

  1. The dash parser appears to include a number of other modules, but I don't see a listing of their licenses, etc.
  2. parseMPD() and stringifyMPD() operate on a static field, which seems to be shared outside the DashParser and then passed back in to be modified with the other functions on the class. Don't do this: the static field persists between requests and is a potential data leak. Either create an object that has the appropriate stringify, updated, filter, etc functions, or remove the static variable holding the JSON and pass the mpdJson value between the functions.

I have a few other style comments about code duplication and stripping stack traces, but those aren't as significant.


In delivery/media/dash/apis/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030774263__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf45r7bRT$:

@@ -0,0 +1,4 @@

+For the latest JWT API documentation, please visit this page

Is that a publicly accessible IP? Do you want to reference it in a publicly available module?


In delivery/media/dash/examples/manifestmanipulation-1/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030775784__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6LWSxx5$:

@@ -0,0 +1,30 @@

+# Example

+The examples in this section detail how to use Dash module for manifest manipulation

+Manifest Personalization helps to dynamically create personalized versions of Dash manifests based on parameters like device type, user geography, request headers or query string parameters.This example demonstrates use of query string parameters.

+main.js provides examples using ReadableStream, WritableStream for different use cases as defined below:

+filterVariantsByBandwidth which filters out dash MPD representations by bandwidth value passed using query param br_in_range and br_in

+example curl :

+curl -vk -H "Pragma: akamai-x-ew-debug-subs,akamai-x-ew-debug,akamai-x-ew-debug,akamai-x-ew-debug-rp" "https://hostname/sample1.mpd?br_in_range=400000-600000,800000-1000000"

The curls need some sort of markup around them, otherwise they get mixed in with the preceding text.


In delivery/media/dash/lib/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030778265__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf5yooQSg$:

@@ -0,0 +1,19 @@

+# JWT Module

+

+The Dash module can be used to demonstrate EW's capabilities of dynamically creating personalized versions of DASH manifests based on parameters like device type, user geography, request headers or query string parameters.

+

+## Limitations

+

+

+## Files

+* media-delivery-dash-parser.js is the main class you import in your main.js file. This file provides helper classes such as parseMPD for parsing MPD to JSON objects.

+* media-delivery-dash-parse.d.ts is the typescript declaration file for DashParser module.

TypeScript should be capitalized.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779802__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-hmQOt6$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

I believe collaborate.akamai.com is only accessible to Akamai employees. Is there a customer-facing document that offers the same information?


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779998__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyOBJHCh$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

Typo in necessary.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030781326__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf3bZtRIR$:

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

A @.***} to the parseMPD() function would be helpful.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030782511__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8ZdzhkI$:

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

Please remove the @param tag - it shouldn't be specified if there aren't any parameters.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030788369__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfw-QYkNA$:

  • let filteredRenditions = adaptationSet[DashConstants.REPRESENTATION].filter(filterFnForUnknownAdaptationSet);

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Why catch and rethrow the error? Dropping the original exception means the customer can't see the stack trace.

Unless there's a good reason to strip the stack trace, I suggest removing the try/catch.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030800734__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf_epVfP2$:

  • adaptationSet[DashConstants.REPRESENTATION] = filteredRenditions;

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Please return an instance of the dashMpd class instead of keeping the current request's state in a static variable.

It's cleaner and it prevents customer coding errors from accidentally referencing the wrong file.

In general this is a pattern we discourage. If the customer decides they want to cache within their EdgeWorker, they can, but it shouldn't be done in the domain parsing/manipulation layer.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030808942__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf1zB9deN$:

  • crarr: "↵",

+}

+

+var X2JS = X2JS$1.exports = function(config) {

Where does this class come from? There's a GitHub project that has similar codehttps://urldefense.com/v3/__https:/github.com/abdolence/x2js/blob/master/xml2json.js__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyNmgs8P$, but it's under an Apache license. If that's the source, then you need to include the license, attribution, and changes listinghttps://urldefense.com/v3/__https:/en.wikipedia.org/wiki/Apache_License*Licensing_conditions__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf4ktB0tm$.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030811142__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6Uca6tl$:

  • dashMpd.parse(mpdXml);

This discards the stack trace from error, which will make it harder for developers to use the API.

Please remove this.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030819048__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf7J0zP-4$:

  • return this.mpd;

Why redefine this function? Attr appears to do the same thing.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030820540__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8dbVKXc$:

  • if (!mpdJson) throw new Error("DashParser: filterVariantsByBandwidth api failed ,dash mpd json object cannot be empty");

AFAICT every instance of DashConstants.ATTR_BANDWIDTH is wrapped by a call to Attr, attr, or Attr$1, all of which prepend an @.

Would it be possible to remove that function call and embed the @ into the constant?


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030821609__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxc4lT3N$:

@@ -0,0 +1,2006 @@

+import { logger } from "log";

+

+const DashConstants = new class {

A large number of these constants aren't referenced in this module (AFAICT) and they don't appear to be exported from this module.

Could you use a tree shaker to remove the unused constants?


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030832506__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfzmyAxb6$:

  • completeProcessing.then(() => readController.close());

+}

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

Do not copy headers directly from the subrequest. That can corrupt the response.

See the green block under https://techdocs.akamai.com/edgeworkers/docs/http-request#http-sub-requests.


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030841808__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf37OkraR$:

  • let write = function (msg) { readController.enqueue(${msg});};

+}

+

+export function onClientResponse (request, response) {

Please update this to:

  1. Set the value in the second argument.
  2. Remove the space from the header name.

See https://techdocs.akamai.com/edgeworkers/docs/response-object#setheader


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843618__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-JIbT08$:

+

+}

+

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

See the previous comment about reusing the response.headers.


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843826__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfx-WZwlA$:

  • const langs_array = (langs && langs.split(',')) || [];

+}

+

+

+export function onClientResponse (request, response) {

See the previous comment about setHeader parameters.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*pullrequestreview-1192129383__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxlIul7m$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A3VOX5NHIVYT2ZC5UE2EXCLWJZ65BANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf2vpGRw-$. You are receiving this because you authored the thread.Message ID: @.***>

evan-hughes commented 1 year ago

Hey Poornima,

I haven’t looked at all of the modules you referenced, but it there appear to be a number that have the Apache license. If that’s the case, and you’re vendoring their code, I think you need to include the license text and list of contributors somewhere in distribution. The dash-mpd-parser appears to be an npm module, so it doesn’t have that requirement.

e

From: pjaiprakakamai @.> Reply-To: akamai/edgeworkers-examples @.> Date: Tuesday, November 29, 2022 at 2:57 PM To: akamai/edgeworkers-examples @.> Cc: "Hughes, Evan" @.>, Mention @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

Hi Evan,

Regarding point 1, I’m using dash-mpd-parser( @.***/dash-mpd-parser ) which is published by Akamai developer Shige Fukushima . I see this license file in his repo : https://git.source.akamai.com/projects/A2S/repos/ew-media-dash-mpd-video-bitrate-filter/browse/LICENSE-APACHE-2.0 . Can I use the same license file and add it to the repo ?

Regards, Poornima.

From: evan-hughes @.> Reply-To: akamai/edgeworkers-examples @.> Date: Thursday, November 24, 2022 at 2:15 AM To: akamai/edgeworkers-examples @.> Cc: "Jaiprakash, Poornima" @.>, Author @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

@evan-hughes requested changes on this pull request.

I have the following concerns:

  1. The dash parser appears to include a number of other modules, but I don't see a listing of their licenses, etc.
  2. parseMPD() and stringifyMPD() operate on a static field, which seems to be shared outside the DashParser and then passed back in to be modified with the other functions on the class. Don't do this: the static field persists between requests and is a potential data leak. Either create an object that has the appropriate stringify, updated, filter, etc functions, or remove the static variable holding the JSON and pass the mpdJson value between the functions.

I have a few other style comments about code duplication and stripping stack traces, but those aren't as significant.


In delivery/media/dash/apis/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030774263__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf45r7bRT$:

@@ -0,0 +1,4 @@

+For the latest JWT API documentation, please visit this page

Is that a publicly accessible IP? Do you want to reference it in a publicly available module?


In delivery/media/dash/examples/manifestmanipulation-1/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030775784__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6LWSxx5$:

@@ -0,0 +1,30 @@

+# Example

+The examples in this section detail how to use Dash module for manifest manipulation

+Manifest Personalization helps to dynamically create personalized versions of Dash manifests based on parameters like device type, user geography, request headers or query string parameters.This example demonstrates use of query string parameters.

+main.js provides examples using ReadableStream, WritableStream for different use cases as defined below:

+filterVariantsByBandwidth which filters out dash MPD representations by bandwidth value passed using query param br_in_range and br_in

+example curl :

+curl -vk -H "Pragma: akamai-x-ew-debug-subs,akamai-x-ew-debug,akamai-x-ew-debug,akamai-x-ew-debug-rp" "https://hostname/sample1.mpd?br_in_range=400000-600000,800000-1000000"

The curls need some sort of markup around them, otherwise they get mixed in with the preceding text.


In delivery/media/dash/lib/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030778265__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf5yooQSg$:

@@ -0,0 +1,19 @@

+# JWT Module

+

+The Dash module can be used to demonstrate EW's capabilities of dynamically creating personalized versions of DASH manifests based on parameters like device type, user geography, request headers or query string parameters.

+

+## Limitations

+

+

+## Files

+* media-delivery-dash-parser.js is the main class you import in your main.js file. This file provides helper classes such as parseMPD for parsing MPD to JSON objects.

+* media-delivery-dash-parse.d.ts is the typescript declaration file for DashParser module.

TypeScript should be capitalized.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779802__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-hmQOt6$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

I believe collaborate.akamai.com is only accessible to Akamai employees. Is there a customer-facing document that offers the same information?


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779998__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyOBJHCh$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

Typo in necessary.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030781326__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf3bZtRIR$:

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

A @.***} to the parseMPD() function would be helpful.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030782511__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8ZdzhkI$:

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

Please remove the @param tag - it shouldn't be specified if there aren't any parameters.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030788369__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfw-QYkNA$:

  • let filteredRenditions = adaptationSet[DashConstants.REPRESENTATION].filter(filterFnForUnknownAdaptationSet);

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Why catch and rethrow the error? Dropping the original exception means the customer can't see the stack trace.

Unless there's a good reason to strip the stack trace, I suggest removing the try/catch.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030800734__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf_epVfP2$:

  • adaptationSet[DashConstants.REPRESENTATION] = filteredRenditions;

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Please return an instance of the dashMpd class instead of keeping the current request's state in a static variable.

It's cleaner and it prevents customer coding errors from accidentally referencing the wrong file.

In general this is a pattern we discourage. If the customer decides they want to cache within their EdgeWorker, they can, but it shouldn't be done in the domain parsing/manipulation layer.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030808942__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf1zB9deN$:

  • crarr: "↵",

+}

+

+var X2JS = X2JS$1.exports = function(config) {

Where does this class come from? There's a GitHub project that has similar codehttps://urldefense.com/v3/__https:/github.com/abdolence/x2js/blob/master/xml2json.js__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyNmgs8P$, but it's under an Apache license. If that's the source, then you need to include the license, attribution, and changes listinghttps://urldefense.com/v3/__https:/en.wikipedia.org/wiki/Apache_License*Licensing_conditions__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf4ktB0tm$.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030811142__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6Uca6tl$:

  • dashMpd.parse(mpdXml);

This discards the stack trace from error, which will make it harder for developers to use the API.

Please remove this.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030819048__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf7J0zP-4$:

  • return this.mpd;

Why redefine this function? Attr appears to do the same thing.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030820540__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8dbVKXc$:

  • if (!mpdJson) throw new Error("DashParser: filterVariantsByBandwidth api failed ,dash mpd json object cannot be empty");

AFAICT every instance of DashConstants.ATTR_BANDWIDTH is wrapped by a call to Attr, attr, or Attr$1, all of which prepend an @.

Would it be possible to remove that function call and embed the @ into the constant?


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030821609__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxc4lT3N$:

@@ -0,0 +1,2006 @@

+import { logger } from "log";

+

+const DashConstants = new class {

A large number of these constants aren't referenced in this module (AFAICT) and they don't appear to be exported from this module.

Could you use a tree shaker to remove the unused constants?


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030832506__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfzmyAxb6$:

  • completeProcessing.then(() => readController.close());

+}

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

Do not copy headers directly from the subrequest. That can corrupt the response.

See the green block under https://techdocs.akamai.com/edgeworkers/docs/http-request#http-sub-requests.


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030841808__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf37OkraR$:

  • let write = function (msg) { readController.enqueue(${msg});};

+}

+

+export function onClientResponse (request, response) {

Please update this to:

  1. Set the value in the second argument.
  2. Remove the space from the header name.

See https://techdocs.akamai.com/edgeworkers/docs/response-object#setheader


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843618__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-JIbT08$:

+

+}

+

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

See the previous comment about reusing the response.headers.


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843826__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfx-WZwlA$:

  • const langs_array = (langs && langs.split(',')) || [];

+}

+

+

+export function onClientResponse (request, response) {

See the previous comment about setHeader parameters.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*pullrequestreview-1192129383__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxlIul7m$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A3VOX5NHIVYT2ZC5UE2EXCLWJZ65BANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf2vpGRw-$. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*issuecomment-1331143363__;Iw!!GjvTz_vk!S7PoP2zkCyPXrkqirICfbQh35PkofJf0BcYCg8BgUZ1XrZGhLC7y9aGEUuJ8W8AI3DZyKZwLBK21Q1HleFfrG-g$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AN4S6VTKM7PXPAV3EMBAERLWKZG3DANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!S7PoP2zkCyPXrkqirICfbQh35PkofJf0BcYCg8BgUZ1XrZGhLC7y9aGEUuJ8W8AI3DZyKZwLBK21Q1Hlzk-FfKM$. You are receiving this because you were mentioned.Message ID: @.***>

pjaiprakakamai commented 1 year ago

Hi Evan,

I’m just adding dash-mpd-parser as dependency in @.***/dash-mpd-parser": "^0.5.0") but this node module in turn uses X2JS (https://github.com/abdolence/x2js) . Can I get more details as to where should I exactly add the license text and list of contributors for the same ? Or is it sufficient if dash-mpd-parser adds the license text instead as I’m not using X2JS directly ?

Regards,

Poornima.

From: evan-hughes @.> Reply-To: akamai/edgeworkers-examples @.> Date: Wednesday, November 30, 2022 at 7:56 PM To: akamai/edgeworkers-examples @.> Cc: "Jaiprakash, Poornima" @.>, Author @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

Hey Poornima,

I haven’t looked at all of the modules you referenced, but it there appear to be a number that have the Apache license. If that’s the case, and you’re vendoring their code, I think you need to include the license text and list of contributors somewhere in distribution. The dash-mpd-parser appears to be an npm module, so it doesn’t have that requirement.

e

From: pjaiprakakamai @.> Reply-To: akamai/edgeworkers-examples @.> Date: Tuesday, November 29, 2022 at 2:57 PM To: akamai/edgeworkers-examples @.> Cc: "Hughes, Evan" @.>, Mention @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

Hi Evan,

Regarding point 1, I’m using dash-mpd-parser( @.***/dash-mpd-parser ) which is published by Akamai developer Shige Fukushima . I see this license file in his repo : https://git.source.akamai.com/projects/A2S/repos/ew-media-dash-mpd-video-bitrate-filter/browse/LICENSE-APACHE-2.0 . Can I use the same license file and add it to the repo ?

Regards, Poornima.

From: evan-hughes @.> Reply-To: akamai/edgeworkers-examples @.> Date: Thursday, November 24, 2022 at 2:15 AM To: akamai/edgeworkers-examples @.> Cc: "Jaiprakash, Poornima" @.>, Author @.***> Subject: Re: [akamai/edgeworkers-examples] Feature/media dash module (PR #165)

@evan-hughes requested changes on this pull request.

I have the following concerns:

  1. The dash parser appears to include a number of other modules, but I don't see a listing of their licenses, etc.
  2. parseMPD() and stringifyMPD() operate on a static field, which seems to be shared outside the DashParser and then passed back in to be modified with the other functions on the class. Don't do this: the static field persists between requests and is a potential data leak. Either create an object that has the appropriate stringify, updated, filter, etc functions, or remove the static variable holding the JSON and pass the mpdJson value between the functions.

I have a few other style comments about code duplication and stripping stack traces, but those aren't as significant.


In delivery/media/dash/apis/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030774263__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf45r7bRT$:

@@ -0,0 +1,4 @@

+For the latest JWT API documentation, please visit this page

Is that a publicly accessible IP? Do you want to reference it in a publicly available module?


In delivery/media/dash/examples/manifestmanipulation-1/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030775784__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6LWSxx5$:

@@ -0,0 +1,30 @@

+# Example

+The examples in this section detail how to use Dash module for manifest manipulation

+Manifest Personalization helps to dynamically create personalized versions of Dash manifests based on parameters like device type, user geography, request headers or query string parameters.This example demonstrates use of query string parameters.

+main.js provides examples using ReadableStream, WritableStream for different use cases as defined below:

+filterVariantsByBandwidth which filters out dash MPD representations by bandwidth value passed using query param br_in_range and br_in

+example curl :

+curl -vk -H "Pragma: akamai-x-ew-debug-subs,akamai-x-ew-debug,akamai-x-ew-debug,akamai-x-ew-debug-rp" "https://hostname/sample1.mpd?br_in_range=400000-600000,800000-1000000"

The curls need some sort of markup around them, otherwise they get mixed in with the preceding text.


In delivery/media/dash/lib/README.mdhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030778265__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf5yooQSg$:

@@ -0,0 +1,19 @@

+# JWT Module

+

+The Dash module can be used to demonstrate EW's capabilities of dynamically creating personalized versions of DASH manifests based on parameters like device type, user geography, request headers or query string parameters.

+

+## Limitations

+

+

+## Files

+* media-delivery-dash-parser.js is the main class you import in your main.js file. This file provides helper classes such as parseMPD for parsing MPD to JSON objects.

+* media-delivery-dash-parse.d.ts is the typescript declaration file for DashParser module.

TypeScript should be capitalized.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779802__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-hmQOt6$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

I believe collaborate.akamai.com is only accessible to Akamai employees. Is there a customer-facing document that offers the same information?


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030779998__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyOBJHCh$:

@@ -0,0 +1,88 @@

+declare const MIME_TYPE_VIDEO_PREFIX: string;

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

Typo in necessary.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030781326__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf3bZtRIR$:

+declare const MIME_TYPE_AUDIO_PREFIX: string;

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

A @.***} to the parseMPD() function would be helpful.


In delivery/media/dash/lib/media-delivery-dash-parser.d.tshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030782511__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8ZdzhkI$:

+declare const MIME_TYPE_TEXT_PREFIX: string;

+/**

+declare class DashParser {

Please remove the @param tag - it shouldn't be specified if there aren't any parameters.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030788369__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfw-QYkNA$:

  • let filteredRenditions = adaptationSet[DashConstants.REPRESENTATION].filter(filterFnForUnknownAdaptationSet);

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Why catch and rethrow the error? Dropping the original exception means the customer can't see the stack trace.

Unless there's a good reason to strip the stack trace, I suggest removing the try/catch.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030800734__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf_epVfP2$:

  • adaptationSet[DashConstants.REPRESENTATION] = filteredRenditions;

+}, Attr = function(name) {

+}, MIME_TYPE_VIDEO_PREFIX = "video/", MIME_TYPE_AUDIO_PREFIX = "audio/", MIME_TYPE_TEXT_PREFIX = "application/";

+

+class DashParser {

Please return an instance of the dashMpd class instead of keeping the current request's state in a static variable.

It's cleaner and it prevents customer coding errors from accidentally referencing the wrong file.

In general this is a pattern we discourage. If the customer decides they want to cache within their EdgeWorker, they can, but it shouldn't be done in the domain parsing/manipulation layer.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030808942__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf1zB9deN$:

  • crarr: "↵",

+}

+

+var X2JS = X2JS$1.exports = function(config) {

Where does this class come from? There's a GitHub project that has similar codehttps://urldefense.com/v3/__https:/github.com/abdolence/x2js/blob/master/xml2json.js__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfyNmgs8P$, but it's under an Apache license. If that's the source, then you need to include the license, attribution, and changes listinghttps://urldefense.com/v3/__https:/en.wikipedia.org/wiki/Apache_License*Licensing_conditions__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf4ktB0tm$.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030811142__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf6Uca6tl$:

  • dashMpd.parse(mpdXml);

This discards the stack trace from error, which will make it harder for developers to use the API.

Please remove this.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030819048__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf7J0zP-4$:

  • return this.mpd;

Why redefine this function? Attr appears to do the same thing.


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030820540__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf8dbVKXc$:

  • if (!mpdJson) throw new Error("DashParser: filterVariantsByBandwidth api failed ,dash mpd json object cannot be empty");

AFAICT every instance of DashConstants.ATTR_BANDWIDTH is wrapped by a call to Attr, attr, or Attr$1, all of which prepend an @.

Would it be possible to remove that function call and embed the @ into the constant?


In delivery/media/dash/lib/media-delivery-dash-parser.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030821609__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxc4lT3N$:

@@ -0,0 +1,2006 @@

+import { logger } from "log";

+

+const DashConstants = new class {

A large number of these constants aren't referenced in this module (AFAICT) and they don't appear to be exported from this module.

Could you use a tree shaker to remove the unused constants?


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030832506__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfzmyAxb6$:

  • completeProcessing.then(() => readController.close());

+}

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

Do not copy headers directly from the subrequest. That can corrupt the response.

See the green block under https://techdocs.akamai.com/edgeworkers/docs/http-request#http-sub-requests.


In delivery/media/dash/examples/manifestmanipulation-1/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030841808__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf37OkraR$:

  • let write = function (msg) { readController.enqueue(${msg});};

+}

+

+export function onClientResponse (request, response) {

Please update this to:

  1. Set the value in the second argument.
  2. Remove the space from the header name.

See https://techdocs.akamai.com/edgeworkers/docs/response-object#setheader


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843618__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf-JIbT08$:

+

+}

+

+

+export function onClientResponse (request, response) {

+}

+

+export function responseProvider (request) {

See the previous comment about reusing the response.headers.


In delivery/media/dash/examples/manifestmanipulation-2/main.jshttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*discussion_r1030843826__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfx-WZwlA$:

  • const langs_array = (langs && langs.split(',')) || [];

+}

+

+

+export function onClientResponse (request, response) {

See the previous comment about setHeader parameters.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*pullrequestreview-1192129383__;Iw!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qfxlIul7m$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A3VOX5NHIVYT2ZC5UE2EXCLWJZ65BANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!QnCa2xAr_rcwxvFEYC1vBhsOa8RCfvyaUWLyULKk78Ow0c9a9Yspwx53FAXCowjORoV3RGQ-R9t7_h9qf2vpGRw-$. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*issuecomment-1331143363__;Iw!!GjvTz_vk!S7PoP2zkCyPXrkqirICfbQh35PkofJf0BcYCg8BgUZ1XrZGhLC7y9aGEUuJ8W8AI3DZyKZwLBK21Q1HleFfrG-g$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AN4S6VTKM7PXPAV3EMBAERLWKZG3DANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!S7PoP2zkCyPXrkqirICfbQh35PkofJf0BcYCg8BgUZ1XrZGhLC7y9aGEUuJ8W8AI3DZyKZwLBK21Q1Hlzk-FfKM$. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/akamai/edgeworkers-examples/pull/165*issuecomment-1332229152__;Iw!!GjvTz_vk!UQomRyOxV-A72-APwgTP3iHwuAGG-OwKDxbBJ4sRyXUHnmXHsO1ZtEyX17sueKV_7a9ItZwTrFYbtqAEpVRM61cx$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A3VOX5M635VDD64SXRT5OQTWK5PXLANCNFSM6AAAAAASHEAKYU__;!!GjvTz_vk!UQomRyOxV-A72-APwgTP3iHwuAGG-OwKDxbBJ4sRyXUHnmXHsO1ZtEyX17sueKV_7a9ItZwTrFYbtqAEpVm0Vs7U$. You are receiving this because you authored the thread.Message ID: @.***>

pjaiprakakamai commented 1 year ago

regarding 'Why catch and rethrow the error. Dropping the original exception means the customer can't see the stack trace.' I'm not dropping the original exception, just printing the same with a prefix 'DashParser: failed to parseMPD due to' . I'm calling parseMPD from my imported module and would like to catch possible errors that the parser may throw.

pjaiprakakamai commented 1 year ago

Hi @evan-hughes , @ananner @bmatthew

This PR is for accommodating feedback changes , fixing SQA bugs for EW compatible external DASH module.

Can you review and provide your valuable feedback. Latest commit id : b941362

Regards, Poornima.

evan-hughes commented 1 year ago

I’m just adding dash-mpd-parser as dependency in @.***/dash-mpd-parser": "^0.5.0") but this node module in turn uses X2JS (https://github.com/abdolence/x2js) . Can I get more details as to where should I exactly add the license text and list of contributors for the same ? Or is it sufficient if dash-mpd-parser adds the license text instead as I’m not using X2JS directly ?

If we're repackaging the X2JS source, I think you need to include the license and contributors somewhere in the redistribution source. IIRC we're using a LICENSE file, so you could add it there, I think. I can't speak to the contributors.

pjaiprakakamai commented 1 year ago

I’m just adding dash-mpd-parser as dependency in @.***/dash-mpd-parser": "^0.5.0") but this node module in turn uses X2JS (https://github.com/abdolence/x2js) . Can I get more details as to where should I exactly add the license text and list of contributors for the same ? Or is it sufficient if dash-mpd-parser adds the license text instead as I’m not using X2JS directly ?

If we're repackaging the X2JS source, I think you need to include the license and contributors somewhere in the redistribution source. IIRC we're using a LICENSE file, so you could add it there, I think. I can't speak to the contributors.

https://github.com/abdolence/x2js

added license details in License.md file under lib