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

JW Player #433

Merged
merged 25 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9ee71da
feat(cxl-ui): cxl-jw-player rename jw player component
saas786 Dec 1, 2022
c83003c
feat(cxl-ui): cxl-jw-player add styles directory
anoblet Feb 20, 2023
b14bfcd
feat(cxl-ui): cxl-jw-player rename playerId, playerSource to libraryI…
anoblet Feb 20, 2023
27b4a22
feat(cxl-ui): cxl-jw-player add ability to save playlist index
anoblet Mar 7, 2023
ab8abe3
feat(cxl-ui): cxl-jw-player add nextupoffset attribute
anoblet Mar 7, 2023
702065a
feat(cxl-ui): cxl-jw-player add separate mobile CTA
anoblet Mar 7, 2023
2a873b4
feat(cxl-ui): cxl-jw-player refactor base url
anoblet Sep 23, 2024
b72df62
feat(cxl-ui): cxl-jw-player remove jw player link
anoblet Sep 25, 2024
9e0a30c
feat(cxl-ui): cxl-jw-player update player styles
anoblet Sep 28, 2024
69f5778
feat(cxl-ui): cxl-jw-player improve support for source url
anoblet Sep 28, 2024
88913ef
feat(cxl-ui): cxl-jw-player remove support for plugins
anoblet Sep 28, 2024
1ab4e12
feat(cxl-ui): cxl-jw-player update player styles
anoblet Sep 28, 2024
5bc46c2
feat(cxl-ui): cxl-jw-player update search result count styles
anoblet Sep 30, 2024
9e4fbd9
fix(cxl-ui): cxl-jw-player scroll only the captions container
anoblet Sep 30, 2024
f770f6c
feat(cxl-ui): cxl-jw-player add error handling
anoblet Sep 30, 2024
a4ae583
fix(cxl-ui): cxl-jw-player reset play position on video complete
anoblet Oct 1, 2024
036bd53
feat(cxl-ui): cxl-jw-player update result count styles
anoblet Oct 1, 2024
6d3c79f
feat(cxl-ui): cxl-jw-player transcript scroll to next result when pre…
anoblet Oct 2, 2024
9df9201
feat(cxl-ui): cxl-jw-player transcript remove empty tracks
anoblet Oct 2, 2024
5639cbf
feat(cxl-ui): cxl-jw-player add margin to the bottom of the captions
anoblet Oct 3, 2024
e179515
fix(cxl-ui): cxl-jw-player setup crashes when transcripts aren't turn…
anoblet Oct 3, 2024
464df2f
feat(cxl-ui): cxl-jw-player transcript only highlight active search r…
anoblet Oct 3, 2024
73371c3
fix(cxl-ui): cxl-jw-player toggle captions not properly working
anoblet Oct 4, 2024
dadc6bb
fix(cxl-ui): cxl-course-dialog remove import of cxl-jw-player
anoblet Oct 4, 2024
da3dd1f
refactor(cxl-ui): cxl-jw-player modify transcript search highlight co…
pawelkmpt Oct 7, 2024
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
2 changes: 2 additions & 0 deletions packages/cxl-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"@vaadin/tooltip": "^23.3.7",
"@vaadin/vaadin-themable-mixin": "^23.3.7",
"cross-env": "~7.0.2",
"crypto-js": "^4.1.1",
"headroom.js": "^0.12.0",
"imports-loader": "^2.0.0",
"jose": "^4.13.1",
"laravel-mix": "^6.0.39",
"lit": "^2.2.5",
"lodash-es": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "~@conversionxl/cxl-lumo-styles/scss/mixins";
@use '~@conversionxl/cxl-lumo-styles/scss/mixins';

:host {
box-sizing: border-box;
Expand All @@ -8,8 +8,11 @@
}
}

:host([captions]) #container {
grid-template-rows: 1fr max-content 1fr;
:host([captions]) {
#container {
display: grid;
grid-template-rows: 1fr max-content 1fr;
}
}

.captions {
Expand Down Expand Up @@ -39,6 +42,10 @@
justify-content: center;
}

.cxl-jw-player-container {
height: 100%;
}

.flex {
display: flex;
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host(:not([hidden])) {
display: block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
background: var(--lumo-shade);
gap: var(--lumo-space-s);

&[hidden] {
display: none;
}

.close {
font-size: var(--lumo-font-size-xs);
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cxl-jw-player {
&[wide] {
.jw-nextup-cta-mobile {
display: none;
}
}

&:not([wide]) {
.jw-nextup-cta {
display: none;
}
}

.jw-nextup-container {
display: flex;
flex-direction: column;
align-items: flex-end;

.jw-nextup-cta,
.jw-nextup-cta-mobile {
a {
pointer-events: all;
}
}

.jw-nextup-cta {
max-width: 400px;
width: 64%;

vaadin-button {
width: 100%;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host(:not([hidden])) {
display: block;
}
25 changes: 25 additions & 0 deletions packages/cxl-ui/scss/global/cxl-jw-player/cxl-jw-player.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cxl-jw-player {
.jw-player-button {
width: 32px;
fill: rgba(255, 255, 255, 0.8);

&:hover {
fill: rgba(255, 255, 255, 1);
}
}

.jw-related-item {
height: 100% !important; /* stylelint-disable-line declaration-no-important */
}

.jwplayer:not(.jw-flag-small-player) .jw-related-item-next-up {
.jw-related-item-poster {
height: 100%;
}

.jw-related-item-title {
position: absolute;
bottom: 0;
}
}
}
6 changes: 3 additions & 3 deletions packages/cxl-ui/src/components/cxl-course-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import '@vaadin/button';
import '@vaadin/dialog';
import './cxl-time.js';
import './jw-player/index.js';
import './cxl-jw-player/index.js';
import { dialogFooterRenderer, dialogRenderer } from '@vaadin/dialog/lit.js';
import cxlCourseDialogGlobalStyles from '../styles/global/cxl-course-dialog-css.js';

Expand Down Expand Up @@ -64,14 +64,14 @@ export class CXLCourseDialogElement extends LitElement {
</div>
<section>
${this.video
? html` <jw-player
? html` <cxl-jw-player
?captions=${this.video.captions}
media-id=${this.video.mediaId}
minimum-search-length=${this.video.minimumSearchLength}
player-id=${this.video.playerId}
playlist-id=${this.video.playlistId}
plugin-path="${this.video.pluginPath}"
></jw-player>`
></cxl-jw-player>`
: ''}
<div class="content">
<p>${this.course.description}</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# JW Player
# CXL JW Player

## Usage

```
<jw-player
<cxl-jw-player
is-public
captions
media-id="fZ0XiGdb"
minimum-search-length="3"
player-id="5CFJNXKb"
library-id="5CFJNXKb"
plugin-path="https://cxl.com/institute/wp-content/plugins/cxl-jwplayer/"
></jw-player>
></cxl-jw-player>
```

## Features:
Expand Down Expand Up @@ -61,13 +62,13 @@ Order is important as each mixin extends the previous one. In this case, `MixinT

There are currently two methods which are important to the lifecycle of the component:

`__setup()`
`_setup()`

This method is async and called when the component is first created. You must call `await super.__setup()` at the beginning of this method to make sure each parent class's setup method is called.
This method is async and called when the component is first created. You must call `await super._setup()` at the beginning of this method to make sure each parent class's setup method is called.

`__onTimeListener()`
`_onTimeListener()`

This method is async and called when the player's time changes. As with `__setup()`, you must call `await super.__onTimeListener()` at the beginning of this method.
This method is async and called when the player's time changes. As with `_setup()`, you must call `await super._onTimeListener()` at the beginning of this method.

Current mixins available for use:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import style from '../../../styles/global/cxl-jw-player/cxl-jw-player-transcript-css';
import shadowStyle from '../../../styles/cxl-jw-player/cxl-jw-player-transcript-shadow-css';

@customElement('cxl-jw-player-transcript')
export class CXLJWPlayerTranscriptElement extends LitElement {
static get styles() {
return [shadowStyle];
}

render() {
return html`<slot></slot>`;
}

async _setup() {
await super._setup();

this._addStyle(style);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ export const template = function () {
? html`
<div class="center gap search padding">
<vaadin-text-field
@input=${this.__debouncedSearch}
@input=${this._debouncedSearch}
clear-button-visible
id="search"
placeholder="Type and press enter to search"
theme="small"
>
<vaadin-icon slot="prefix" icon="lumo:search"></vaadin-icon>
</vaadin-text-field>
${this.__isSearchMinimumLength
? html`<span>(${this.__matches} matches)</span>`
${this._isSearchMinimumLength
? html`<span>(${this._matches} matches)</span>`
: nothing}
<vaadin-checkbox
@change=${this.__toggleShouldScroll}
?checked=${this.__shouldScroll}
@change=${this._toggleShouldScroll}
?checked=${this._shouldScroll}
label="Scroll"
></vaadin-checkbox>
</div>
<div class="captions padding scroll">
${this.__tracks.map(
${this._tracks.map(
(track, index) =>
html`${track.isChapter
? html`<h2 @click=${this.__onCaptionClick} data-index=${index}>
? html`<h2 @click=${this._onCaptionClick} data-index=${index}>
${track.data.text}
</h2>`
: html`
<span
@click=${this.__onCaptionClick}
?active=${this.__currentTrack === index}
@click=${this._onCaptionClick}
?active=${this._currentTrack === index}
data-index=${index}
>
${track.data.text}
Expand Down
49 changes: 49 additions & 0 deletions packages/cxl-ui/src/components/cxl-jw-player/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import style from '../../styles/global/cxl-jw-player/cxl-jw-player-css';
import shadowStyle from '../../styles/cxl-jw-player/cxl-jw-player-shadow-css';
import { template } from './index.html';
import {
BaseMixin,
ChapterNavigationMixin,
NextUpMixin,
StateMixin,
TranscriptMixin,
} from './mixins';
import { mixin } from './utility';

@customElement('cxl-jw-player')
export class CXLJWPlayerElement extends mixin(LitElement, [
BaseMixin,
TranscriptMixin,
ChapterNavigationMixin,
NextUpMixin,
StateMixin,
]) {
config = {
height: '100%',
width: '100%',
playbackRateControls: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],
plugins: {
// 'http://192.168.0.101:8080/telemetry-8.20.0.js': {},
},
skin: {
name: 'cxl-institute',
},
stretching: 'uniform',
};

static get styles() {
return [shadowStyle];
}

render() {
return template.bind(this)();
}

async _setup() {
await super._setup();

this._addStyle(style);
}
}
Loading
Loading