public void testParsingByteOrderMark() { using (Stream inputStream = wrapWithByteOrderMark(TestUtil.inputStreamFromResource("simpleMediaPlaylist.m3u8"))) { PlaylistParser playlistParser = new PlaylistParser(inputStream, Format.EXT_M3U, Encoding.UTF_8); Playlist playlist = playlistParser.parse(); Assert.Equal(10, playlist.getMediaPlaylist().getTargetDuration()); } }
public void testParsingMultiplePlaylists() { using (Stream inputStream = TestUtil.inputStreamFromResource("twoMediaPlaylists.m3u8")) { PlaylistParser parser = new PlaylistParser(inputStream, Format.EXT_M3U, Encoding.UTF_8); Assert.True(parser.isAvailable()); Playlist playlist1 = parser.parse(); Assert.True(parser.isAvailable()); Playlist playlist2 = parser.parse(); Assert.False(parser.isAvailable()); List <TrackData> expected1 = new List <TrackData>() { makeTrackData("http://media.example.com/first.ts", 9.009f), makeTrackData("http://media.example.com/second.ts", 9.009f), makeTrackData("http://media.example.com/third.ts", 3.003f) }; var actual1 = playlist1.getMediaPlaylist().getTracks(); Assert.Equal( expected1, actual1); Assert.Equal( new List <TrackData>() { makeTrackData("http://media.example.com/fourth.ts", 9.01f), makeTrackData("http://media.example.com/fifth.ts", 9.011f) }, playlist2.getMediaPlaylist().getTracks()); // Assert.Equal(0, inputStream.available()); // TODO: Why? And what's the c# equivalent } }