function SetCaptions(metadata as object, videoPlayer as object, contentNode as object) as void ' TODO: check if we have caption settings ON ' TODO: read favorate language from system settings ' TODO: populate list of caption tracks if metadata.captions.Count() = 0 return end if videoPlayer.globalCaptionMode = "ON" contentNode.ClosedCaptions = True selectedCaption = metadata.captions[0] ' Use favorite caption langauage, or the first one for each caption in metadata.captions if caption.language_code = "en" selectedCaption = caption exit for end if end for contentNode.SubtitleConfig = { ShowSubtitle: 1, TrackName: InvidiousSettings.GetSelectedInstance() + selectedCaption.url } end function