class Yt::Annotations::EndScreen

An end screen annotation shows in the last 5 to seconds of the video.

Public Class Methods

new(json = {}) click to toggle source

@param [Hash] json the Hash representation of the XML data returned by

YouTube for each end screen of a video.
# File lib/yt/annotations/end_screen.rb, line 9
def initialize(json = {})
  @text = text_in json
  @starts_at = json['startMs'].to_i / 1000.0
  @ends_at = ends_at_in json
  @link = to_link json
end

Private Instance Methods

ends_at_in(json) click to toggle source
# File lib/yt/annotations/end_screen.rb, line 22
def ends_at_in(json)
  json['endMs'].to_i / 1000.0
end
new_window(type) click to toggle source
# File lib/yt/annotations/end_screen.rb, line 70
def new_window(type)
  %w(WEBSITE CHANNEL).include? type
end
text_in(json) click to toggle source
# File lib/yt/annotations/end_screen.rb, line 18
def text_in(json)
  json['title']['simpleText']
end