Skip to content

Conversation

@cotid-qualabs
Copy link

Alternative MPD and List MPD implementation

sebastianpiq and others added 30 commits January 17, 2025 13:46
Implement alternative max duration and clip
…ad-with-t-anchor

Feature/alternative start at play head with t anchor
Alternative player signaling demo bug fixes
…efault

Add default value to the earliestResolutionTimeOffset
Remove href from dropdown links

Co-authored-by: Sebastian Piquerez <89274285+sebastianpiq@users.noreply.github.com>
typo

Co-authored-by: Sebastian Piquerez <89274285+sebastianpiq@users.noreply.github.com>
cotid-qualabs and others added 27 commits September 23, 2025 11:53
…ack-to-main-content

Media manager unit test: switch back to main content
…ve-media-presentations/media-manager-unit-tests
…media-manager-unit-tests

Alternative media presentations: media manager unit tests
…live-to-live-switch-back

feat: Implement live to live switch back
* alternative clip functional test vod to vod

* small refacotr alternative replace live functional test

* add clip live to live test case

* fix clip for live to live

* Update test/functional/test/feature-support/alternative/alternative-mpd-clip-vod.js

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* remove comment

* Update src/streaming/controllers/AlternativeMediaController.js

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* rename deltaTime

* remove comments

* add missing clear timeouts

* add missing done

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…in EventController and AlternativeMediaController
…update-and-listen-mode

Add Alternative event update and listen mode
Co-authored-by: Sebastian Piquerez <sebastianp@qualabs.com>
…listen-mode-sample-page

Add Listen Mode sample and update samples.json with new entry
@cotid-qualabs cotid-qualabs changed the title Sgai: alternative and list mpd SGAI: alternative and list mpd Jan 29, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @cotid-qualabs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the player's capabilities by integrating support for DASH Alternative Media Presentations and the List MPD profile. These additions enable advanced content manipulation, such as dynamic ad insertion, content replacement, and modular manifest composition, providing greater flexibility for content providers and a more dynamic viewing experience for users.

Highlights

  • Alternative Media Presentation Support: Introduced comprehensive support for DASH Alternative Media Presentations, allowing dynamic switching between main and alternative content (e.g., ad insertion, content replacement). This includes new controllers (AlternativeMediaController, MediaManager) and event handling logic.
  • List MPD Implementation: Added support for the List MPD profile, enabling manifests to reference external MPDs for individual periods. This allows for more flexible and modular manifest creation and dynamic period resolution.
  • New Samples and Functional Tests: Included several new samples (list-mpds.html, alternative-media-presentations.html, live-to-live.html, listen-mode.html, sgai-insert-test.html) to demonstrate the new features. Corresponding functional tests have been added to ensure correct behavior for various scenarios like clipping, executeOnce, returnOffset, and status updates.
  • Enhanced Event Handling: The EventController has been significantly updated to correctly process new attributes for Alternative MPD events, including earliestResolutionTimeOffset for pre-buffering, noJump for handling seek-ahead scenarios, and executeOnce for single-trigger events.
  • Manifest Model and Adapter Updates: The DashManifestModel and DashAdapter were updated to parse and merge linked periods from external MPDs into the main manifest structure, ensuring seamless playback transitions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces significant new functionality for Alternative Media Presentations and List MPDs, which is a great addition. The implementation includes new controllers, models, and sample pages to demonstrate the features. The code is generally well-structured. I've found a few issues, including some duplicate event definitions in CoreEvents.js that should be addressed. I've also suggested some minor refactoring in the new sample pages for better maintainability. Overall, this is a solid contribution.

Comment on lines 66 to 67
this.LOADING_COMPLETED = 'loadingCompleted';
this.LOADING_DATA_PROGRESS = 'loadingDataProgress';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

These event definitions are duplicates of lines 62 and 64. Please remove them to avoid confusion and potential issues.

Comment on lines +102 to +130
switch(caseId) {
case 'case0':
behavior.innerText = "The player should download the Imported MPD and reproduce the unique Period.";
break;
case 'case1':
behavior.innerText = "The player should download the first Imported MPD, reproduce its first Period, and, upon completion, download the second Imported MPD and reproduce its first Period.";
break;
case 'case2':
behavior.innerText = "The player should download the first Imported MPD, reproduce its first Period, and, upon completion, play the next regular Period.";
break;
case 'case3':
behavior.innerText = "The player should start by playing the first regular Period as usual and, upon completion, download the linked Imported MPD and reproduce its first Period.";
break;
case 'case4':
behavior.innerText = "The player should start by playing the first regular Period as usual and, upon its completion, download the linked Imported MPD at startTime - earliestResolutionTime and reproduce its first Period";
break;
case 'case5':
behavior.innerText = "The player should start by playing the first regular Period as usual and, upon its completion, download the linked Imported MPD at with earliestResolutionTime = 0 and reproduce its first Period.";
break;
case 'case6':
behavior.innerText = "The player must respect the shortest duration between the Linked Period in the main manifest and the Imported MPD. Playback should seamlessly stop at the shorter duration, ensuring no content extends beyond the specified boundaries.";
break;
case 'case7':
behavior.innerText = "The player should throw an error indicating that the start time of the first period in a list type MPD manifest is invalid.";
break;
case 'case8':
behavior.innerText = "The player should attempt to download the manifest four times before failing.";
break;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This switch statement can be refactored into a more maintainable data structure, like a map or an object, to associate case IDs with their behavior descriptions. This will make the code cleaner and easier to extend with new cases.

                    const behaviors = {
                        'case0': "The player should download the Imported MPD and reproduce the unique Period.",
                        'case1': "The player should download the first Imported MPD, reproduce its first Period, and, upon completion, download the second Imported MPD and reproduce its first Period.",
                        'case2': "The player should download the first Imported MPD, reproduce its first Period, and, upon completion, play the next regular Period.",
                        'case3': "The player should start by playing the first regular Period as usual and, upon completion, download the linked Imported MPD and reproduce its first Period.",
                        'case4': "The player should start by playing the first regular Period as usual and, upon its completion, download the linked Imported MPD at startTime - earliestResolutionTime and reproduce its first Period",
                        'case5': "The player should start by playing the first regular Period as usual and, upon its completion, download the linked Imported MPD at with earliestResolutionTime = 0 and reproduce its first Period.",
                        'case6': "The player must respect the shortest duration between the Linked Period in the main manifest and the Imported MPD. Playback should seamlessly stop at the shorter duration, ensuring no content extends beyond the specified boundaries.",
                        'case7': "The player should throw an error indicating that the start time of the first period in a list type MPD manifest is invalid.",
                        'case8': "The player should attempt to download the manifest four times before failing."
                    };
                    if (behaviors[caseId]) {
                        behavior.innerText = behaviors[caseId];
                    }

Comment on lines +189 to +190
var video = document.getElementById('video-element');
var alternativeVideo = document.getElementById('alternative-video-element');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using const instead of var for variables that are not reassigned. This is a modern JavaScript best practice that improves code clarity and prevents accidental reassignment.

Suggested change
var video = document.getElementById('video-element');
var alternativeVideo = document.getElementById('alternative-video-element');
const video = document.getElementById('video-element');
const alternativeVideo = document.getElementById('alternative-video-element');

});

// Add response interceptor to modify manifest dynamically
addManifestResponseInterceptor(manifestUrl);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The manifestUrl parameter is passed to addManifestResponseInterceptor, but the function is defined without any parameters and does not use it. Please remove the unused parameter.

Suggested change
addManifestResponseInterceptor(manifestUrl);
addManifestResponseInterceptor();


// Replace
this.returnOffset = NaN;
this.returnOffset = NaN;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line is a duplicate of the line above. Please remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants