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 : Int32 | Nil = nil, height : Int32 | Nil = nil, bandwidth : Int32 | Nil = nil, video : Nil | String = nil, audio : Nil | String = nil, uri : Nil | String = nil, average_bandwidth : Int32 | Nil = nil, subtitles : Nil | String = nil, closed_captions : Nil | String = nil, iframe = nil, frame_rate = nil, name : Nil | String = nil, hdcp_level : Nil | String = 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 | Nil #

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

[View source]
def average_bandwidth : Int32 | Nil #

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

[View source]
def bandwidth : Int32 | Nil #

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

[View source]
def closed_captions : String | Nil #

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

[View source]
def codecs : Codecs #

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

[View source]
def frame_rate : Float64 | Nil #

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

[View source]
def hdcp_level : String | Nil #

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

[View source]
def height : Int32 | Nil #

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

[View source]
def iframe : Bool #

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

[View source]
def name : String | Nil #

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

[View source]
def program_id : Int32 | Nil #

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

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

[View source]
def subtitles : String | Nil #

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

[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 | Nil #

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

[View source]
def video : String | Nil #

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

[View source]
def width : Int32 | Nil #

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

[View source]