diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ea7d1a7..b0cba589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- added mode argument to getCurrentTime to enable fetching absolute time +- added mode argument to getDuration to enable fetching absolute duration + ## 2.3.1 - 2024-02-14 ### Removed @@ -47,7 +52,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 @@ -121,7 +127,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 @@ -145,13 +152,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 @@ -259,7 +270,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 @@ -283,7 +295,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. @@ -297,7 +310,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 diff --git a/src/ts/BitmovinYospacePlayer.ts b/src/ts/BitmovinYospacePlayer.ts index 586fae10..b40a848b 100644 --- a/src/ts/BitmovinYospacePlayer.ts +++ b/src/ts/BitmovinYospacePlayer.ts @@ -24,6 +24,7 @@ import { SupportedTechnologyMode, Technology, Thumbnail, + TimeMode, TimeRange, VideoQuality, ViewMode, @@ -335,16 +336,8 @@ export class BitmovinYospacePlayer implements BitmovinYospacePlayerAPI { return this.player.getContainer(); } - getCurrentTime(): number { - return this.player.getCurrentTime(); - } - - getCurrentAdBreakDuration(): number { - return this.player.getCurrentAdBreakDuration(); - } - - getCurrentTimeWithAds(): number { - return this.player.getCurrentTimeWithAds(); + getCurrentTime(mode?: TimeMode): number { + return this.player.getCurrentTime(mode); } getDownloadedAudioData(): DownloadedAudioData { @@ -359,8 +352,8 @@ 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 { diff --git a/src/ts/BitmovinYospacePlayerAPI.ts b/src/ts/BitmovinYospacePlayerAPI.ts index 0e4f99c4..d6ab05b8 100644 --- a/src/ts/BitmovinYospacePlayerAPI.ts +++ b/src/ts/BitmovinYospacePlayerAPI.ts @@ -8,6 +8,7 @@ import { PlayerExports, SourceConfig, } from 'bitmovin-player'; +import { TimeMode } from 'bitmovin-player/modules/bitmovinplayer-core'; // Enums @@ -49,11 +50,9 @@ export interface BitmovinYospacePlayerAPI extends PlayerAPI { getCurrentPlayerType(): YospacePlayerType; - getCurrentAdBreakDuration(): number; + getCurrentTime(mode?: TimeMode): number; - getCurrentTimeWithAds(): number; - - getDurationWithAds(): number; + getDuration(mode?: TimeMode): number; forceSeek(time: number, issuer?: string): boolean; } diff --git a/src/ts/InternalBitmovinYospacePlayer.ts b/src/ts/InternalBitmovinYospacePlayer.ts index 8e1905bb..05fbe203 100644 --- a/src/ts/InternalBitmovinYospacePlayer.ts +++ b/src/ts/InternalBitmovinYospacePlayer.ts @@ -36,6 +36,7 @@ import { SeekEvent, SourceConfig, TimeChangedEvent, + TimeMode, TimeRange, UserInteractionEvent, } from 'bitmovin-player/modules/bitmovinplayer-core'; @@ -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(); @@ -416,13 +421,13 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI { return this.toMagicTime(this.player.getCurrentTime()); } - getCurrentTimeWithAds(): number { - return 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(); } @@ -436,18 +441,6 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI { ); } - getCurrentAdBreakDuration(): number { - if (this.isAdActive()) { - return this.getAdBreakDuration(this.getCurrentAdBreak()); - } - - return 0; - } - - getDurationWithAds(): number { - return this.player.getDuration(); - } - /** * @deprecated Use {@link PlayerBufferAPI.getLevel} instead. */ @@ -787,10 +780,6 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI { return toSeconds(ad.getDuration()); } - private getAdBreakDuration(adbreak: AdBreak): number { - return toSeconds(adbreak.getDuration()); - } - private getAdStartTime(ad: Advert): number { if (this.isLive()) { return this.adStartedTimestamp || 0;