Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle live streams #641

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class VideoSource extends BaseSource {
this._chapters = null;
this._type = SOURCE_TYPE.VIDEO;
this.isRawUrl = _isRawUrl;
this.isLiveStream = options.type === 'live';
this._rawTransformation = options.raw_transformation;
this.withCredentials = !!withCredentials;
this.getInitOptions = () => initOptions;
Expand Down Expand Up @@ -172,6 +173,10 @@ class VideoSource extends BaseSource {
return null;
}

if (this.isLiveStream) {
return null;
}

if (!publicId) {
publicId = this.publicId();
options = Object.assign({}, options, DEFAULT_POSTER_PARAMS);
Expand Down Expand Up @@ -222,7 +227,8 @@ class VideoSource extends BaseSource {

if (isAdaptive) {
// Search for streaming_profile anywhere in the transformation
if (!JSON.stringify(opts.transformation || {}).includes('"streaming_profile":')) {
const hasStreamingProfile = JSON.stringify(opts.transformation || {}).includes('"streaming_profile":');
if (!hasStreamingProfile && !this.isLiveStream) {
opts.transformation = mergeTransformations(opts.transformation, {
streaming_profile: 'auto'
});
Expand Down
1 change: 1 addition & 0 deletions src/video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class VideoPlayer extends Utils.mixin(Eventable) {
if (
!source ||
source.getType() === SOURCE_TYPE.AUDIO || // Is Audio
source.resourceConfig().type === 'live' || // Is live stream
isRawUrl(source.publicId()) || // Is a raw url
(this.videojs.activePlugins_ && this.videojs.activePlugins_.vr) // It's a VR (i.e. 360)
) {
Expand Down
Loading