From 5d2375cbb23dbe69a7afe7a691707be48397c6d9 Mon Sep 17 00:00:00 2001 From: RblSb Date: Mon, 29 Apr 2024 07:45:10 +0300 Subject: Video item fixes - Fix youtube fallback, `videoItem.url` is now immutable - JsApi.setVideoSrc now updates to supported player based on `url` arg - Fix auto-pause when video is ended (with `requestLeaderOnPause`) --- src/Types.hx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/Types.hx') diff --git a/src/Types.hx b/src/Types.hx index eeae641..27b2cce 100644 --- a/src/Types.hx +++ b/src/Types.hx @@ -98,14 +98,30 @@ typedef Message = { time:String } +@:using(Types.VideoItemTools) typedef VideoItem = { - url:String, - title:String, - author:String, - duration:Float, - ?subs:String, - isTemp:Bool, - isIframe:Bool + /** Immutable, used as identifier for skipping / removing items **/ + final url:String; + var title:String; + var author:String; + var duration:Float; + var ?subs:String; + var isTemp:Bool; + var isIframe:Bool; +} + +private class VideoItemTools { + public static function withUrl(item:VideoItem, url:String):VideoItem { + return { + url: url, + title: item.title, + author: item.author, + duration: item.duration, + subs: item.subs, + isTemp: item.isTemp, + isIframe: item.isIframe + }; + } } typedef FlashbackItem = { -- cgit v1.2.3