Class: Yt::Models::LiveStreamingDetail

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/live_streaming_detail.rb

Overview

Encapsulates information about a live video broadcast. The object will only be present in a video resource if the video is an upcoming, live, or completed live broadcast.

Instance Method Summary collapse

Methods included from Associations::HasReports

#has_report

Methods included from Associations::HasViewerPercentages

#has_viewer_percentages

Methods included from Associations::HasOne

#has_one

Methods included from Associations::HasMany

#has_many

Methods included from Associations::HasAuthentication

#has_authentication

Constructor Details

#initialize(options = {}) ⇒ LiveStreamingDetail

Returns a new instance of LiveStreamingDetail.



11
12
13
# File 'lib/yt/models/live_streaming_detail.rb', line 11

def initialize(options = {})
  @data = options[:data] || {}
end

Instance Method Details

#actual_end_timeTime?

Returns:

  • (Time)

    if the broadcast is over, the time that the broadcast actually ended.

  • (nil)

    if the broadcast is not over.



27
28
29
30
31
# File 'lib/yt/models/live_streaming_detail.rb', line 27

def actual_end_time
  @actual_end_time ||= if @data['actualEndTime']
    Time.parse @data['actualEndTime']
  end
end

#actual_start_timeTime?

Returns:

  • (Time)

    if the broadcast has begun, the time that the broadcast actually started.

  • (nil)

    if the broadcast has not begun.



18
19
20
21
22
# File 'lib/yt/models/live_streaming_detail.rb', line 18

def actual_start_time
  @actual_start_time ||= if @data['actualStartTime']
    Time.parse @data['actualStartTime']
  end
end

#concurrent_viewersInteger?

Returns:

  • (Integer)

    if the broadcast has current viewers and the broadcast owner has not hidden the viewcount for the video, the number of viewers currently watching the broadcast.

  • (nil)

    if the broadcast has ended or the broadcast owner has hidden the viewcount for the video.



54
55
56
57
58
# File 'lib/yt/models/live_streaming_detail.rb', line 54

def concurrent_viewers
  @concurrent_viewers ||= if @data['concurrentViewers']
    @data['concurrentViewers'].to_i
  end
end

#scheduled_end_timeTime?

Returns:

  • (Time)

    if the broadcast is scheduled to end, the time that the broadcast is scheduled to end.

  • (nil)

    if the broadcast is scheduled to continue indefinitely.



43
44
45
46
47
# File 'lib/yt/models/live_streaming_detail.rb', line 43

def scheduled_end_time
  @scheduled_end_time ||= if @data['scheduledEndTime']
    Time.parse @data['scheduledEndTime']
  end
end

#scheduled_start_timeTime

Returns the time that the broadcast is scheduled to begin.

Returns:

  • (Time)

    the time that the broadcast is scheduled to begin.



34
35
36
37
38
# File 'lib/yt/models/live_streaming_detail.rb', line 34

def scheduled_start_time
  @scheduled_start_time ||= if @data['scheduledStartTime']
    Time.parse @data['scheduledStartTime']
  end
end