class M3U8::PlaylistItem
- M3U8::PlaylistItem
- Reference
- Object
Overview
PlaylistItem represents a set of EXT-X-STREAM-INF or EXT-X-I-FRAME-STREAM-INF attributes
Included Modules
- M3U8::Concern
Extended Modules
- M3U8::Concern
Defined in:
m3u8/playlist_item.crConstructors
-
.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)
- .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)
Class Method Summary
-
.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......>
Instance Method Summary
- #audio : String | Nil
- #audio=(audio : String | Nil)
- #average_bandwidth : Int32 | Nil
- #average_bandwidth=(average_bandwidth : Int32 | Nil)
- #bandwidth : Int32 | Nil
- #bandwidth=(bandwidth : Int32 | Nil)
- #closed_captions : String | Nil
- #closed_captions=(closed_captions : String | Nil)
- #codecs : Codecs
- #codecs=(codecs : Codecs)
- #frame_rate : Float64 | Nil
- #frame_rate=(frame_rate : Float64 | Nil)
- #hdcp_level : String | Nil
- #hdcp_level=(hdcp_level : String | Nil)
- #height : Int32 | Nil
- #height=(height : Int32 | Nil)
- #iframe : Bool
- #iframe=(iframe : Bool)
- #name : String | Nil
- #name=(name : String | Nil)
- #program_id : Int32 | Nil
- #program_id=(program_id : Int32 | Nil)
-
#resolution
options = { width: 1920, height: 1080, } item = PlaylistItem.new(options) item.resolution # => 1920x1080
- #subtitles : String | Nil
- #subtitles=(subtitles : String | Nil)
-
#to_s
- #uri : String | Nil
- #uri=(uri : String | Nil)
- #video : String | Nil
- #video=(video : String | Nil)
- #width : Int32 | Nil
- #width=(width : Int32 | Nil)
Constructor Detail
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)
Class Method Detail
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......>
Instance Method Detail
options = {
width: 1920,
height: 1080,
}
item = PlaylistItem.new(options)
item.resolution # => 1920x1080
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"