spec/lib/m3u8/reader_spec.rb in m3u8-0.6.9 vs spec/lib/m3u8/reader_spec.rb in m3u8-0.7.0
- old
+ new
@@ -5,16 +5,22 @@
file = File.open 'spec/fixtures/master.m3u8'
reader = M3u8::Reader.new
playlist = reader.read file
expect(playlist.master?).to be true
+ expect(playlist.independent_segments).to be true
+
item = playlist.items[0]
expect(item).to be_a(M3u8::SessionKeyItem)
expect(item.method).to eq('AES-128')
expect(item.uri).to eq('https://priv.example.com/key.php?r=52')
item = playlist.items[1]
+ expect(item).to be_a(M3u8::PlaybackStart)
+ expect(item.time_offset).to eq(20.2)
+
+ item = playlist.items[2]
expect(item).to be_a(M3u8::PlaylistItem)
expect(item.uri).to eq('hls/1080-7mbps/1080-7mbps.m3u8')
expect(item.program_id).to eq('1')
expect(item.width).to eq(1920)
expect(item.height).to eq(1080)
@@ -22,11 +28,11 @@
expect(item.codecs).to eq('avc1.640028,mp4a.40.2')
expect(item.bandwidth).to eq(5_042_000)
expect(item.iframe).to be false
expect(item.average_bandwidth).to be_nil
- item = playlist.items[6]
+ item = playlist.items[7]
expect(item).to be_a(M3u8::PlaylistItem)
expect(item.uri).to eq('hls/64k/64k.m3u8')
expect(item.program_id).to eq('1')
expect(item.width).to be_nil
expect(item.height).to be_nil
@@ -34,11 +40,11 @@
expect(item.codecs).to eq('mp4a.40.2')
expect(item.bandwidth).to eq(6400)
expect(item.iframe).to be false
expect(item.average_bandwidth).to be_nil
- expect(playlist.items.size).to eq(7)
+ expect(playlist.items.size).to eq(8)
item = playlist.items.last
expect(item.resolution).to be_nil
end
@@ -172,15 +178,15 @@
it 'should process multiple reads as separate playlists' do
file = File.open 'spec/fixtures/master.m3u8'
reader = M3u8::Reader.new
playlist = reader.read file
- expect(playlist.items.size).to eq(7)
+ expect(playlist.items.size).to eq(8)
file = File.open 'spec/fixtures/master.m3u8'
playlist = reader.read file
- expect(playlist.items.size).to eq(7)
+ expect(playlist.items.size).to eq(8)
end
it 'should parse playlist with session data' do
file = File.open 'spec/fixtures/session_data.m3u8'
reader = M3u8::Reader.new