Skip to content

Commit

Permalink
feat: Add new error code when the streaming is not allowed
Browse files Browse the repository at this point in the history
Maybe related to shaka-project#7960
  • Loading branch information
avelad committed Jan 30, 2025
1 parent e7d428a commit 60a99a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,12 @@ shaka.media.MediaSourceEngine = class {
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.QUOTA_EXCEEDED_ERROR,
contentType));
} else if (!this.isStreamingAllowed()) {
next.p.reject(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.STREAMING_NOT_ALLOWED,
contentType));
} else {
next.p.reject(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
Expand Down
4 changes: 4 additions & 0 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,10 @@ shaka.media.StreamingEngine = class {
mediaState.performingUpdate = false;
this.cancelUpdate_(mediaState);
this.scheduleUpdate_(mediaState, 0);
} else if (error.code == shaka.util.Error.Code.STREAMING_NOT_ALLOWED) {
mediaState.performingUpdate = false;
this.cancelUpdate_(mediaState);
this.scheduleUpdate_(mediaState, 0);
} else if (mediaState.type == ContentType.TEXT &&
this.config_.ignoreTextStreamFailures) {
if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS) {
Expand Down
7 changes: 7 additions & 0 deletions lib/util/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ shaka.util.Error.Code = {
*/
'TRANSMUXING_NO_VIDEO_DATA': 3023,

/**
* A MediaSource operation is not allowed because the streaming is not
* allowed.
* <br> error.data[0] is the type of content which caused the error.
*/
'STREAMING_NOT_ALLOWED': 3024,


/**
* The Player was unable to guess the manifest type based on file extension
Expand Down

0 comments on commit 60a99a6

Please sign in to comment.