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

Extend API #170

Merged
merged 8 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 21 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Event loop on pre-roll ad end

### Added

- `mode` argument to `getCurrentTime` to enable fetching absolute time including ad durations
- `mode` argument to `getDuration` to enable fetching absolute duration including ad durations

## 2.3.1 - 2024-02-14

### Removed
Expand Down Expand Up @@ -51,7 +56,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `shownToUser` method to Companion Ads, which should be fired when the ad is shown to the user
- `hiddenFromUser` method to Companion Ads, which should be fired when the ad is hidden from the user
- `UNKNOWN_FORMAT` error (code `1011`)
- `YospaceConfiguration.debugYospaceSdk` to enable debug logs of the Yospace SDK without enabling logs for the `BitmovinYospacePlayer` (helpful for Yospace validation)
- `YospaceConfiguration.debugYospaceSdk` to enable debug logs of the Yospace SDK without enabling logs for
the `BitmovinYospacePlayer` (helpful for Yospace validation)
- Support for tracking muted/unmuted changes

### Changed
Expand Down Expand Up @@ -125,7 +131,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Use standalone Bitmovin Analytics Adapter for flexibility. And move initialization to `load()` to dynamically attach to the correct player based on source.
- Use standalone Bitmovin Analytics Adapter for flexibility. And move initialization to `load()` to dynamically attach
to the correct player based on source.
- Note: This change required updating to TypeScript version 3.

## 1.2.20-2 - 2021-07-28
Expand All @@ -149,13 +156,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Remove the [arrayAccessForm](https://github.com/x2js/x2js/blob/development/x2js.d.ts#L116), config option from `X2JS` initialization for parsing VAST Extensions. This was causing unpredictable arrays for the `Extension.CreativeParameters` property. Without the option, it consistently returns an object when there is only one `CreativeParameter` property.
- Remove the [arrayAccessForm](https://github.com/x2js/x2js/blob/development/x2js.d.ts#L116), config option from `X2JS`
initialization for parsing VAST Extensions. This was causing unpredictable arrays for
the `Extension.CreativeParameters` property. Without the option, it consistently returns an object when there is only
one `CreativeParameter` property.

## 1.2.19 - 2021-01-20

### Fixed

- Added a temporary fix for a bug on Safari mobile that results in duplicate ad events from Yospace, as a result of incorrect Position updates reported to the YS SDK.
- Added a temporary fix for a bug on Safari mobile that results in duplicate ad events from Yospace, as a result of
incorrect Position updates reported to the YS SDK.

### Added

Expand Down Expand Up @@ -263,7 +274,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- When the `disableServiceWorker` flag is set to true, don't make calls to `navigator.serviceWorker.getRegistrations()`. This was causing issues on Tizen devices.
- When the `disableServiceWorker` flag is set to true, don't make calls to `navigator.serviceWorker.getRegistrations()`.
This was causing issues on Tizen devices.

## 1.2.5 - 2020-04-15

Expand All @@ -287,7 +299,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Fire `TruexAdFree` in the `adBreakFinished` listener instead of `adFinished`, as the stream isn't fully reloaded for seeking after `adFinished`
- Fire `TruexAdFree` in the `adBreakFinished` listener instead of `adFinished`, as the stream isn't fully reloaded for
seeking after `adFinished`
- Update Bitmovin Web SDK to 08.31.0
- `player.isLive()` returns false when in a VPAID, so store `isLiveStream` in a variable upon playing the stream.

Expand All @@ -301,7 +314,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- Always fire the `TrueXAdFree` event
- Reduce the replaceContentDuration by 2 seconds in order to allow the player to properly skip the VPAID / TrueX ad if needed
- Reduce the replaceContentDuration by 2 seconds in order to allow the player to properly skip the VPAID / TrueX ad if
needed
- Updated Bitmovin Web SDK to 8.30.0
- Fire a new `TruexAdBreakFinished` event

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"license": "MIT",
"dependencies": {
"@yospace/admanagement-sdk": "3.6.0",
"bitmovin-player": "^8.114.0",
"bitmovin-player": "^8.157.0",
"fast-safe-stringify": "^2.0.7",
"process": "^0.11.10",
"stream-browserify": "^3.0.0"
Expand Down
14 changes: 10 additions & 4 deletions src/ts/BitmovinYospacePlayer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
AdaptationAPI,
AudioQuality,
AudioTrack,
DownloadedAudioData,
Expand All @@ -23,6 +24,7 @@ import {
SupportedTechnologyMode,
Technology,
Thumbnail,
TimeMode,
TimeRange,
VideoQuality,
ViewMode,
Expand Down Expand Up @@ -334,8 +336,8 @@ export class BitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
return this.player.getContainer();
}

getCurrentTime(): number {
return this.player.getCurrentTime();
getCurrentTime(mode?: TimeMode): number {
return this.player.getCurrentTime(mode);
}

getDownloadedAudioData(): DownloadedAudioData {
Expand All @@ -350,8 +352,12 @@ export class BitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
return this.player.getDroppedVideoFrames();
}

getDuration(): number {
return this.player.getDuration();
getDuration(mode?: TimeMode): number {
return this.player.getDuration(mode);
}

get adaptation(): AdaptationAPI {
return this.player.adaptation;
}

getManifest(): string {
Expand Down
19 changes: 19 additions & 0 deletions src/ts/BitmovinYospacePlayerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
PlayerExports,
SourceConfig,
} from 'bitmovin-player';
import { TimeMode } from 'bitmovin-player/modules/bitmovinplayer-core';

// Enums

Expand Down Expand Up @@ -49,6 +50,24 @@ export interface BitmovinYospacePlayerAPI extends PlayerAPI {

getCurrentPlayerType(): YospacePlayerType;

/*
* By default, the method returns the current content position, discarding stitched ad durations. If an ad
* is playing, the position inside of the ad will instead be returned.
*
* if TimeMode.AbsoluteTime is provided as an argument to the method, it will instead always return the current time
* including stitched ad durations.
*/
getCurrentTime(mode?: TimeMode): number;

/*
* By default, the method returns the current content duration, discarding stitched ad durations. If an ad
* is playing, the duration of the ad will instead be returned.
*
* if TimeMode.AbsoluteTime is provided as an argument to the method, it will instead always return the duration
* including stitched ad durations.
*/
getDuration(mode?: TimeMode): number;

forceSeek(time: number, issuer?: string): boolean;
}

Expand Down
13 changes: 11 additions & 2 deletions src/ts/InternalBitmovinYospacePlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
SeekEvent,
SourceConfig,
TimeChangedEvent,
TimeMode,
TimeRange,
UserInteractionEvent,
} from 'bitmovin-player/modules/bitmovinplayer-core';
Expand Down Expand Up @@ -406,7 +407,11 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
return this.player.seek(magicSeekTarget, issuer);
}

getCurrentTime(): number {
getCurrentTime(mode?: TimeMode): number {
if (mode === TimeMode.AbsoluteTime) {
return this.player.getCurrentTime();
}

if (this.isAdActive()) {
// return currentTime in AdBreak
const currentAdPosition = this.player.getCurrentTime();
Expand All @@ -416,9 +421,13 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
return this.toMagicTime(this.player.getCurrentTime());
}

getDuration(): number {
getDuration(mode?: TimeMode): number {
if (!this.session) return 0;

if (mode === TimeMode.AbsoluteTime) {
return this.player.getDuration();
}

if (this.isAdActive()) {
return this.getCurrentAdDuration();
}
Expand Down
Loading