Class: YouTubeG::Model::Video::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/youtube_g/model/video.rb

Overview

Describes the various file formats in which a Youtube video may be made available and allows looking them up by format code number.

Constant Summary collapse

FLASH =

Flash format on YouTube site. All videos are available in this format.

YouTubeG::Model::Video::Format.new(0, :flash)
RTSP =

RTSP streaming URL for mobile video playback. H.263 video (176x144) and AMR audio.

YouTubeG::Model::Video::Format.new(1, :rtsp)
SWF =

HTTP URL to the embeddable player (SWF) for this video. This format is not available for a video that is not embeddable.

YouTubeG::Model::Video::Format.new(5, :swf)
THREE_GPP =

RTSP streaming URL for mobile video playback. MPEG-4 SP video (up to 176x144) and AAC audio.

YouTubeG::Model::Video::Format.new(6, :three_gpp)
@@formats =
Hash.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format_code, name) ⇒ Format

Instantiates a new video format object.

Parameters

:format_code<Fixnum>:: The Youtube Format code of the object. 
:name<Symbol>:: The name of the format

Returns

YouTubeG::Model::Video::Format: Video format object


22
23
24
25
26
27
# File 'lib/youtube_g/model/video.rb', line 22

def initialize(format_code, name)
  @format_code = format_code
  @name = name

  @@formats[format_code] = self          
end

Class Method Details

.by_code(format_code) ⇒ Object

Allows you to get the video format for a specific format code.

A full list of format codes is available at:

code.google.com/apis/youtube/reference.html#youtube_data_api_tag_media:content

Parameters

:format_code<Fixnum>:: The Youtube Format code of the object.

Returns

YouTubeG::Model::Video::Format: Video format object


40
41
42
# File 'lib/youtube_g/model/video.rb', line 40

def self.by_code(format_code)
  @@formats[format_code]
end