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 Overlay events #31

Open
wants to merge 24 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
21147c7
[WIP] Add video overlay
jmt-qualabs Nov 7, 2024
c791af1
fix styling of overlay video to match video
ronalduQualabs Nov 19, 2024
aae54fb
Add iframe overlay
jmt-qualabs Nov 19, 2024
b3f25f7
Implement earliestResolutionTime
jmt-qualabs Nov 20, 2024
647c4c4
Change overlay tag
jmt-qualabs Nov 21, 2024
f45c568
Remove overlay at end of event duration
jmt-qualabs Nov 21, 2024
962df58
Implement overlay modes and refId
sebastianpiq Nov 21, 2024
35d8d45
Fix seek overlay
sebastianpiq Nov 21, 2024
f76b901
Implement overlay event z attribute
sebastianpiq Nov 22, 2024
477d070
Add OverlayController
jmt-qualabs Nov 25, 2024
4f10a07
Fix overlay loop
jmt-qualabs Nov 25, 2024
9280240
Implement overlay size and topleft
sebastianpiq Nov 25, 2024
f5f04c3
Implement overlay squeeze content
sebastianpiq Nov 25, 2024
905b24f
Use transitions to manage overlays size
sebastianpiq Nov 26, 2024
ed26429
Improve overlay scheduler
sebastianpiq Nov 27, 2024
418c418
Add missing semicolons
sebastianpiq Nov 27, 2024
121cb0a
Remove unused extend mode event id logic
sebastianpiq Nov 27, 2024
734dc38
Add new squeeze current percentage definition
sebastianpiq Nov 27, 2024
1b97763
Add missing semicolons
sebastianpiq Nov 28, 2024
4151332
Improve overlay select mode logic
sebastianpiq Nov 29, 2024
7973882
Implement unit tests
sebastianpiq Dec 2, 2024
2e69c67
Remove unnecessary it only tests
sebastianpiq Dec 2, 2024
b4dfd2a
Add missing semicolons and fix wrong let declarations
sebastianpiq Dec 2, 2024
cccf004
Fix squeeze current bug
sebastianpiq Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dash/constants/DashConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default {
MPD: 'MPD',
ORIGINAL_MPD_ID: 'mpdId',
ORIGINAL_PUBLISH_TIME: 'originalPublishTime',
OVERLAY: 'OverlayEvent',
PATCH_LOCATION: 'PatchLocation',
PERIOD: 'Period',
PRESENTATION_TIME: 'presentationTime',
Expand Down
6 changes: 6 additions & 0 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,12 @@ function DashManifestModel() {
} else {
event.id = null;
}
if (currentMpdEvent.hasOwnProperty(DashConstants.OVERLAY)) {
event.overlay = currentMpdEvent.OverlayEvent;
if (event.overlay.earliestResolutionTime) {
event.calculatedPresentationTime -= event.overlay.earliestResolutionTime / eventStream.timescale;
}
}

if (currentMpdEvent.Signal && currentMpdEvent.Signal.Binary) {
// toString is used to manage both regular and namespaced tags
Expand Down
40 changes: 40 additions & 0 deletions src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import CatchupController from './controllers/CatchupController.js';
import ServiceDescriptionController from '../dash/controllers/ServiceDescriptionController.js';
import ContentSteeringController from '../dash/controllers/ContentSteeringController.js';
import MediaController from './controllers/MediaController.js';
import OverlayController from './controllers/OverlayController.js';
import BaseURLController from './controllers/BaseURLController.js';
import ManifestLoader from './ManifestLoader.js';
import ErrorHandler from './utils/ErrorHandler.js';
Expand Down Expand Up @@ -144,6 +145,7 @@ function MediaPlayer() {
schemeLoaderFactory,
timelineConverter,
mediaController,
overlayController,
protectionController,
metricsReportingController,
mssHandler,
Expand Down Expand Up @@ -257,6 +259,9 @@ function MediaPlayer() {
if (config.mediaController) {
mediaController = config.mediaController;
}
if (config.overlayController) {
overlayController = config.overlayController;
}
if (config.settings) {
settings = config.settings;
}
Expand Down Expand Up @@ -328,6 +333,10 @@ function MediaPlayer() {
mediaController = MediaController(context).getInstance();
}

if (!overlayController) {
overlayController = OverlayController(context).getInstance();
}

if (!streamController) {
streamController = StreamController(context).getInstance();
}
Expand Down Expand Up @@ -413,6 +422,10 @@ function MediaPlayer() {
videoModel
});

overlayController.setConfig({
sebastianpiq marked this conversation as resolved.
Show resolved Hide resolved
videoModel
});

mediaPlayerModel.setConfig({
playbackController,
serviceDescriptionController
Expand Down Expand Up @@ -472,6 +485,9 @@ function MediaPlayer() {
if (customParametersModel) {
customParametersModel.reset();
}
if (overlayController) {
overlayController.reset()
}

settings.reset();

Expand Down Expand Up @@ -1468,6 +1484,16 @@ function MediaPlayer() {
return videoModel ? videoModel.getTTMLRenderingDiv() : null;
}

/**
* Returns instance of Div that was attached by calling attachOverlayRenderingDiv()
* @returns {Object}
* @memberof module:MediaPlayer
* @instance
*/
function getOverlayRenderingDiv() {
return videoModel ? videoModel.getOverlayRenderingDiv() : null;
}

/**
* Use this method to attach an HTML5 div for dash.js to render rich TTML subtitles.
*
Expand All @@ -1490,6 +1516,18 @@ function MediaPlayer() {
videoModel.setVttRenderingDiv(div);
}

function attachOverlayRenderingDiv(overlayDiv) {
const videoElement = videoModel.getElement();
if (!videoElement) {
throw ELEMENT_NOT_ATTACHED_ERROR;
}
N1Knight marked this conversation as resolved.
Show resolved Hide resolved

overlayController.configureVideoElementForOverlay();
videoModel.setOverlayRenderingDiv(overlayDiv);

overlayController.setupOverlayEvents();
}

/*
---------------------------------------------------------------------------

Expand Down Expand Up @@ -2740,6 +2778,7 @@ function MediaPlayer() {
attachProtectionController,
attachSource,
attachTTMLRenderingDiv,
attachOverlayRenderingDiv,
attachView,
attachVttRenderingDiv,
clearDefaultUTCTimingSources,
Expand Down Expand Up @@ -2778,6 +2817,7 @@ function MediaPlayer() {
getSource,
getStreamsFromManifest,
getTTMLRenderingDiv,
getOverlayRenderingDiv,
getTargetLiveDelay,
getTracksFor,
getTracksForTypeFromManifest,
Expand Down
9 changes: 9 additions & 0 deletions src/streaming/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,14 @@ export default {
DTSC: 'dtsc',
AVC: 'avc',
HEVC: 'hevc'
},

OVERLAY: {
SCHEME_ID: 'urn:scte:dash:scte214-events',
START_MODE: 'start',
STOP_MODE: 'stop',
EXTEND_MODE: 'extend',
VIDEO_MIMETYPE: 'video/mp4',
IFRMAE_MIMETYPE: 'text/html'
}
}
Loading
Loading