Skip to content

Commit

Permalink
Merge pull request #178 from bitmovin/feature/fix-load-error-promise-…
Browse files Browse the repository at this point in the history
…rejection-reason

Fix load error promise rejection reason
  • Loading branch information
dweinber authored Oct 3, 2024
2 parents d467053 + 1d01d4b commit c0ef5ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- Yospace error on source load and session initialization not returned in `load` promise rejection as reason

## [2.7.0] - 2024-09-27

### Added
Expand Down
13 changes: 8 additions & 5 deletions src/ts/InternalBitmovinYospacePlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
TimedMetadata,
UNKNOWN_FORMAT,
YoLog,
DebugFlags,
} from '@yospace/admanagement-sdk';

import type {
Expand Down Expand Up @@ -195,8 +196,9 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
return new Promise<void>((resolve, reject) => {
if (!source.hls && !source.dash) {
this.resetState();
this.handleYospaceError(new YospacePlayerError(YospaceErrorCode.SUPPORTED_SOURCE_MISSING));
reject();
const yospaceError = new YospacePlayerError(YospaceErrorCode.SUPPORTED_SOURCE_MISSING);
this.handleYospaceError(yospaceError);
reject(yospaceError);
return;
}
this.resetState();
Expand Down Expand Up @@ -285,16 +287,17 @@ export class InternalBitmovinYospacePlayer implements BitmovinYospacePlayerAPI {
session.shutdown();
this.session = null;

this.handleYospaceError(getYospaceError());
reject();
const yospaceError = getYospaceError();
this.handleYospaceError(yospaceError);
reject(yospaceError);
}
};

const properties = new SessionProperties();
properties.setUserAgent(navigator.userAgent);

if (this.yospaceConfig.debug || this.yospaceConfig.debugYospaceSdk) {
YoLog.setDebugFlags(DEBUG_ALL);
YoLog.setDebugFlags(DebugFlags.DEBUG_ALL);
}

switch (source.assetType) {
Expand Down

0 comments on commit c0ef5ad

Please sign in to comment.