@@ -9,6 +9,7 @@ import { Vault } from "@iiif/vault";
99import { ViewerProvider } from "src/context/viewer-context" ;
1010import manifestSimpleAudio from "src/fixtures/viewer/player/manifest-simple-audio.json" ;
1111import manifestStreaming from "src/fixtures/viewer/player/manifest-streaming-audio.json" ;
12+ import Hls from "hls.js" ;
1213
1314describe ( "Player component" , ( ) => {
1415 let originalLoad : any ;
@@ -82,6 +83,69 @@ describe("Player component", () => {
8283 expect ( screen . getByRole ( "presentation" ) ) . toBeInTheDocument ( ) ;
8384 } ) ;
8485
86+ it ( "renders the Player component for a streaming audio file even if a parameter is at the end, loading hls" , async ( ) => {
87+ const allSources = [
88+ {
89+ id : "https://meadow-streaming.rdc-staging.library.northwestern.edu/03/4a/07/03/-b/4d/3-/48/62/-b/fd/f-/85/f5/ba/8e/d1/40/034a0703-b4d3-4862-bfdf-85f5ba8ed140.m3u8?test=1" ,
90+ type : "Sound" ,
91+ format : "application/x-mpegurl" ,
92+ height : 100 ,
93+ width : 100 ,
94+ duration : 268.776 ,
95+ } ,
96+ ] ;
97+
98+ const painting = {
99+ id : "https://meadow-streaming.rdc-staging.library.northwestern.edu/03/4a/07/03/-b/4d/3-/48/62/-b/fd/f-/85/f5/ba/8e/d1/40/034a0703-b4d3-4862-bfdf-85f5ba8ed140.m3u8?test=1" ,
100+ type : "Sound" ,
101+ format : "application/x-mpegurl" ,
102+ height : 100 ,
103+ width : 100 ,
104+ duration : 268.776 ,
105+ } ;
106+
107+ const annotationResources = [ ] ;
108+
109+ const props = {
110+ allSources : allSources as LabeledIIIFExternalWebResource [ ] ,
111+ painting : painting as LabeledIIIFExternalWebResource ,
112+ annotationResources : annotationResources as AnnotationResources ,
113+ } ;
114+
115+ const hlsSpy = vi . spyOn ( Hls . prototype , "attachMedia" ) ;
116+
117+ const vault = new Vault ( ) ;
118+ await vault . loadManifest ( "" , manifestStreaming ) ;
119+
120+ render (
121+ < ViewerProvider
122+ initialState = { {
123+ activeCanvas :
124+ "https://dcapi.rdc-staging.library.northwestern.edu/api/v2/works/d2a423b1-6b5e-45cb-9956-46a99cd62cfd?as=iiif/canvas/access/0" ,
125+ activeManifest :
126+ "https://dcapi.rdc-staging.library.northwestern.edu/api/v2/works/d2a423b1-6b5e-45cb-9956-46a99cd62cfd?as=iiif" ,
127+ collection : { } ,
128+ configOptions : { } ,
129+ customDisplays : [ ] ,
130+ isInformationOpen : false ,
131+ isLoaded : false ,
132+ vault,
133+ openSeadragonViewer : null ,
134+ } }
135+ >
136+ < Player { ...props } />
137+ </ ViewerProvider > ,
138+ ) ;
139+
140+ expect ( screen . getByTestId ( "player-wrapper" ) ) . toBeInTheDocument ( ) ;
141+
142+ // Test for the audio visualizer
143+ expect ( screen . getByRole ( "presentation" ) ) . toBeInTheDocument ( ) ;
144+
145+ // Test for Hls Attach
146+ expect ( hlsSpy ) . toHaveBeenCalled ( ) ;
147+ } ) ;
148+
85149 it ( "renders the Player component for a standard audio file" , async ( ) => {
86150 const allSources = [
87151 {
0 commit comments