class M3U8::PlaylistItem

Overview

PlaylistItem represents a set of EXT-X-STREAM-INF or EXT-X-I-FRAME-STREAM-INF attributes

Included Modules

Extended Modules

Defined in:

m3u8/playlist_item.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(params : NamedTuple = NamedTuple.new) #
options = {
  program_id:        1,
  width:             1920,
  height:            1080,
  bandwidth:         540,
  video:             "test_video",
  audio:             "test_a",
  uri:               "test.url",
  average_bandwidth: 500,
  subtitles:         "subs",
  closed_captions:   "cc",
  iframe:            true,
  frame_rate:        24.6,
  name:              "test_name",
  hdcp_level:        "TYPE-0",
  codecs:            "avc",
  audio_codec:       "mp3",
  level:             "2",
  profile:           "baseline",
}
PlaylistItem.new(options)

[View source]
def self.new(program_id = nil, width = nil, height = nil, bandwidth = nil, video = nil, audio = nil, uri = nil, average_bandwidth = nil, subtitles = nil, closed_captions = nil, iframe = nil, frame_rate = nil, name = nil, hdcp_level = nil, codecs = nil, audio_codec = nil, level = nil, profile = nil) #
PlaylistItem.new

[View source]

Class Method Detail

def self.parse(value) #
text = %(#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,RESOLUTION=1920x1080,) \
       %(CODECS="avc",BANDWIDTH=540,AVERAGE-BANDWIDTH=500,) \
       %(FRAME-RATE=24.600,HDCP-LEVEL=TYPE-0,AUDIO="test_a",) \
       %(VIDEO="test_video",SUBTITLES="subs",CLOSED-CAPTIONS="cc",) \
       %(NAME="test_name",URI="test.url")
PlaylistItem.parse(text) # => #<M3U8::PlaylistItem......>

[View source]

Instance Method Detail

def audio : String? #

[View source]
def audio=(audio : String?) #

[View source]
def average_bandwidth : Int32? #

[View source]
def average_bandwidth=(average_bandwidth : Int32?) #

[View source]
def bandwidth : Int32? #

[View source]
def bandwidth=(bandwidth : Int32?) #

[View source]
def closed_captions : String? #

[View source]
def closed_captions=(closed_captions : String?) #

[View source]
def codecs : Codecs #

[View source]
def codecs=(codecs : Codecs) #

[View source]
def frame_rate : Float64? #

[View source]
def frame_rate=(frame_rate : Float64?) #

[View source]
def hdcp_level : String? #

[View source]
def hdcp_level=(hdcp_level : String?) #

[View source]
def height : Int32? #

[View source]
def height=(height : Int32?) #

[View source]
def iframe : Bool #

[View source]
def iframe=(iframe : Bool) #

[View source]
def name : String? #

[View source]
def name=(name : String?) #

[View source]
def program_id : Int32? #

[View source]
def program_id=(program_id : Int32?) #

[View source]
def resolution #
options = {
  width:  1920,
  height: 1080,
}
item = PlaylistItem.new(options)
item.resolution # => 1920x1080

[View source]
def subtitles : String? #

[View source]
def subtitles=(subtitles : String?) #

[View source]
def to_s #
options = {
  program_id: 1,
  width: 1920,
  height: 1080,
  bandwidth: 540,
  video: "test_video",
  audio: "test_a",
  uri: "test.url",
  average_bandwidth: 500,
  subtitles: "subs",
  closed_captions: "cc",
  iframe: true,
  frame_rate: 24.6,
  name: "test_name",
  hdcp_level: "TYPE-0",
  codecs: "avc",
  audio_codec: "mp3",
  level: "2",
  profile: "baseline",
}
PlaylistItem.new(options).to_s
# => #EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,RESOLUTION=1920x1080, \
     CODECS="avc",BANDWIDTH=540,AVERAGE-BANDWIDTH=500, \
     FRAME-RATE=24.600,HDCP-LEVEL=TYPE-0,AUDIO="test_a", \
     VIDEO="test_video",SUBTITLES="subs",CLOSED-CAPTIONS="cc", \
     NAME="test_name",URI="test.url"

[View source]
def uri : String? #

[View source]
def uri=(uri : String?) #

[View source]
def video : String? #

[View source]
def video=(video : String?) #

[View source]
def width : Int32? #

[View source]
def width=(width : Int32?) #

[View source]