From 2ade04273717807096a07b6eb132b7677917392d Mon Sep 17 00:00:00 2001 From: RblSb Date: Sat, 29 Feb 2020 14:01:12 +0300 Subject: Get youtube video title/duration with api --- src/client/Player.hx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/client/Player.hx') diff --git a/src/client/Player.hx b/src/client/Player.hx index 7bd2f4e..4327e6c 100644 --- a/src/client/Player.hx +++ b/src/client/Player.hx @@ -5,6 +5,7 @@ import js.Browser.document; import client.Main.ge; import client.players.Raw; import client.players.Youtube; +import Types.VideoData; import Types.VideoItem; using StringTools; @@ -80,11 +81,12 @@ class Player { this.player = player; } - public function getRemoteDuration(url:String, callback:(duration:Float)->Void):Void { + public function getVideoData(url:String, callback:(data:VideoData)->Void):Void { + // TODO P2 reuse player objects if (Youtube.isYoutube(url)) { - new Youtube(main, this).getRemoteDuration(url, callback); + new Youtube(main, this).getVideoData(url, callback); } else { - new Raw(main, this).getRemoteDuration(url, callback); + new Raw(main, this).getVideoData(url, callback); } } -- cgit v1.2.3