From ab23aebeecd5628466ceaa08c0da51c68f2bcba5 Mon Sep 17 00:00:00 2001 From: Nfrederiksen Date: Wed, 27 Nov 2024 10:45:26 +0100 Subject: [PATCH] test: one more coverage --- spec/hls_splice_spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec/hls_splice_spec.js b/spec/hls_splice_spec.js index 25763e6..d5947fd 100644 --- a/spec/hls_splice_spec.js +++ b/spec/hls_splice_spec.js @@ -2069,4 +2069,29 @@ test-audio=256000-6.m4s`; done(); }); }); + + it("can insert interstitial with an asset uri and a resume offset and CUE attribute", (done) => { + const mockVod = new HLSSpliceVod("http://mock.com/mock.m3u8"); + mockVod + .load(mockCmafMasterManifest, mockCmafMediaManifest, mockCmafAudioManifest) + .then(() => { + return mockVod.insertInterstitialAt(18000, "001", "http://mock.com/asseturi", false, { + resumeOffset: 10500, + cue: "POST,ONCE" + }); + }) + .then(() => { + const m3u8 = mockVod.getMediaManifest(4497000); + let lines = m3u8.split("\n"); + expect(lines[129]).toEqual( + '#EXT-X-DATERANGE:ID="001",CLASS="com.apple.hls.interstitial",START-DATE="1970-01-01T00:00:18.001Z",X-ASSET-URI="http://mock.com/asseturi",CUE="POST,ONCE",X-RESUME-OFFSET=10.5' + ); + const m3u8Audio = mockVod.getAudioManifest("stereo", "sv"); + lines = m3u8Audio.split("\n"); + expect(lines[195]).toEqual( + '#EXT-X-DATERANGE:ID="001",CLASS="com.apple.hls.interstitial",START-DATE="1970-01-01T00:00:18.001Z",X-ASSET-URI="http://mock.com/asseturi",CUE="POST,ONCE",X-RESUME-OFFSET=10.5' + ); + done(); + }); + }); });