Skip to content

Commit

Permalink
feat(FEC-13652): add meaningful error message
Browse files Browse the repository at this point in the history
  • Loading branch information
lianbenjamin committed Apr 7, 2024
1 parent 57fda2e commit b8ac68e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/cast-player.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import {cast as remote, core} from '@playkit-js/kaltura-player-js';
/** @jsx h */
import {cast as remote, core, ui} from '@playkit-js/kaltura-player-js';
import {CastStateManager} from './cast-state-manager';
import {CastTracksManager} from './cast-tracks-manager';
import {CastPlaybackEngine} from './cast-playback-engine';
Expand All @@ -8,6 +9,11 @@ import {CastLoader} from './cast-loader';
import {CastAdsController} from './cast-ads-controller';
import {CastAdsManager} from './cast-ads-manager';

// eslint-disable-next-line no-unused-vars
const {h} = ui;
// eslint-disable-next-line no-unused-vars
const {Text} = ui.preacti18n;

const {Env, Track, TextStyle, EventType, StateType, FakeEvent, Utils, EngineType, AbrMode, Error} = core;
const {
BaseRemotePlayer,
Expand Down Expand Up @@ -840,8 +846,12 @@ class CastPlayer extends BaseRemotePlayer {

_onLoadMediaFailed(error: Object): void {
CastPlayer._logger.debug('Load media falied', error);
const errorDetails = {
errorTitle: <Text id={'cast.error_title'} />,
errorMessage: <Text id={'cast.error_message'} />
};
this.dispatchEvent(
new FakeEvent(EventType.ERROR, new Error(Error.Severity.CRITICAL, Error.Category.CAST, Error.Code.CAST_LOAD_MEDIA_FAILED, error))
new FakeEvent(EventType.ERROR, new Error(Error.Severity.CRITICAL, Error.Category.CAST, Error.Code.CAST_LOAD_MEDIA_FAILED, error, errorDetails))
);
}

Expand Down
8 changes: 8 additions & 0 deletions translations/en.i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"en": {
"cast_sender": {
"error_title": "Media casting error",
"error_message": "An error occurred while trying to cast, please try again."
}
}
}

0 comments on commit b8ac68e

Please sign in to comment.