diff --git a/src/csui/PlayerUiComponent.vue b/src/csui/PlayerUiComponent.vue
index fb8cd42..e4bb051 100644
--- a/src/csui/PlayerUiComponent.vue
+++ b/src/csui/PlayerUiComponent.vue
@@ -9,7 +9,7 @@
Video options
-
+
@@ -96,6 +97,9 @@ export default {
// 'page',
// this.frame
// );
+ },
+ testAction() {
+ window.ultrawidify.videos[0].setAr({type: AspectRatio.FitWidth});
}
}
}
diff --git a/src/ext/lib/UWGlobals.js b/src/ext/lib/UWGlobals.js
new file mode 100644
index 0000000..213fa80
--- /dev/null
+++ b/src/ext/lib/UWGlobals.js
@@ -0,0 +1,33 @@
+export default class UWGlobals {
+ constructor() {
+ this.videos = [];
+ }
+
+ getNewVideoID() {
+ let random;
+
+ while (true) {
+ // 4-digit [a-z0-9] string. Should be unique per page on first try
+ random = (Math.random() * 1679616).toFixed().toString(36);
+
+ if (this.videos.findIndex(x => x.vdid === random) === -1) {
+ return random;
+ }
+ }
+ }
+
+ addVideo(video) {
+ // get video ID
+ const id = this.getNewVideoID();
+ video.vdid = id;
+ this.videos.push(video);
+ }
+
+ getVideo(id) {
+ return this.videos.find(x => x.vdid === id);
+ }
+
+ destroy() {
+ // todo: implement
+ }
+}
diff --git a/src/ext/lib/uwui/PlayerUI.js b/src/ext/lib/uwui/PlayerUI.js
index d9a64bb..640bb6f 100644
--- a/src/ext/lib/uwui/PlayerUI.js
+++ b/src/ext/lib/uwui/PlayerUI.js
@@ -30,7 +30,6 @@ class PlayerUi extends UI {
this.settings = settings;
}
-
//#region constructor helpers
// we will move some things out of the constructor in order to keep things clean
static getStoreConfig() {
diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js
index f0bb109..c9a0751 100644
--- a/src/ext/lib/video-data/PlayerData.js
+++ b/src/ext/lib/video-data/PlayerData.js
@@ -47,6 +47,7 @@ class PlayerData {
this.element = this.getPlayer();
this.notificationService = new PlayerNotificationUi(this.element, this.settings);
+
this.ui = new PlayerUi(this.element, this.settings);
this.dimensions = undefined;
this.overlayNode = undefined;
diff --git a/src/ext/lib/video-data/VideoData.js b/src/ext/lib/video-data/VideoData.js
index 8f7d727..301db80 100644
--- a/src/ext/lib/video-data/VideoData.js
+++ b/src/ext/lib/video-data/VideoData.js
@@ -8,7 +8,8 @@ class VideoData {
constructor(video, settings, pageInfo){
- this.vdid = (Math.random()*100).toFixed();
+ window.ultrawidify.addVideo(this);
+
this.logger = pageInfo.logger;
this.arSetupComplete = false;
this.video = video;
@@ -91,6 +92,7 @@ class VideoData {
}
//#endregion
+
//#region lifecycle-ish
/**
* Injects base CSS and sets up handlers for