Skip to content

Commit cf513fa

Browse files
committed
Swap MediaPlayerIndex to composables and drop the Vuex store
MediaPlayerIndex now delegates to VideoPlayer or AudioPlayer and drives state through the media composables instead of the Vuex module. Remove the store module and its injection in videojsVueMixin, and rewire the captions, languages, fullscreen, and transcript views onto the composable API.
1 parent db78d2f commit cf513fa

16 files changed

Lines changed: 116 additions & 1501 deletions

File tree

kolibri/plugins/media_player/frontend/mixins/videojsVueMixin.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Vue from 'vue';
2-
import store from 'kolibri/store';
32
import videojs from 'video.js';
43

54
/**
@@ -16,7 +15,11 @@ export default function videojsVueMixin(videojsComponent, vueComponent) {
1615
/**
1716
* This is called by video.js code that usually constructs an element, but here we'll leverage
1817
* vue by calling it manually.
19-
* @returns {Element} Root DOM element from the mounted Vue component
18+
*
19+
* Note: This is called FROM WITHIN the video.js Component constructor, so we must
20+
* access vueParent from this.options_ (set by video.js) not from a property we try
21+
* to set in our own constructor (which hasn't run yet).
22+
* @returns {Element} Root element of the mounted Vue component
2023
*/
2124
createEl() {
2225
return this.createVueComponent().$el;
@@ -29,7 +32,16 @@ export default function videojsVueMixin(videojsComponent, vueComponent) {
2932
*/
3033
createVueComponent(options) {
3134
this.clearVueComponent();
32-
this._vueComponent = new VueComponent(Object.assign({ store }, options)).$mount();
35+
36+
// Access vueParent from this.options_ which video.js sets up in its constructor
37+
const vueParent = this.options_.vueParent;
38+
39+
const vueOptions = {
40+
parent: vueParent,
41+
...options,
42+
};
43+
44+
this._vueComponent = new VueComponent(vueOptions).$mount();
3345
return this.getVueComponent();
3446
}
3547

kolibri/plugins/media_player/frontend/module.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
import store from 'kolibri/store';
21
import ContentViewerModule from 'kolibri-viewer';
32
import MediaPlayerComponent from './views/MediaPlayerIndex';
4-
import storeModule from './modules';
53

64
class MediaPlayerModule extends ContentViewerModule {
75
get viewerComponent() {
86
return MediaPlayerComponent;
97
}
10-
11-
get store() {
12-
return store;
13-
}
14-
15-
ready() {
16-
this.store.registerModule('mediaPlayer', storeModule);
17-
}
188
}
199

2010
const mediaPlayerModule = new MediaPlayerModule();

kolibri/plugins/media_player/frontend/modules/captions/index.js

Lines changed: 0 additions & 298 deletions
This file was deleted.

0 commit comments

Comments
 (0)