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

adding the 'mqdefault' to: <media:thumbnail yt:name= + their url in the api #62

Open
RedFireMRT84 opened this issue Mar 18, 2024 · 20 comments

Comments

@RedFireMRT84
Copy link

hi, i came here to ask, which scripts has the code on where u add the thumbnail types? i wanna add the medium quality [mqdefault] in the api:
<media:thumbnail yt:name='hqdefault' url='http://i.ytimg.com/vi/[]/hqdefault.jpg' height='240' width='320' time='00:00:00'/> // high quality
<media:thumbnail yt:name='mqdefault' url='http://i.ytimg.com/vi/[]/mqdefault.jpg' height='240' width='320' time='00:00:00'/> //medium quality
<media:thumbnail yt:name='poster' url='http://i.ytimg.com/vi/[]/0.jpg' height='240' width='320' time='00:00:00'/> //poster
<media:thumbnail yt:name='default' url='http://i.ytimg.com/vi/[]/0.jpg' height='240' width='320' time='00:00:00'/> //default

@ftde0
Copy link
Owner

ftde0 commented Mar 18, 2024

you're probably looking for gdata_feedVideo in back/yt2009templates.js.
https://github.com/ftde0/yt2009/blob/main/back/yt2009templates.js#L1074

@RedFireMRT84
Copy link
Author

you're probably looking for gdata_feedVideo in back/yt2009templates.js. https://github.com/ftde0/yt2009/blob/main/back/yt2009templates.js#L1074

alright so, im using another apiplayer from 2014, i followed ur tutorial on patching the players. i mean, ?video_id= does actually work on my browser in both watch.swf and apiplayer.swf. but if i go to youtube xl or if u watch my footage here which is another version of leanbacklite, click on a video to watch, the videos dont display

https://cdn.discordapp.com/attachments/1175925849946603550/1220036144360722502/bandicam_2024-03-20_10-46-31-295.mp4?ex=660d7a33&is=65fb0533&hm=58532a6f47228b5884665e70f4dc78d8809f8bd88f6ad9342d318e3194871044&

@ftde0
Copy link
Owner

ftde0 commented Mar 21, 2024

xl looks fine on my end, can you load the player you're trying it on with the network tab (in devtools) on, and show where are get_video and get_video_info requests going? below is how it should look like.
xl-networktab

@RedFireMRT84
Copy link
Author

@ftde0
Copy link
Owner

ftde0 commented Mar 21, 2024

is your yt2009 set up on port 443? if so, the get_video_info requests don't have that port (and will try to use port 80 instead as that's standard for HTTP), indicating you didn't set it in the player.

have you tried XL without modifying the SWFs? i've made a change a bit back where the players should no longer require additional setup. try making a backup of your SWF files from /xl/ and putting the original ones from the repo in.

if that doesn't end up working, just set the port in LIVE_BASE_URL of your apiplayer.

@RedFireMRT84
Copy link
Author

i got the xl to work, but the next one is the leanbacklite swf

bandicam.2024-03-21.10-15-40-625.mp4

if u see me click on a video or me searching, u will see links of the api, player_204 and other links, but the chromeless host class and probably the apiplayer fails to load and play the video.
https://github.com/ftde0/yt2009/assets/126342520/ca5a4776-c1f4-4fea-becb-57edb5826653

bandicam.2024-03-21.10-17-25-139.mp4

So this is how the video list in the leanback lite works here:

class com.google.youtube.tv.tree.GDataNode extends com.google.youtube.tv.tree.ListNode
{
var lastStartIndex;
var startIndex;
var offset;
var sparse;
var pageSize;
var initialNeededLoadMore;
var prefetchedData;
var children;
var customFields;
var xtractor;
var cobj;
var url;

   static var FIELDS_DEFAULT = "title,openSearch:*," + "entry" + "(id,published,title,link,author/name," + "media:group(media:description,media:thumbnail[@yt:name=\'" + com.google.youtube.tv.app.Config.THUMBS_QUALITY + "\'](@url)," + "yt:duration,yt:videoid,media:credit,yt:statistics,yt:rating))";
   static var FIELDS_MINIMAL = "openSearch:totalResults," + "link[@rel=\'next\'](@rel),entry[not(app:control/yt:state)](published," + "title,yt:statistics," + "media:group(media:credit[@role=\'uploader\'](@role,@yt:display)," + "media:thumbnail[@yt:name=\'" + com.google.youtube.tv.app.Config.THUMBS_QUALITY + "\'](@url)," + "yt:duration,yt:uploaded,yt:uploaderId,yt:videoid))";
   static var fields = com.google.youtube.tv.tree.GDataNode.FIELDS_DEFAULT;
   function GDataNode(title, url, loadNow, data, needLoadMore)
   {
      this.lastStartIndex = 0;
      this.startIndex = 0;
      this.offset = 0;
      this.sparse = false;
      this.pageSize = com.google.youtube.tv.app.Config.GDATA_NUM_RESULTS_PER_PAGE;
      this.initialNeededLoadMore = needLoadMore;
      this.needLoadMore = this.initialNeededLoadMore;
      url = this.appendDefaultParamsToUrl(com.google.youtube.tv.util.StringUtil.replacePlaceholders(url));
      super(title,url,loadNow);
      if(data)
      {
         this.prefetchedData = data;
      }
   }
   static function getFields()
   {
      return com.google.youtube.tv.tree.GDataNode.fields;
   }
   static function setFields(value)
   {
      com.google.youtube.tv.tree.GDataNode.fields = value;
   }
   function loadPage(startIndex)
   {
      if(this.loadStarted || !this.needLoadMore)
      {
         return undefined;
      }
      if(startIndex > this.startIndex)
      {
         this.sparse = true;
      }
      var _loc3_ = true;
      var _loc4_ = startIndex;
      while(_loc4_ < startIndex + this.pageSize)
      {
         if(this.children[_loc4_] == null)
         {
            _loc3_ = false;
            break;
         }
         _loc4_ += 1;
      }
      if(_loc3_)
      {
         return undefined;
      }
      this.startIndex = startIndex;
      this.loadMore();
   }
   function appendDefaultParamsToUrl(url)
   {
      var _loc3_ = ["v=2.1","fields=" + (this.customFields || com.google.youtube.tv.tree.GDataNode.getFields())];
      if(com.google.youtube.tv.platform.Box.isSafe())
      {
         _loc3_.push("safeSearch=strict");
      }
      return com.google.youtube.tv.util.StringUtil.addParamsToRequest(url,_loc3_);
   }
   function parse(src)
   {
      if(this.xtractor)
      {
         var _loc3_ = new XML();
         _loc3_.ignoreWhite = true;
         _loc3_.parseXML(src);
         this.cobj = com.google.youtube.tv.util.Xtract.getComplexValues(_loc3_,this.xtractor);
      }
   }
   function addItem(node, preserveParent)
   {
      var _loc4_ = !this.sparse ? this.count : this.lastStartIndex + this.offset++;
      this.setItemAt(node,_loc4_,preserveParent);
   }
   function removeItem(node)
   {
      super.removeItem(node);
   }
   function setItemAt(node, index, preserveParent)
   {
      if(!preserveParent)
      {
         node.parent = this;
      }
      node.index = index;
      this.children[index] = node;
      if(this.count == index)
      {
         this.count += 1;
      }
   }
   function createDataFetcher()
   {
      if(com.google.youtube.tv.services.StrongAuthService.getInstance().isReady)
      {
         return new com.google.youtube.tv.data.StrongAuthDataFetcher();
      }
      return new com.google.youtube.tv.data.DataFetcher();
   }
   function createChildren()
   {
      var _loc2_ = this.getData();
      if(!_loc2_.length)
      {
         this.needLoadMore = false;
      }
   }
   function getURL()
   {
      if(this.startIndex >= com.google.youtube.tv.app.Config.MAX_NUM_VIDEOS_PER_FEED)
      {
         return "";
      }
      var _loc2_ = this.url;
      if(this.needLoadMore)
      {
         var _loc3_ = ["max-results=" + this.pageSize,"start-index=" + (this.startIndex + 1)];
         _loc2_ = com.google.youtube.tv.util.StringUtil.addParamsToRequest(_loc2_,_loc3_);
         this.lastStartIndex = this.startIndex;
         this.offset = 0;
         this.startIndex += this.pageSize;
         return _loc2_;
      }
      return _loc2_;
   }
   function isStandardFeed()
   {
      return this.url.indexOf("/standardfeeds/") > 0;
   }
   function getThumbnailUrl()
   {
      return this.prefetchedData.thumbnail || this.getChildren()[0].getThumbnailUrl();
   }
   function clear(opt_unlinkChildren)
   {
      this.lastStartIndex = 0;
      this.startIndex = 0;
      this.offset = 0;
      this.needLoadMore = this.initialNeededLoadMore;
      this.prefetchedData = null;
      super.clear(opt_unlinkChildren);
   }
   function getUID()
   {
      return "GDataNode" + this.instanceId;
   }
   function toString()
   {
      return "<GDataNode " + this.instanceId + ">";
   }
}
class com.google.youtube.tv.tree.PlaylistFeedNode extends com.google.youtube.tv.tree.GDataNode
{
   var hasMore;
   var trackingType;
   var url;
   var title;
   var videoCount;
   var cobj;
   var dataSelector;
   var children;
   var startIndex;
   var pageSize;
   var prefetchedData;
   var type;
   static var TYPE_UPLOADS = "TYPE_UPLOADS";
   static var DEFAULT_XTRACTOR = "/feed/entry[*](" + com.google.youtube.tv.tree.ContentTree.ENTRY_XTRACTOR + ")";
   static var MAX_UNAVAILABLE_VIDEOS = 20;
   var hasRealChildren = false;
   var deduplicate = false;
   var skippedVideosCount = 0;
   function PlaylistFeedNode(title, url, loadNow, data, needLoadMore)
   {
      super(title,url,loadNow,data,needLoadMore);
   }
   function setDeduplicate(value)
   {
      this.deduplicate = value;
   }
   function loadMore()
   {
      if(!this.loaded || this.hasMore)
      {
         super.loadMore();
      }
   }
   function getTrackingType()
   {
      if(!this.trackingType && this.url)
      {
         this.detectTrackingType();
      }
      return super.getTrackingType();
   }
   function detectTrackingType()
   {
      if(this.url.indexOf("/standardfeeds/") > 0)
      {
         var _loc2_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_STANDARD + this.url.split("?")[0].split("/").pop();
      }
      else if(this.url.indexOf("/related") > 0)
      {
         _loc2_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_RELATED;
      }
      else if(this.url.indexOf("/users/") > 0)
      {
         var _loc3_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_USER_LIST;
         if(this.url.indexOf("/favorites") > 0)
         {
            _loc3_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_FAVORITES;
         }
         else if(this.url.indexOf("/uploads") > 0)
         {
            _loc3_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_UPLOADS;
         }
         _loc2_ = _loc3_ + this.url.split("/users/")[1].split("/")[0];
      }
      else if(this.url.indexOf("/playlists/"))
      {
         _loc2_ = this.url.split("/playlists/")[1].split("?")[0];
         if(_loc2_.indexOf(com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_PLAYLIST) != 0)
         {
            _loc2_ = com.google.youtube.tv.tree.TreeNode.TRACKING_TYPE_PLAYLIST + _loc2_;
         }
      }
      if(_loc2_)
      {
         this.setTrackingType(_loc2_);
      }
   }
   function parse(src)
   {
      var _loc3_ = new XML();
      _loc3_.ignoreWhite = true;
      _loc3_.parseXML(src);
      if(!this.title)
      {
         this.title = com.google.youtube.tv.util.Xtract.getValue(_loc3_,"/feed/title");
      }
      this.videoCount = this.videoCount || Number(com.google.youtube.tv.util.Xtract.getValue(_loc3_,"/feed/openSearch:totalResults"));
      if(this.videoCount <= com.google.youtube.tv.app.Config.GDATA_NUM_RESULTS_PER_PAGE && this.isStandardFeed())
      {
         this.videoCount = com.google.youtube.tv.app.Config.GDATA_STANDARD_FEED_SIZE;
      }
      this.hasMore = com.google.youtube.tv.util.Xtract.getValue(_loc3_,"/feed/link[@rel=\"next\"]/@rel") != null || this.isStandardFeed();
      this.cobj = com.google.youtube.tv.util.Xtract.getComplexValues(_loc3_,this.dataSelector || com.google.youtube.tv.tree.PlaylistFeedNode.DEFAULT_XTRACTOR);
      if(this.deduplicate)
      {
         this.removeDuplicates();
      }
   }
   function removeDuplicates()
   {
      var _loc2_ = {};
      var _loc3_ = 0;
      while(_loc3_ < this.children.length || 0)
      {
         var _loc4_ = com.google.youtube.tv.tree.VideoNode(this.children[_loc3_]).getVideoId();
         if(_loc4_)
         {
            _loc2_[_loc4_] = true;
         }
         _loc3_ += 1;
      }
      var _loc5_ = this.getData();
      var _loc6_ = _loc5_.length - 1;
      while(_loc6_ >= 0)
      {
         var _loc7_ = _loc5_[_loc6_].videoId;
         if(_loc7_)
         {
            if(_loc2_[_loc7_])
            {
               _loc5_.splice(_loc6_,1);
            }
            else
            {
               _loc2_[_loc7_] = true;
            }
         }
         _loc6_ -= 1;
      }
   }
   function createChildren()
   {
      var _loc3_ = this.getData();
      var _loc4_ = false;
      var _loc5_ = 0;
      while(_loc5_ < _loc3_.length)
      {
         if(_loc3_[_loc5_].videoId)
         {
            var _loc6_ = new com.google.youtube.tv.tree.VideoNode(_loc3_[_loc5_]);
            this.addItem(_loc6_);
            this.hasRealChildren = true;
            _loc4_ = true;
         }
         _loc5_ += 1;
      }
      if(!this.hasRealChildren)
      {
         this.clear();
      }
      if(!this.isStandardFeed() && (this.videoCount && this.startIndex >= this.videoCount))
      {
         this.needLoadMore = false;
      }
      if(_loc4_)
      {
         this.skippedVideosCount = 0;
      }
      else if(this.skippedVideosCount < com.google.youtube.tv.tree.PlaylistFeedNode.MAX_UNAVAILABLE_VIDEOS)
      {
         this.skippedVideosCount += this.pageSize;
      }
      else
      {
         this.hasMore = false;
      }
      if(!this.hasMore)
      {
         this.videoCount = this.children.length;
      }
      if(!_loc4_ && (this.needLoadMore && this.hasMore))
      {
         this.loadStarted = false;
         this.loadMore();
      }
      else
      {
         super.createChildren();
      }
   }
   function hasMoreVideos()
   {
      return this.hasMore;
   }
   function getVideosCount()
   {
      return this.videoCount || (this.prefetchedData.video_count || (this.children.length || 0));
   }
   function getPlaylistId()
   {
      return this.prefetchedData.playlist_id || this.prefetchedData.list_id;
   }
   function getType()
   {
      return this.type;
   }
   function setType(type)
   {
      this.type = type;
   }
   function isTerminal()
   {
      return true;
   }
   function containsOnlyVideoNodes()
   {
      var _loc2_ = 0;
      while(_loc2_ < this.children.length || 0)
      {
         if(!com.google.youtube.tv.tree.VideoNode(this.children[_loc2_]))
         {
            return false;
         }
         _loc2_ += 1;
      }
      return true;
   }
   function getUID()
   {
      return "PlaylistFeedNode" + this.instanceId;
   }
   function toString()
   {
      return "<PlaylistFeedNode title:" + this.title + " count:" + this.count + ">";
   }
}
class com.google.youtube.tv.tree.ContentTree extends com.google.youtube.tv.tree.TreeNode
{
   var messages;
   var autoPlayNode;
   var videosNode;
   var channelsNode;
   var accountNode;
   var settingsNode;
   var pairNode;
   var improveNode;
   var subscriptionsNode;
   var loadScheduler;
   var checkLoadedDelegate;
   var whatToWatchNode;
   var children;
   var watchLaterNode;
   var watchHistoryNode;
   var userPlaylistsFeedNode;
   var signOutNode;
   var signInNode;
   static var treeRoot;
   static var ENTRY_XTRACTOR = "published," + "title," + "author/name as author," + "media:group(media:description as description," + "media:thumbnail/@url as thumbnail," + "yt:duration/@seconds as duration," + "yt:videoid as videoId," + "media:credit[@role=\"uploader\"]," + "yt:statistics/@viewCount as view_count," + "yt:rating/@numDislikes as dislikes," + "yt:rating/@numLikes as likes)";
   static var FEED_USER_PLAYLISTS_FIELDS = "entry(yt:playlistId,title,link,updated,yt:countHint," + "media:group/media:thumbnail[@yt:name=\'" + com.google.youtube.tv.app.Config.THUMBS_QUALITY + "\'](@url))";
   static var WHAT_TO_WATCH_URL = "${gdataUrl}/feeds/api/users/default/river";
   static var FEED_FAVORITES_URL = "${gdataUrl}/feeds/api/users/default/favorites";
   static var FEED_SUBSCRIBED_CHANNELS_TEMPLATE = "${gdataUrl}/feeds/api/users/default/subscriptions?" + "start-index=${start}&max-results=${size}&fields=${fields}";
   static var FEED_SUBSCRIBED_CHANNELS_FIELDS = "entry(yt:username)";
   static var FEED_USER_PLAYLISTS_URL = "${gdataUrl}/feeds/api/users/default/playlists";
   static var FEED_UPLOADS_URL = "${gdataUrl}/feeds/api/users/default/uploads";
   static var FEED_VIDEO_INFO_TEMPLATE = "${gdataUrl}/feeds/api/videos/${videoId}?fields=${fields}";
   static var FEED_VIDEO_INFO_FIELDS = "title,link,id,author/name,published,yt:statistics,yt:rating," + "media:group(media:thumbnail[@yt:name=\'" + com.google.youtube.tv.app.Config.THUMBS_QUALITY + "\'](@url),media:description,yt:videoid," + "yt:duration)";
   static var FEED_VIDEO_INFO_XTRACTOR = "/entry[*](" + com.google.youtube.tv.tree.ContentTree.ENTRY_XTRACTOR + ")";
   static var MAX_LOAD_TIME = 7000;
   var loadedNodesCount = 0;
   function ContentTree()
   {
      super();
   }
   function init()
   {
      this.messages = com.google.youtube.tv.services.MessagesService["get"]();
      if(com.google.youtube.tv.app.Environment.hasVideoId())
      {
         var _loc2_ = com.google.youtube.tv.util.StringUtil.replacePlaceholders(com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_TEMPLATE,{videoId:com.google.youtube.tv.app.Environment.getVideoId(),fields:com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_FIELDS});
         this.autoPlayNode = new com.google.youtube.tv.tree.ComplexFeedNode("",[{url:_loc2_,xtractor:com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_XTRACTOR,needLoadMore:false}]);
         this.addItem(this.autoPlayNode);
      }
      else if(com.google.youtube.tv.app.Environment.hasVideoPlusRelatedId())
      {
         var _loc3_ = com.google.youtube.tv.util.StringUtil.replacePlaceholders(com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_TEMPLATE,{videoId:com.google.youtube.tv.app.Environment.getVideoPlusRelatedId(),fields:com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_FIELDS});
         this.autoPlayNode = new com.google.youtube.tv.tree.ComplexFeedNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.RELATED_VIDEOS),[{url:_loc3_,xtractor:com.google.youtube.tv.tree.ContentTree.FEED_VIDEO_INFO_XTRACTOR,needLoadMore:false},{url:"http://[censoring my ip]:80/feeds/api/videos/" + com.google.youtube.tv.app.Environment.getVideoPlusRelatedId() + "/related",xtractor:null,needLoadMore:true}]);
         this.addItem(this.autoPlayNode);
      }
      else if(com.google.youtube.tv.app.Environment.hasPlaylistId())
      {
         this.autoPlayNode = new com.google.youtube.tv.tree.PlaylistFeedNode("",com.google.youtube.tv.util.StringUtil.addParamsToRequest("${gdataUrl}/feeds/api/playlists/" + com.google.youtube.tv.app.Environment.getPlaylistId(),["v=2.1","fields=" + com.google.youtube.tv.tree.GDataNode.getFields()]),true,null,true);
         this.addItem(this.autoPlayNode);
      }
      this.videosNode = new com.google.youtube.tv.tree.VideosNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.VIDEOS),"http://[censoring my ip]:80" + "/leanback_ajax?action_featured=1&style=xml&" + "client=lbl&override_hl=1&hl=" + this.messages.getLocale());
      this.addItem(this.videosNode);
      this.channelsNode = new com.google.youtube.tv.tree.ChannelsNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.BADGE_CHANNELS));
      this.addItem(this.channelsNode);
      this.accountNode = new com.google.youtube.tv.tree.TreeNode();
      this.accountNode.setMenuCapturing(true);
      this.addItem(this.accountNode);
      this.settingsNode = new com.google.youtube.tv.tree.TreeNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SETTINGS));
      this.addItem(this.settingsNode);
      this.pairNode = new com.google.youtube.tv.tree.VerbNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.PAIR_MENU_TITLE),this.messages.getMsg(com.google.youtube.tv.services.MessagesService.PAIR_MENU_SUBTITLE),com.google.youtube.tv.wiring.AppEvent.ACTION_PAIR);
      this.pairNode.iconId = "pairingIcon";
      this.settingsNode.addItem(this.pairNode);
      this.improveNode = new com.google.youtube.tv.tree.VerbNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.IMPROVE_YOUTUBE_TITLE),"",com.google.youtube.tv.wiring.AppEvent.ACTION_IMPROVE_YOUTUBE);
      this.settingsNode.addItem(this.improveNode);
      this.updateUserNodes();
      if(!com.google.youtube.tv.platform.Box.hasAutoPlay() && (com.google.youtube.tv.app.Environment.hasSearchVar() || (!com.google.youtube.tv.services.SignInService.isSignedIn() || (!this.subscriptionsNode || this.subscriptionsNode.isLoaded()))))
      {
         this.setLoaded(true);
      }
      else
      {
         this.loadScheduler = com.google.youtube.util.Scheduler.setTimeout(com.google.youtube.tv.tree.ContentTree.MAX_LOAD_TIME,com.google.chianti.event.EventDelegate.create(this,this.onLoadTimeout));
         this.checkLoadedDelegate = com.google.chianti.event.EventDelegate.create(this,this.checkLoaded);
         if(this.subscriptionsNode)
         {
            this.subscriptionsNode.getValueStream().addSinkFunction(this.checkLoadedDelegate);
         }
         if(this.autoPlayNode)
         {
            this.autoPlayNode.getValueStream().addSinkFunction(this.checkLoadedDelegate);
         }
         this.checkLoaded();
      }
   }
   function onLoadTimeout()
   {
      this.setLoaded(true);
   }
   function checkLoaded()
   {
      if((!this.subscriptionsNode || this.subscriptionsNode.isLoaded()) && (!this.autoPlayNode || this.autoPlayNode.isLoaded()))
      {
         this.setLoaded(true);
      }
   }
   function setLoaded(value, opt_error)
   {
      var _loc5_ = this.loaded;
      super.setLoaded(value,opt_error);
      if(value && !_loc5_)
      {
         this.loadScheduler.stop();
         this.loadScheduler = null;
         this.subscriptionsNode.getValueStream().removeSinkFunction(this.checkLoadedDelegate);
         if(this.autoPlayNode)
         {
            this.autoPlayNode.getValueStream().removeSinkFunction(this.checkLoadedDelegate);
         }
         this.checkLoadedDelegate = null;
         com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.CONTENT_LOADED));
      }
   }
   function signIn()
   {
      if(!this.loaded)
      {
         return undefined;
      }
      this.updateUserNodes();
   }
   function signOut()
   {
      if(!this.loaded)
      {
         return undefined;
      }
      this.updateUserNodes();
   }
   function updateUserNodes()
   {
      this.accountNode.clear();
      this.videosNode.updateUserNodes();
      this.channelsNode.updateUserNodes();
      if(com.google.youtube.tv.services.SignInService.isSignedIn())
      {
         this.accountNode.setTitle(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.ACCOUNT));
         if(!this.whatToWatchNode)
         {
            this.whatToWatchNode = new com.google.youtube.tv.tree.WhatToWatchNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.WHAT_TO_WATCH),com.google.youtube.tv.tree.ContentTree.WHAT_TO_WATCH_URL,true,null,true);
            this.addItemAt(this.whatToWatchNode,!this.autoPlayNode ? 0 : 1);
         }
         if(!this.subscriptionsNode)
         {
            this.subscriptionsNode = new com.google.youtube.tv.tree.UserSubscriptionsNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SUBSCRIPTIONS_CHANNEL));
            this.addItemAt(this.subscriptionsNode,this.children[this.whatToWatchNode.index] != this.whatToWatchNode ? (!this.autoPlayNode ? 0 : 1) : this.whatToWatchNode.index + 1);
         }
         if(!this.watchLaterNode)
         {
            this.watchLaterNode = new com.google.youtube.tv.tree.WatchLaterNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.WATCH_LATER));
            this.addItemAt(this.watchLaterNode,this.accountNode.index);
         }
         this.watchHistoryNode = new com.google.youtube.tv.tree.WatchHistoryNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.WATCH_HISTORY));
         this.accountNode.addItem(this.watchHistoryNode);
         this.userPlaylistsFeedNode = new com.google.youtube.tv.tree.UserPlaylistsFeedNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.USER_PLAYLISTS_TITLE),com.google.youtube.tv.tree.ContentTree.FEED_USER_PLAYLISTS_URL,false,null,true);
         this.accountNode.addItem(this.userPlaylistsFeedNode);
         var _loc2_ = new com.google.youtube.tv.tree.PlaylistFeedNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.UPLOADS_CHANNEL),com.google.youtube.tv.tree.ContentTree.FEED_UPLOADS_URL,false,null,true);
         this.accountNode.addItem(_loc2_);
         var _loc3_ = new com.google.youtube.tv.tree.PlaylistFeedNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.FAVORITES_CHANNEL),com.google.youtube.tv.tree.ContentTree.FEED_FAVORITES_URL,false,null,true);
         this.accountNode.addItem(_loc3_);
         if(!this.signOutNode)
         {
            this.signOutNode = new com.google.youtube.tv.tree.SignOutNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SIGN_OUT_CHANNEL),this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SIGN_OUT_SUBTITLE),com.google.youtube.tv.wiring.AppEvent.ACTION_SIGN_OUT_INVITATION);
         }
         this.accountNode.addItem(this.signOutNode);
      }
      else
      {
         if(this.whatToWatchNode)
         {
            this.removeItem(this.whatToWatchNode);
            this.whatToWatchNode = null;
         }
         if(this.subscriptionsNode)
         {
            this.removeItem(this.subscriptionsNode);
            this.subscriptionsNode = null;
         }
         if(this.watchLaterNode)
         {
            this.removeItem(this.watchLaterNode);
            this.watchLaterNode = null;
         }
         this.accountNode.clear();
         this.accountNode.setTitle(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SIGN_IN_CHANNEL));
         this.signOutNode.remove();
         this.signOutNode = null;
         if(!this.signInNode)
         {
            this.signInNode = new com.google.youtube.tv.tree.VerbNode(this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SIGN_IN_CHANNEL),this.messages.getMsg(com.google.youtube.tv.services.MessagesService.SIGN_IN_SUBTITLE),com.google.youtube.tv.wiring.AppEvent.ACTION_SIGN_IN);
            this.signInNode.iconId = "profileIcon";
         }
         this.accountNode.addItem(this.signInNode);
      }
      this.accountNode.update();
      this.update();
   }
   function getUserPlaylistsNode()
   {
      return this.userPlaylistsFeedNode;
   }
   function getAutoPlayNode()
   {
      return this.autoPlayNode;
   }
   function getUserSubscriptionsNode()
   {
      return this.subscriptionsNode;
   }
   function getWatchHistoryNode()
   {
      return this.watchHistoryNode;
   }
   static function getRoot()
   {
      if(!com.google.youtube.tv.tree.ContentTree.treeRoot)
      {
         com.google.youtube.tv.tree.ContentTree.treeRoot = new com.google.youtube.tv.tree.ContentTree();
      }
      return com.google.youtube.tv.tree.ContentTree.treeRoot;
   }
   function toString()
   {
      return " < ContentTree > ";
   }
}

this is the chromeless host server on where it has the link to the api player path and video player controller:

class com.google.youtube.tv.controller.ChromelessHost extends com.google.chianti.event.EventBroadcaster
{
   var container;
   var player;
   var adsService;
   var seeking;
   var seekAllowed;
   var seekOnPlay;
   var seekTimeout;
   var videoNode;
   var lastCurrentTime;
   var playbackFirstDetectedTime;
   var tid;
   var storage;
   var SK;
   var adHostVideoNode;
   var adPaused;
   var autoPlay;
   var streamStartSeconds;
   var seekToTime;
   var playerTimeBeforeSeek;
   static var SEEK_TIME = 10;
   static var ALLOW_SEEK_AHEAD_TIME = 20;
   static var SEEK_END_OFFSET = 3;
   static var SEEK_PRECISION = 2;
   static var SEEK_GROUP_TIMEOUT = 2000;
   static var PLAYBACK_DETECTION_RESET_TIME = 5;
   static var PLAYBACK_DETECTION_TIME = 0.5;
   static var API_PLAYER_PATH = "http://[censoring my ip]:80/apiplayer?" + "version=2" + "&ps=lbl" + "&el=leanback" + "&cc_auto_caps=1";
   static var DEFAULT_PLAYER_WIDTH = 320;
   static var DEFAULT_PLAYER_HEIGHT = 240;
   static var LOGO_SHIFT = 12;
   var ready = false;
   var adVideoLastTimestamp = 0;
   function ChromelessHost(container)
   {
      super();
      com.google.chianti.event.EventBroadcaster.initialize(this);
      this.container = container;
   }
   function init()
   {
      System.security.allowDomain("192.168.1.251");
      System.security.allowDomain("192.168.1.251:443");
      this.player = this.container.createEmptyMovieClip("PLAYER",this.container.getNextHighestDepth());
      this.player._x = Stage.width - com.google.youtube.tv.controller.ChromelessHost.DEFAULT_PLAYER_WIDTH - com.google.youtube.tv.controller.ChromelessHost.LOGO_SHIFT;
      this.player._y = Stage.height - com.google.youtube.tv.controller.ChromelessHost.DEFAULT_PLAYER_HEIGHT - com.google.youtube.tv.controller.ChromelessHost.LOGO_SHIFT;
      if(com.google.youtube.tv.app.Environment.getOverridenFlashVar("sc") == "0")
      {
         com.google.youtube.tv.controller.ChromelessHost.API_PLAYER_PATH = com.google.youtube.tv.controller.ChromelessHost.API_PLAYER_PATH;
      }
      com.google.youtube.tv.wiring.EventBus.registerForEvent(com.google.youtube.tv.wiring.AppEvent.LGUPLUS_FEATURE,com.google.chianti.event.EventDelegate.create(this,this.onLGUPlusFeature));
      var _loc2_ = new MovieClipLoader();
      _loc2_.addListener(this);
      _loc2_.loadClip(com.google.youtube.tv.controller.ChromelessHost.API_PLAYER_PATH,this.player);
      this.adsService = com.google.youtube.tv.ads.AdsService.getInstance();
   }
   function onInterval()
   {
      if(!this.ready)
      {
         this.initializeChromelessPlayer();
         return undefined;
      }
      var _loc2_ = this.getDuration();
      var _loc3_ = 0;
      if(_loc2_ > 0)
      {
         _loc3_ = this.getCurrentTime();
      }
      else
      {
         _loc3_ = 0;
      }
      var _loc4_ = this.isPlaybackDetected();
      if(_loc4_ && this.seeking)
      {
         this.completeSeek();
      }
      if(com.google.youtube.tv.platform.Box.getVendor() == com.google.youtube.tv.platform.Box.VENDOR_SAMSUNG && (_loc4_ && this.getPlayerState() == com.google.youtube.tv.model.PlayerState.BUFFERING))
      {
         this.player.playVideo();
      }
      if(this.getCurrentTime() > 1 && (!this.seekAllowed && this.getPlayerState() == com.google.youtube.tv.model.PlayerState.PLAYING))
      {
         this.seekAllowed = true;
         if(this.seekOnPlay)
         {
            this.seekOnPlay = false;
            if(!this.seekTimeout)
            {
               this.seek();
            }
         }
      }
      if(this.videoNode && _loc2_ >= 0)
      {
         this.reportProgress();
      }
      this.lastCurrentTime = _loc3_;
   }
   function isPlaybackDetected()
   {
      var _loc3_ = this.player.getCurrentTime();
      var _loc4_ = _loc3_ > 0 && (this.lastCurrentTime > 0 && _loc3_ != this.lastCurrentTime);
      if(_loc4_)
      {
         if(_global.isNaN(this.playbackFirstDetectedTime))
         {
            this.playbackFirstDetectedTime = _loc3_;
         }
         else
         {
            if(Math.abs(_loc3_ - this.playbackFirstDetectedTime) > com.google.youtube.tv.controller.ChromelessHost.PLAYBACK_DETECTION_RESET_TIME)
            {
               this.playbackFirstDetectedTime = _global.NaN;
               return false;
            }
            if(_loc3_ - this.playbackFirstDetectedTime > com.google.youtube.tv.controller.ChromelessHost.PLAYBACK_DETECTION_TIME)
            {
               this.playbackFirstDetectedTime = _global.NaN;
               return true;
            }
         }
      }
      return false;
   }
   function reportProgress()
   {
      var _loc2_ = this.player.loadClip.overallHolder.videoPlayer.videoLoader;
      var _loc3_ = 100 * this.player.getVideoLoadedFraction();
      var _loc4_ = _loc2_.isInPreroll();
      var _loc5_ = !(this.getDuration() && this.player.getVideoBytesTotal()) ? 0 : this.player.getVideoBytesTotal() / this.getDuration();
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_PROGRESS,{duration:this.getDuration(),loaded:_loc3_,currentTime:this.getCurrentTime(),adPreRoll:_loc4_,bitrate:_loc5_}));
   }
   function initializeChromelessPlayer()
   {
      if(!this.player.isPlayerLoaded())
      {
         return undefined;
      }
      this.player.addEventListener("onStateChange",com.google.chianti.event.EventDelegate.create(this,this.onChromelessStateChange));
      this.player.addEventListener("onErrorWithData",com.google.chianti.event.EventDelegate.create(this,this.onChromelessError));
      this.player.addEventListener("onAdModuleEvent",com.google.chianti.event.EventDelegate.create(this,this.onAdModuleEvent));
      this.player.addEventListener("onBrandingOptions",com.google.chianti.event.EventDelegate.create(this,this.onBrandingOptions));
      this.player.addEventListener("onSubtitlesDataLoaded",com.google.chianti.event.EventDelegate.create(this,this.onSubtitlesData));
      this.player.addEventListener("onSubtitlesScreenUpdate",com.google.chianti.event.EventDelegate.create(this,this.onSubtitlesScreenUpdate));
      this.player.useHandCursor = false;
      this.player.setSize(Stage.width,Stage.height);
      this.player._x = 0;
      this.player._y = 0;
      this.player.enableH264ForFlashLite();
      this.player.setLogoVisible(false);
      if(com.google.youtube.tv.platform.Box.forceFullscreen())
      {
         this.player.forceFullscreen();
         this.player.setSize(Stage.width,Stage.height);
      }
      com.google.youtube.tv.services.SignInService.getInstance().registerEvents(com.google.youtube.tv.services.SignInService.ACCESS_TOKEN_FIRST_RECEIVE,com.google.youtube.tv.services.SignInService.ACCESS_TOKEN_UPDATE,com.google.youtube.tv.services.SignInService.SIGN_OUT,com.google.chianti.event.EventDelegate.create(this,this.updateAccessToken));
      this.updateAccessToken();
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_INIT));
      this.ready = true;
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_READY));
   }
   function onLGUPlusFeature(event)
   {
      var _loc3_ = com.google.youtube.tv.platform.Box.getExplicitVideoRectangle();
      if(_loc3_)
      {
         this.player.setExplicitVideoSize(_loc3_.width,_loc3_.height);
      }
   }
   function onLoadComplete(mc)
   {
      this.tid = _global.setInterval(this,"onInterval",500);
   }
   function onLoadInit(mc)
   {
      this.player.eurl = "";
      this.player.c = com.google.youtube.tv.platform.Box.getBoxId();
      this.storage = com.google.youtube.tv.services.StorageService["get"]();
      this.storage.registerEvent(com.google.youtube.tv.services.StorageService.STORAGE_READY,com.google.chianti.event.EventDelegate.create(this,this.onStorageReady));
   }
   function onStorageReady()
   {
      this.SK = this.storage.getValue(com.google.youtube.tv.services.StorageService.SK);
      if(this.SK)
      {
         this.player.sk = this.SK;
      }
      else
      {
         this.SK = this.player.sk;
         this.storage.setValueWithoutFlush(com.google.youtube.tv.services.StorageService.SK,this.SK);
         this.storage.setValue(com.google.youtube.tv.services.StorageService.SK_TIMESTAMP,com.google.youtube.tv.services.StorageService.getTimestamp());
      }
   }
   function onChromelessStateChange(playerState)
   {
      if(playerState == com.google.youtube.tv.model.PlayerState.ENDED)
      {
         this.setVisible(false);
      }
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_STATE_CHANGE,{playerState:playerState,videoId:this.videoNode.getVideoId(),currentTime:this.getCurrentTime()}));
      if(this.seeking && (!this.seekOnPlay && playerState == com.google.youtube.tv.model.PlayerState.PLAYING))
      {
         this.completeSeek();
      }
   }
   function onChromelessError(data)
   {
      com.google.youtube.tv.services.StatsLoggerService.getInstance().sendVideoSkippedReason(this.videoNode.getVideoId(),data.errorCode);
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_ERROR,{error:data.errorCode,description:data.description,videoId:this.videoNode.getVideoId()}));
   }
   function updateAccessToken()
   {
      if(this.player && this.player.setAccessToken)
      {
         this.player.setAccessToken(com.google.youtube.tv.services.SignInService.getInstance().accessToken || null);
      }
   }
   function onBrandingOptions(options)
   {
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.BRANDING_OPTIONS_READY,options));
   }
   function onSubtitlesData(event)
   {
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.SUBTITLES_EVENT,event));
   }
   function onSubtitlesScreenUpdate(event)
   {
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.SUBTITLES_SCREEN_UPDATE));
   }
   function unserialize(serializedString)
   {
      var _loc2_ = new LoadVars();
      _loc2_.decode(serializedString);
      return Object(_loc2_);
   }
   function onAdModuleEvent(evtData)
   {
      var _loc3_ = this.unserialize(evtData);
      var _loc4_ = _loc3_.type;
      delete _loc3_.type;
      this.adsService.processAdEvent(_loc4_,_loc3_);
      switch(_loc4_)
      {
         case "onAdModuleLoaded":
            this.adHostVideoNode = this.videoNode;
            break;
         case "onAdModuleComplete":
            this.adVideoLastTimestamp = new Date().getTime() / 1000;
         case "onAdModuleError":
            this.videoNode = this.adHostVideoNode;
            this.adHostVideoNode = null;
      }
   }
   function onPlayerClick()
   {
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.VIDEO_PLAYER_CLICK));
   }
   function getVideoNode()
   {
      return this.videoNode;
   }
   function getCurrentTime()
   {
      var _loc3_ = this.player.getCurrentTime();
      return !(_global.isNaN(_loc3_) || (_loc3_ < 0 || !this.videoNode)) ? _loc3_ : 0;
   }
   function getDuration()
   {
      var _loc3_ = this.player.getDuration();
      return !(_global.isNaN(_loc3_) || (_loc3_ < 0 || !this.videoNode)) ? _loc3_ : 0;
   }
   function getPlayerState()
   {
      return this.player.getPlayerState();
   }
   function isPlaying()
   {
      if(this.adHostVideoNode)
      {
         return !this.adPaused;
      }
      return this.player.getPlayerState() == com.google.youtube.tv.model.PlayerState.PLAYING || (this.player.getPlayerState() == com.google.youtube.tv.model.PlayerState.BUFFERING || this.player.getPlayerState() == com.google.youtube.tv.model.PlayerState.SEEKING);
   }
   function isPlayerReady()
   {
      return this.ready;
   }
   function autoPlayOnce()
   {
      this.autoPlay = true;
   }
   function play(videoNode)
   {
      this.videoNode = videoNode;
      var _loc3_ = videoNode.parent;
      this.player.setListId(_loc3_.getTrackingType());
      this.player.setFeature(_loc3_.getFeatureType(),_loc3_.getFeatureBunch().ytr);
      this.seekAllowed = false;
      this.resetSeek();
      this.player.setAdsTimestamp(this.adVideoLastTimestamp);
      this.player.setAutoPlay(this.autoPlay);
      this.autoPlay = false;
      this.setVisible(true);
      this.streamStartSeconds = videoNode.getStartSeconds();
      this.player.loadVideoById(videoNode.getVideoId(),videoNode.getStartSeconds());
   }
   function pause()
   {
      if(this.videoNode && !this.seeking)
      {
         if(this.adHostVideoNode)
         {
            this.adPaused = true;
         }
         this.player.pauseVideo();
         return true;
      }
      return false;
   }
   function unpause()
   {
      if(this.videoNode && !this.seeking)
      {
         if(this.adHostVideoNode)
         {
            this.adPaused = false;
         }
         this.player.playVideo();
         return true;
      }
      return false;
   }
   function stop()
   {
      if(this.adsService.isAdActive())
      {
         this.player.pauseVideo();
         this.adsService.processAdEvent("onAdModuleError");
      }
      this.resetSeek();
      this.player.stopVideo();
      this.player.showWatermark();
      this.videoNode.setStartSeconds(0);
      this.streamStartSeconds = 0;
      this.videoNode = null;
      this.seekAllowed = false;
   }
   function rewind()
   {
      this.resetSeek();
      this.seekTo(0);
   }
   function seekForward()
   {
      this.seekTo(this.getCurrentTime() + com.google.youtube.tv.controller.ChromelessHost.SEEK_TIME);
   }
   function seekBack()
   {
      this.seekTo(this.getCurrentTime() - com.google.youtube.tv.controller.ChromelessHost.SEEK_TIME);
   }
   function seekTo(time)
   {
      if(!this.videoNode)
      {
         return undefined;
      }
      if(this.getDuration() > 0)
      {
         time = Math.min(time,this.getDuration() - com.google.youtube.tv.controller.ChromelessHost.SEEK_END_OFFSET);
      }
      time = Math.max(time,0);
      if(Math.abs(time - this.getCurrentTime()) <= com.google.youtube.tv.controller.ChromelessHost.SEEK_PRECISION)
      {
         return undefined;
      }
      if(this.getPlayerState() == com.google.youtube.tv.model.PlayerState.PAUSED)
      {
         this.unpause();
      }
      this.seeking = true;
      this.seekToTime = time;
      if(this.seekAllowed)
      {
         if(!this.seekTimeout && (this.getPlayerState() == com.google.youtube.tv.model.PlayerState.PLAYING || this.getPlayerState() == com.google.youtube.tv.model.PlayerState.PAUSED))
         {
            this.seek();
         }
         else if(!this.seekTimeout)
         {
            this.seekTimeout = com.google.youtube.util.Scheduler.setTimeout(com.google.youtube.tv.controller.ChromelessHost.SEEK_GROUP_TIMEOUT,com.google.chianti.event.EventDelegate.create(this,this.onSeekGroupTimeout));
         }
         else
         {
            this.seekTimeout.restart();
         }
      }
      else
      {
         this.seekOnPlay = true;
      }
      com.google.youtube.tv.wiring.EventBus.broadcastEvent(new com.google.youtube.tv.wiring.AppEvent(com.google.youtube.tv.wiring.AppEvent.ACTION_SEEK_TO,{seekToTime:time,playerState:this.getPlayerState()}));
   }
   function onSeekGroupTimeout()
   {
      this.seekTimeout = null;
      this.seek();
   }
   function seek()
   {
      this.playerTimeBeforeSeek = this.player.getCurrentTime();
      var _loc2_ = !com.google.youtube.tv.platform.Box.isWii() && this.isOutOfBuffer(this.seekToTime,com.google.youtube.tv.controller.ChromelessHost.ALLOW_SEEK_AHEAD_TIME) || this.seekToTime == 0 && !com.google.youtube.tv.platform.Box.canSeekTo0();
      if(_loc2_)
      {
         this.streamStartSeconds = this.seekToTime;
      }
      this.player.seekTo(this.seekToTime,_loc2_);
      this.completeSeek();
   }
   function isOutOfBuffer(seconds, bufferOffset)
   {
      return seconds < this.streamStartSeconds || seconds > Math.max(this.getCurrentTime() + bufferOffset,this.player.getVideoLoadedFraction() * this.getDuration());
   }
   function completeSeek()
   {
      if(this.seekTimeout)
      {
         this.seekTimeout.stop();
         this.seekTimeout = null;
         this.onSeekGroupTimeout();
      }
      else if(this.seeking)
      {
         this.seeking = false;
      }
   }
   function resetSeek()
   {
      this.seekToTime = _global.NaN;
      this.seekOnPlay = false;
      this.seeking = false;
      this.playerTimeBeforeSeek = _global.NaN;
      this.lastCurrentTime = _global.NaN;
      this.playbackFirstDetectedTime = _global.NaN;
      if(this.seekTimeout)
      {
         this.seekTimeout.stop();
         this.seekTimeout = null;
      }
   }
   function adSkip()
   {
      this.player.adSkip();
   }
   function destroy()
   {
      this.player.stopVideo();
      this.player.clearVideo();
      this.player.destroy();
      this.player.unloadMovie();
      this.player.removeMovieClip();
   }
   function clearVideo()
   {
      this.player.clearVideo();
   }
   function setVisible(visible)
   {
      this.player._visible = visible;
   }
}

@ftde0
Copy link
Owner

ftde0 commented Mar 21, 2024

can you send the SWF(s?) attached here?

@RedFireMRT84
Copy link
Author

wii.zip

@ftde0
Copy link
Owner

ftde0 commented Mar 21, 2024

had a closer look at what it wants and with help of the wayback machine, i've managed to play a video with that player.
the apiplayer.swf itself is a 2KB file that loads the actual apiplayer. after getting both the files as they should be (more on that below), we end up with those 2.
apiplayer.zip

apiplayer.swf contains an absolute path to the SWF file itself
apiplayer

while the actual apiplayer it loads can be patched for a different URL in a similar way to AS2 players (2010>).
playerconfigdata

there was an HTTPS force and a host check but other than that change the LIVE_BASE_URL and LIVE_GDATA_URL as always. you can also use the apiplayer in the ZIP attached above with all the fixes.

we end up with a loading video.
vplayback

other than horrible scaling (guessing it was a thing as it was something with playing on the Wii?) it does play.

@RedFireMRT84
Copy link
Author

on the wii though, i receive this error:

bandicam.2024-03-21.11-55-57-666.mp4

Screenshot 2024-03-21 122206
the other apiplayer i sent u was for mainly the wii and heres its chromelesshost player class that has the wii prefixes:

class com.google.youtube.players.chromeless.ChromelessPlayerController extends com.google.youtube.players.SinglePlayerController
{
   var configData;
   var onKeyDown;
   var moduleMediator;
   var videoPlayer;
   var logo;
   var largePlayButton;
   var rootMc;
   var overallHolder;
   var soundController;
   var subtitlesModuleDescriptor;
   var lastUserAction;
   var watermark;
   static var LOGO_ALPHA = 60;
   static var DEFAULT_WIDTH = 320;
   static var DEFAULT_HEIGHT = 240;
   static var CAPTIONS_PADDING = 36;
   static var SUBTITLE_MODULE_LABEL = "subtitle_module";
   var adVideoLastTimestamp = 0;
   function ChromelessPlayerController()
   {
      super();
   }
   function init(mc)
   {
      super.init(mc);
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         this.setLastUserAction();
         this.onKeyDown = this.setLastUserAction;
      }
   }
   function initData()
   {
      super.initData();
      this.keyboardControlsIgnored = 1;
      this.configData.eventLabel = com.google.youtube.config.constants.EventLabel.EMBEDDED;
      this.configData.playerLayoutStyle = com.google.youtube.config.constants.PlayerStyle.CHROMELESS;
      this.configData.ivLoadPolicy = com.google.youtube.players.modules.ModuleLoadPolicy.MODULE_LOAD_BY_REQUEST;
      this.configData.ccLoadPolicy = com.google.youtube.players.modules.ModuleLoadPolicy.MODULE_LOAD_BY_REQUEST;
      this.configData.vastAdsLoadPolicy = com.google.youtube.players.modules.ModuleLoadPolicy.MODULE_LOAD_ALWAYS;
      if(this.isLoaderDomainTrusted())
      {
         this.configData.overridePlayerIdentifiers();
      }
   }
   function initConfigData(root)
   {
      super.initConfigData(root);
      if(!this.configData.videoId && !this.configData.data)
      {
         this.configData = new com.google.youtube.players.PlayerConfigData(root._parent);
      }
   }
   function registerVideoControlsWithModuleMediator()
   {
      super.registerVideoControlsWithModuleMediator();
      this.registerEvent(com.google.youtube.event.GenericButtonEvent.AD_SKIP,com.google.chianti.event.EventDelegate.create(this.moduleMediator,this.moduleMediator.onVideoControlEvent));
   }
   function buildVideoControls()
   {
   }
   function showModulePreview()
   {
   }
   function onRequestUnload(label)
   {
      if(label == com.google.youtube.players.chromeless.ChromelessPlayerController.SUBTITLE_MODULE_LABEL)
      {
         this.broadcastExternal({type:com.google.youtube.event.ModuleEvent.SUBTITLES_DATA_LOADED,data:{available:false}});
      }
      super.onRequestUnload(label);
   }
   function onVideoPlayerBuffering(evt)
   {
      this.playbackStarted = true;
      this.hideLargePlayButton();
   }
   function resizePlayer(newWidth, newHeight)
   {
      this.videoPlayer.setViewportSize(0,0,newWidth,newHeight);
      var _loc4_ = this.videoPlayer.getViewportRect();
      var _loc5_ = Math.min(100,Math.max(com.google.youtube.players.AbstractPlayerController.MIN_UI_SCALE,this.videoPlayer.getViewportScale(true)));
      this.logo._xscale = _loc5_;
      this.logo._yscale = _loc5_;
      var _loc6_ = this.videoPlayer.getViewportScale() / 100 * com.google.youtube.players.AbstractPlayerController.LOGO_MARGIN;
      this.logo._x = _loc4_.width - this.logo._width - _loc6_;
      this.logo._y = _loc4_.height - this.logo._height - _loc6_;
      this.largePlayButton._x = _loc4_.width / 2;
      this.largePlayButton._y = _loc4_.height / 2;
      this.largePlayButton._xscale = this.largePlayButton._yscale = _loc5_;
   }
   function hideLargePlayButton()
   {
      this.largePlayButton._visible = false;
   }
   function showLargePlayButton()
   {
      this.largePlayButton._visible = true;
   }
   function onLargePlayButtonRelease(evt)
   {
      this.setLastUserAction();
      this.videoPlayer.play();
   }
   function onLargePlayButtonRollOver()
   {
      com.gs.TweenLite.to(this.largePlayButton.bg,0.3,{_alpha:100,overwrite:false});
   }
   function onLargePlayButtonRollOut()
   {
      com.gs.TweenLite.to(this.largePlayButton.bg,0.3,{_alpha:70,overwrite:false});
   }
   function onLargePlayButtonReleaseOutside()
   {
      this.setLastUserAction();
      this.onLargePlayButtonRollOut();
   }
   function loadVideoByUrl(videoUrl, startSeconds)
   {
      if(com.google.webutil.url.Utils.isValidVideoUrl(videoUrl) && videoUrl.indexOf("/v/") == -1)
      {
         this.loadVideoByVideoData(com.google.youtube.players.VideoData.createFromDictionary({flvurl:videoUrl}));
         this.configData.scriptedPlayback = true;
      }
      else
      {
         super.loadVideoByUrl(videoUrl,startSeconds);
      }
   }
   function onLogoRelease()
   {
      this.setLastUserAction();
      this.navigateToYouTube();
   }
   function setLogoVisible(val)
   {
      if(this.isLoaderDomainTrusted() || (this.isLoaderDomainPagead2() || this.isLoaderDomainGoogle()))
      {
         this.logo._visible = val;
      }
   }
   function onVideoLoadError(evt)
   {
      this.hideLargePlayButton();
      this.reportVideoLoadError(evt);
   }
   function setInvideoAdType(adType)
   {
      if(this.isLoaderDomainTrusted())
      {
         this.configData.eventLabel = com.google.youtube.config.constants.EventLabel.ADUNIT;
         this.configData.adType = adType;
         this.configData.playerLayoutStyle = com.google.youtube.config.constants.PlayerStyle.CHROMELESS_INVIDEO;
      }
   }
   function setAutoPlay(flag)
   {
      if(flag)
      {
         this.configData.autoPlay = "1";
      }
      else
      {
         this.configData.autoPlay = "";
      }
   }
   function setExplicitVideoSize(width, height)
   {
      this.configData.explicitVideoRect = new com.google.geom.Rect(0,0,width,height);
   }
   function setPreloaderVisibility(visible)
   {
      this.videoPlayer.setPreloaderVisibility(visible);
   }
   function getLoggingOptions()
   {
      var _loc3_ = super.getLoggingOptions();
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         _loc3_.lact = this.getTimeSinceLastUserAction();
      }
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL && (!this.configData.clientDevice && this.configData.clientInterface))
      {
         _loc3_.c = this.configData.clientInterface;
         _loc3_.cver = this.configData.clientInterfaceVersion;
         _loc3_.cbrand = this.configData.clientBrand;
         _loc3_.cmodel = this.configData.clientModel;
         if(this.configData.clientOs)
         {
            _loc3_.cos = this.configData.clientOs;
            _loc3_.cosver = this.configData.clientOsVersion;
         }
         if(this.configData.clientBrowser)
         {
            _loc3_.cbr = this.configData.clientBrowser;
            _loc3_.cbrver = this.configData.clientBrowserVersion;
         }
         if(this.configData.clientPlatform)
         {
            _loc3_.cplatform = this.configData.clientPlatform;
         }
         if(this.configData.clientNetwork)
         {
            _loc3_.cnetwork = this.configData.clientNetwork;
         }
      }
      return _loc3_;
   }
   function isLoaderDomainTrusted()
   {
      var _loc2_ = this.stripWiiPrefix(this.rootMc._parent._parent._url);
      var _loc3_ = this.stripWiiPrefix(this.configData.eurl);
      if(_loc2_ && com.google.webutil.url.YouTubeUtils.isValidYouTubeUrl(_loc2_) || _loc3_ && com.google.webutil.url.YouTubeUtils.isValidYouTubeUrl(_loc3_))
      {
         return true;
      }
      return false;
   }
   function stripWiiPrefix(url)
   {
      return !com.google.youtube.tv.wii.platform.Wii.isWii() ? url : com.google.utils.StringUtils.replace(url,"file://trusted/remote/","");
   }
   function isLoaderDomainPagead2()
   {
      var _loc2_ = this.stripWiiPrefix(this.rootMc._parent._parent._url);
      var _loc3_ = this.stripWiiPrefix(this.configData.eurl);
      if(_loc2_ && com.google.webutil.url.Utils.isValidCafeUrl(_loc2_) || _loc3_ && com.google.webutil.url.Utils.isValidCafeUrl(_loc3_))
      {
         return true;
      }
      return false;
   }
   function isLoaderDomainGoogle()
   {
      var _loc2_ = this.stripWiiPrefix(this.rootMc._parent._parent._url);
      var _loc3_ = this.stripWiiPrefix(this.configData.eurl);
      if(_loc2_ && com.google.webutil.url.Utils.isValidAbsoluteGoogleUrl(_loc2_) || _loc3_ && com.google.webutil.url.Utils.isValidAbsoluteGoogleUrl(_loc3_))
      {
         return true;
      }
      return false;
   }
   function addCallbacks()
   {
      this.addCallback("setLogoVisible",this,this.setLogoVisible);
      this.addCallback("setInvideoAdType",this,this.setInvideoAdType);
      this.addCallback("setAutoPlay",this,this.setAutoPlay);
      this.addCallback("setAdsTimestamp",this,this.setAdsTimestamp);
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL || this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.XL)
      {
         this.addCallback("enableH264ForFlashLite",this,com.google.youtube.players.VideoFormat.enableH264ForFlashLite);
      }
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         this.addCallback("isExperimentActive",this.configData.experiments,this.configData.experiments.isExperimentActive);
         this.addCallback("forceFullscreen",this,this.forceFullscreen);
         this.addCallback("showWatermark",this,this.showWatermark);
         this.addCallback("toggleSubtitles",this,this.toggleSubtitles);
         this.addCallback("updateSubtitleConfig",this,this.updateSubtitleConfig);
         this.addCallback("adSkip",this,this.adSkip);
         this.addCallback("setFeature",this,this.setFeature);
         this.addCallback("setAllowedFormats",this,com.google.youtube.players.VideoFormat.setAllowedFormats);
         this.addCallback("setExplicitVideoSize",this,this.setExplicitVideoSize);
         this.addCallback("setPreloaderVisibility",this,this.setPreloaderVisibility);
         this.addCallback("setThresholds",this.videoPlayer,this.videoPlayer.setThresholds);
      }
      super.addCallbacks();
   }
   function onResize()
   {
      this.overallHolder._visible = true;
      this.resizePlayer(Stage.width,Stage.height);
   }
   function build()
   {
      this.videoPlayer = com.google.youtube.players.VideoPlayer(this.overallHolder.attachMovie(com.google.youtube.players.VideoPlayer.LINK_NAME,"videoPlayer",this.overallHolder.getNextHighestDepth()));
      this.videoPlayer.init(this.configData,this.soundController);
      this.videoPlayer.disableVideoDisplayButton();
      super.build();
      this.largePlayButton = this.videoPlayer.attachMovie("LargeStartPlayButton","largePlayButton",com.google.youtube.players.VideoPlayer.LARGE_PLAY_BUTTON_DEPTH);
      this.largePlayButton.bg._alpha = 70;
      this.largePlayButton.onRelease = com.google.chianti.event.EventDelegate.create(this,this.onLargePlayButtonRelease);
      this.largePlayButton.onRollOver = com.google.chianti.event.EventDelegate.create(this,this.onLargePlayButtonRollOver);
      this.largePlayButton.onRollOut = com.google.chianti.event.EventDelegate.create(this,this.onLargePlayButtonRollOut);
      this.largePlayButton.onReleaseOutside = com.google.chianti.event.EventDelegate.create(this,this.onLargePlayButtonReleaseOutside);
      this.largePlayButton._visible = false;
      this.logo = this.videoPlayer.createEmptyMovieClip("logo",this.videoPlayer.getNextHighestDepth());
      this.logo.attachMovie("YouTubeLogo","logo",this.logo.getNextHighestDepth());
      this.logo._alpha = com.google.youtube.players.chromeless.ChromelessPlayerController.LOGO_ALPHA;
      this.logo.onRelease = com.google.chianti.event.EventDelegate.create(this,this.onLogoRelease);
      var _loc3_ = this.logo.createEmptyMovieClip("hit",this.logo.getNextHighestDepth());
      com.google.youtube.util.Drawing.drawRect(_loc3_,0,0,this.logo._width,this.logo._height,16711680);
      _loc3_._alpha = 0;
      if(this.rootMc._parent == _level0 || this.rootMc == _level0)
      {
         Stage.addListener(this);
         Stage.align = "TL";
         Stage.scaleMode = "noScale";
      }
      else
      {
         this.resizePlayer(com.google.youtube.players.chromeless.ChromelessPlayerController.DEFAULT_WIDTH,com.google.youtube.players.chromeless.ChromelessPlayerController.DEFAULT_HEIGHT);
      }
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         this.videoPlayer.setStopForPreroll();
      }
   }
   function onVideoInfoLoad(evt)
   {
      if(this.configData.eventLabel == com.google.youtube.config.constants.EventLabel.LEANBACK && this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         if(evt.data && typeof evt.data == "object")
         {
            evt.data.adVideoLastTimestamp = this.adVideoLastTimestamp;
         }
      }
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         var _loc4_ = {channelToken:this.getCurrentVideoData().partnerTrackingChannelToken,partnerToken:this.getCurrentVideoData().partnerTrackingToken,adPreRoll:this.getCurrentVideoData().adPreroll};
         this.broadcastExternal({type:"onBrandingOptions",data:_loc4_});
      }
      super.onVideoInfoLoad(evt);
   }
   function getModuleDescriptorsFromVideoData(vd)
   {
      var _loc4_ = super.getModuleDescriptorsFromVideoData(vd);
      var _loc6_ = 0;
      while(_loc6_ < _loc4_.length)
      {
         var _loc5_ = com.google.youtube.players.modules.ModuleDescriptor(_loc4_[_loc6_]);
         if(_loc5_.label == com.google.youtube.players.chromeless.ChromelessPlayerController.SUBTITLE_MODULE_LABEL)
         {
            this.subtitlesModuleDescriptor = com.google.youtube.players.modules.SubtitleModuleDescriptor(_loc5_);
            if(this.configData.playerLayoutStyle != com.google.youtube.config.constants.PlayerStyle.LBL)
            {
               this.subtitlesModuleDescriptor.setEnabled(false);
            }
            break;
         }
         _loc6_ = _loc6_ + 1;
      }
      _loc5_ = new com.google.youtube.players.modules.VastAdsModuleDescriptor();
      _loc5_.path = vd.getVastAdsModulePath();
      _loc5_.setEnabled(true);
      _loc4_.push(_loc5_);
      return _loc4_;
   }
   function getTimeSinceLastUserAction()
   {
      return !_global.isNaN(this.lastUserAction) ? getTimer() - this.lastUserAction : -1;
   }
   function setLastUserAction()
   {
      this.lastUserAction = getTimer();
   }
   function toggleSubtitles()
   {
      this.subtitlesModuleDescriptor.toggleState();
   }
   function updateSubtitleConfig(config)
   {
      this.configData.interfaceLanguage = com.google.youtube.util.Messages.parseLocale(config.interfaceLanguage);
      this.configData.overrideInterfaceLanguage = config.overrideInterfaceLanguage;
      this.configData.ccLoadPolicy = config.ccLoadPolicy;
      this.configData.ccFontConfig = config.ccFontConfig;
   }
   function onVideoInfoError(evt)
   {
      this.broadcastExternalError(evt.errorCode,evt.description);
   }
   function onAdModuleEvent(evt)
   {
      switch(evt.type)
      {
         case com.google.youtube.event.ModuleEvent.AD_COMPLETE:
            this.setAdsTimestamp(new Date().getTime() / 1000);
         case com.google.youtube.event.ModuleEvent.AD_ERROR:
         case com.google.youtube.event.ModuleEvent.AD_LOADED:
         case com.google.youtube.event.ModuleEvent.AD_PLAYED:
         case com.google.youtube.event.ModuleEvent.AD_PROGRESS:
            var _loc3_ = evt.data || "";
            _loc3_ += (!_loc3_.length ? "" : "&") + "type=" + evt.type;
            this.broadcastExternal({type:"onAdModuleEvent",data:_loc3_});
      }
      if(evt.type == com.google.youtube.event.ModuleEvent.AD_LOADED)
      {
         this.videoPlayer.onPrerollLoaded();
      }
   }
   function onSubtitlesModuleEvent(event)
   {
      var _loc3_ = {type:event.type,data:{available:event.data.available,action:event.type}};
      this.broadcastExternal(_loc3_);
   }
   function setAdsTimestamp(timestamp)
   {
      this.adVideoLastTimestamp = timestamp;
   }
   function forceFullscreen()
   {
      this.configData.forceFullscreen = true;
   }
   function showWatermark(url, fullOpacity)
   {
      this.watermark.useFullOpacity = fullOpacity;
      if(url)
      {
         this.watermark.useUrl(url);
      }
      else
      {
         this.updateWatermark();
      }
      this.positionWatermark();
   }
   function adSkip()
   {
      this.broadcast({type:com.google.youtube.event.GenericButtonEvent.AD_SKIP});
   }
   function getReservedRect()
   {
      var _loc3_ = super.getReservedRect();
      if(this.configData.playerLayoutStyle == com.google.youtube.config.constants.PlayerStyle.LBL)
      {
         _loc3_.height = Math.max(_loc3_.height,com.google.youtube.players.chromeless.ChromelessPlayerController.CAPTIONS_PADDING);
      }
      return _loc3_;
   }
}

@ftde0
Copy link
Owner

ftde0 commented Mar 21, 2024

just had a quick look and you can also attach the apiplayer you provided to the 2KB request flash (apiplayer.swf) by setting the path to the wii apiplayer in apiplayer.swf as described above. try doing that.

@RedFireMRT84
Copy link
Author

RedFireMRT84 commented Mar 21, 2024

i did that, but i still receive the server error on the wii, its either the youtube channel itself doing the https again, since the channel cannot do https but http only, probably because i patched the wad, due to the certificates in the content2 u8 archive, the leanbacklite wii ,or apiplayer itself is causing this problem.
heres my package containing the files from the wad's 2nd content u8 archive that i got extracted:
00000002.app_OUT.zip

@RedFireMRT84
Copy link
Author

RedFireMRT84 commented Mar 21, 2024

also the real question is that do u really know why the leanbacklite_wii plays videos on a computer web browser but not on macromedia flash 8 player, wii youtube app or the wii's opera browser?
here are my
wii.zip
modified apiplayers.

@RedFireMRT84
Copy link
Author

btw, heres my live traffic
windows web browser:
image

macromedia flash 8 player from macromedia flash 8 and wii:
image

@ftde0
Copy link
Owner

ftde0 commented Mar 22, 2024

looks like flash player 8 has trouble playing back h264 MP4s (which is what is provided by default as videos start playing fast). FLVs are also supported by yt2009 and can be used in cases like those, but as videos need to be converted from MP4 to FLV before playback it can take a while for an FLV URL to play.

based on that info, we can force FLVs to be used within the apiplayer.
to do so, look up playStreamInPing in apiplayer's code and make it always request a FLV.

so,
playstreamdef

becomes

playstreamforce

/get_video?video_id=... will request a FLV, while
/get_video?video_id=.../mp4 will request an H264 MP4 - default.

this enables playback on flash 8. i don't have a wii/wii environment to test unfortunately, so hopefully this gets it working there as well.

flash8

@RedFireMRT84
Copy link
Author

also, which script has something on where u this (http://[]) just redirects to the main page? i wanna it to redirect to (/main/main.html) instead of this page:
image

@RedFireMRT84
Copy link
Author

RedFireMRT84 commented Mar 22, 2024

the api player does play on the flv format, but only on web browsers on the pc. however for some reason though, on the wiis opera browser or other browsers, not the youtube channel but its browser, only sends a h264 format, and the flv conversion fails. on the "watch.swf", yes the mp4 converts itself to a flv finally and plays on the wii. but im not really worrying about that, im worrying about the apiplayer itself that has a hundred kilobytes.

also i was talking about playing videos on a flash player 8 emulator executable that comes with the macromedia flash 8 professional, not on the browser.

@RedFireMRT84
Copy link
Author

instead of using magick and ffmpeg to download videos, for the get_video?video_id= to happen, i want a google video playback url and the only maximum quality is 480p

@ftde0
Copy link
Owner

ftde0 commented Mar 27, 2024

/player responses (that have googlevideo URLs):

  • non-DASH are limited to 360p and 720p (not available all the time as well),
  • don't return FLVs
  • other qualities have video and sound separated into separate URLs
  • are IP and time restricted
  • can randomly go down if handled improperly

for those reasons straight up giving googlevideo URLs through yt2009 is unsuitable and won't be happening.

@RedFireMRT84
Copy link
Author

RedFireMRT84 commented Apr 21, 2024

may i have another package of the apiplayer that is from after november 15th 2012 or during sometime in 2013?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants