-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ygoto3/dashjs-sd-sustainable-binder
feat: Add dashjs-sd-sustainable-binder package
- Loading branch information
Showing
22 changed files
with
20,877 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type AdPod from './AdPod'; | ||
|
||
export default class AdBreak { | ||
|
||
constructor(offsetTime: number, id?: string, adPod?: AdPod) { | ||
this.offsetTime = offsetTime; | ||
this.id = id; | ||
this.adPod = adPod; | ||
} | ||
|
||
readonly offsetTime: number; | ||
readonly id?: string; | ||
readonly adPod?: AdPod; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Yusuke Goto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @ygoto3/omap-dashjs-sd-binder | ||
|
||
## Overview | ||
|
||
An OMAP binder implementation to bind [dash.js](https://github.com/Dash-Industry-Forum/dash.js) to an OMAP client. This binder is implemented to extend [@ygoto3/omap-dashjs-sd-binder](https://github.com/ygoto3/omap/tree/main/packages/dashjs-sd-binder) in order to playback a video stream in a sustainable way. The binder avoids fetching excessive media data that will be discarded after an ad pod is played, which is what [@ygoto3/omap-dashjs-sd-binder](https://github.com/ygoto3/omap/tree/main/packages/dashjs-sd-binder) does. | ||
|
||
## Documentation | ||
|
||
[API document](https://ygoto3.github.io/omap/modules/dashjs_sd_sustainable_binder_src.html) is available. | ||
|
||
## Getting Started | ||
|
||
To install `@ygoto3/omap-dashjs-sd-sustainable-binder`, run the command below. | ||
|
||
```sh | ||
$ npm install @ygoto3/omap-dashjs-sd-sustainable-binder --save | ||
``` | ||
|
||
Then you can bind any OMAP client to dash.js. | ||
|
||
```ts | ||
import { OmapDashjsSDSustainableBinder } from '@ygoto3/omap-dashjs-sd-sustainable-binder'; | ||
|
||
const player = dashjs.MediaPlayer().create(); | ||
const adDisplayContainer = document.getElementById('ad-display-container') as HTMLDivElement; | ||
const omapClient = new YourOMAPClient(); | ||
const omapBinder = new OmapDashjsSDSustainableBinder(player, adDisplayContainer); | ||
omapBinder.bind(omapClient); | ||
``` | ||
|
||
## trickyMediaPlayerHandler | ||
|
||
You need to use a `trickyMediaPlayerHandler` when you want to seek or to get the duration of the media stream. Binded by OmapDashjsSDSustainableBinder, a dash.js player cannot neither accurately seek nor return the original duration since the OmapDashjsSDSustainableBinder manipulates the manifest in order to avoid downloading media segments that the dash.js player would redundantly download after playing an ad pod. | ||
|
||
```ts | ||
// Instead of dashjs.seek(10); | ||
omapBinder.trickyMediaPlayerHandler.seek(10); | ||
|
||
// Instead of dashjs.duration; | ||
omapBinder.trickyMediaPlayerHandler.duration; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "@ygoto3/omap-dashjs-sd-sustainable-binder", | ||
"version": "0.0.0", | ||
"description": "Open Media Ad Player Dash.js Binder which manipulate the manifest to insert ads", | ||
"main": "./dist/dashjs-sd-sustainable-binder/src/index.js", | ||
"types": "./dist/dashjs-sd-sustainable-binder/src/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/dashjs-sd-sustainable-binder/src/index.d.ts", | ||
"import": "./dist/dashjs-sd-sustainable-binder/src/index.js", | ||
"require": "./dist/dashjs-sd-sustainable-binder/src/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"repository": "https://github.com/ygoto3/omap", | ||
"author": "ygoto3<my.important.apes@gmail.com>", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"test": "uvu -r ts-node/register tests" | ||
}, | ||
"dependencies": { | ||
"@ygoto3/omap-core": "^0.0.1", | ||
"@ygoto3/omap-dashjs-sd-binder": "^0.0.2" | ||
}, | ||
"devDependencies": { | ||
"dashjs": "^4.7.2", | ||
"ts-loader": "^9.5.1", | ||
"typescript": "^5.3.3", | ||
"uvu": "^0.5.6", | ||
"webpack": "^5.65.0", | ||
"webpack-cli": "^4.9.1", | ||
"webpack-merge": "^5.10.0" | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
Oops, something went wrong.