Skip to content

Commit

Permalink
fix(Player): add a errror message to fix a race condition issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuPOUX committed Sep 25, 2024
1 parent c3bc7ba commit aacdf2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ export class Player extends EventEmitter {
this._connector = new (this.Connector || (params.endPoint.startsWith('http') ? HTTPConnector : WSController))(
params
);

this._connector.log = this.log.bind(this, 'Signaling:') as ILog;
this._connector.onOpen = stream => {
this.onStart(stream);
Expand All @@ -403,7 +402,13 @@ export class Player extends EventEmitter {
// if stream-state was offine on disconnection, shows this error!
this.stop({
type: 'StreamMetadataError',
name: this.streamState,
name: StreamState.OFFLINE,
stream: (params as Connect.Params).streamName
});
} else if (error?.type === 'WebSocketReliableError' && error.name === 'Socket disconnection') {
this.stop({
type: 'StreamMetadataError',
name: 'Resource not available',
stream: (params as Connect.Params).streamName
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/metadata/StreamMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export enum StreamState {

export type StreamMetadataError =
/**
* Represents a Connection error.
* Represents a Stream metadata error.
*/
| { type: 'StreamMetadataError'; name: string; stream: string }
/**
Expand Down

0 comments on commit aacdf2a

Please sign in to comment.