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

Add support to play generic iframe video #862

Merged
merged 1 commit into from
Sep 11, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unpublished Changes
* Add support to play generic iframe video

## 1.66.0 09-03-2024
* Update Connatix script tag to use pmcCnx
Expand Down
2 changes: 1 addition & 1 deletion packages/larva-js/build/video-showcase.js

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'href',
];

/**

Check warning on line 51 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* State.
*
* @type {Object}
Expand All @@ -64,7 +64,7 @@
videoType: '',
};

/**

Check warning on line 67 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* Player UI.
*
* Note: the title and dek are using class selectors so they can be added to existing patterns.
Expand Down Expand Up @@ -121,7 +121,7 @@
}
}

/**

Check warning on line 124 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* Get Player Card Data.
*
* Set up a scaffold object that contains data from the trigger that will be applied
Expand Down Expand Up @@ -163,7 +163,7 @@
};
}

/**

Check warning on line 166 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* Update Player Card Data.
*
* Apply the assembled data to the UI.
Expand Down Expand Up @@ -230,9 +230,10 @@
return `https://player.twitch.tv/?video=${ id }`;
}

if ( 'connatix' === type ) {
if ( 'connatix' === type || 'iframe' === type ) {
return id;
}

}

/**
Expand Down Expand Up @@ -283,7 +284,17 @@
);
}

/**
* Remove hidden attribute from the iframe and set the src.
*
* @param {string} IframeUrl - Iframe embed URL from returnUrl.
*/
playIframeUrl( IframeUrl ) {
this.playerUI.iframe.removeAttribute( 'hidden' );
this.playerUI.iframe.setAttribute( 'src', IframeUrl );
}

/**

Check warning on line 297 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* Remove hidden attribute from jwplayerContainer and play the video with the jwplayer API.
* Note that `playlist` refers to a JWPlayer media object where the videos are handled within
* JWPlayer not the playlist taxonomy in WordPress.
Expand All @@ -309,7 +320,7 @@
}
}

/**

Check warning on line 323 in packages/larva-js/src/interface/VideoShowcase/VideoShowcase.js

View workflow job for this annotation

GitHub Actions / Test and Lint (18.x)

Expected JSDoc block lines to be aligned
* Trigger Click Handler.
*
* Reset player from previous state, update state and player UI, play the video.
Expand Down Expand Up @@ -366,6 +377,10 @@
const playerId = this.playerUI.player.dataset.videoPlayerId;
this.playConnatix( url, playerId );
}

if ( 'iframe' === state.videoType ) {
this.playIframeUrl( url );
}
}

// Remove any trigger-related data attributes and hide any elements that are not relevant for the player.
Expand Down
Loading