@@ -70,15 +70,19 @@ public function mainAction(): ResponseInterface
7070 */
7171 protected function getVideoInfo (AbstractDocument $ doc , int $ pageNo ): ?array
7272 {
73- $ videoFileGrps = GeneralUtility::trimExplode (', ' , $ this ->extConf ['files ' ]['fileGrpVideo ' ]);
74- $ mainVideoFileGrp = $ videoFileGrps [0 ] ?? '' ;
73+ // Get video file use groups
74+ $ videoUseGroups = $ this ->useGroupsConfiguration ->getVideo ();
75+ $ mainVideoUseGroup = $ videoUseGroups [0 ] ?? '' ;
7576
76- $ thumbFileGroups = GeneralUtility::trimExplode (', ' , $ this ->extConf ['files ' ]['fileGrpThumbs ' ]);
77- $ waveformFileGroups = GeneralUtility::trimExplode (', ' , $ this ->extConf ['files ' ]['fileGrpWaveform ' ]);
77+ // Get thumbnail file use groups
78+ $ thumbnailUseGroups = $ this ->useGroupsConfiguration ->getThumbnail ();
79+
80+ // Get waveform file use groups
81+ $ waveformUseGroups = $ this ->useGroupsConfiguration ->getWaveform ();
7882
7983 // Collect video file source URLs
8084 // TODO: This is for multiple sources (MPD, HLS, MP3, ...) - revisit, make sure it's ordered by preference!
81- $ videoSources = $ this ->collectVideoSources ($ doc , $ pageNo , $ videoFileGrps );
85+ $ videoSources = $ this ->collectVideoSources ($ doc , $ pageNo , $ videoUseGroups );
8286 if (empty ($ videoSources )) {
8387 return null ;
8488 }
@@ -87,11 +91,11 @@ protected function getVideoInfo(AbstractDocument $doc, int $pageNo): ?array
8791 $ videoChapters = $ this ->collectVideoChapters ($ doc );
8892
8993 // Get additional video URLs
90- $ videoUrl = $ this ->collectAdditionalVideoUrls ($ doc , $ pageNo , $ thumbFileGroups , $ waveformFileGroups );
94+ $ videoUrl = $ this ->collectAdditionalVideoUrls ($ doc , $ pageNo , $ thumbnailUseGroups , $ waveformUseGroups );
9195
9296 return [
9397 'start ' => $ videoChapters [$ pageNo - 1 ]['timecode ' ] ?? '' ,
94- 'mode ' => $ this ->determineInitialMode ($ videoSources , $ mainVideoFileGrp ),
98+ 'mode ' => $ this ->determineInitialMode ($ videoSources , $ mainVideoUseGroup ),
9599 'chapters ' => $ videoChapters ,
96100 'metadata ' => $ doc ->getToplevelMetadata ($ this ->settings ['storagePid ' ]),
97101 'sources ' => $ videoSources ,
@@ -104,13 +108,13 @@ protected function getVideoInfo(AbstractDocument $doc, int $pageNo): ?array
104108 *
105109 * @param AbstractDocument $doc The document object to collect video sources from
106110 * @param int $pageNo The page number to collect video sources for
107- * @param array $videoFileGrps The array of video file groups to search for video sources
111+ * @param array $videoUseGroups The array of video use groups to search for video sources
108112 * @return array An array of video sources with details like MIME type, URL, file ID, and frame rate
109113 */
110- private function collectVideoSources (AbstractDocument $ doc , int $ pageNo , array $ videoFileGrps ): array
114+ private function collectVideoSources (AbstractDocument $ doc , int $ pageNo , array $ videoUseGroups ): array
111115 {
112116 $ videoSources = [];
113- $ videoFiles = $ this ->findFiles ($ doc , $ pageNo , $ videoFileGrps );
117+ $ videoFiles = $ this ->findFiles ($ doc , $ pageNo , $ videoUseGroups );
114118 foreach ($ videoFiles as $ videoFile ) {
115119 if ($ this ->isMediaMime ($ videoFile ['mimeType ' ])) {
116120 $ fileMetadata = $ doc ->getMetadata ($ videoFile ['fileId ' ], $ this ->settings ['storagePid ' ]);
@@ -128,18 +132,18 @@ private function collectVideoSources(AbstractDocument $doc, int $pageNo, array $
128132 }
129133
130134 /**
131- * Determine the initial mode (video or audio) based on the provided video sources and the main video file group.
135+ * Determine the initial mode (video or audio) based on the provided video sources and the main video use group.
132136 *
133137 * @param array $videoSources An array of video sources with details like MIME type, URL, file ID, and frame rate
134- * @param string $mainVideoFileGrp The main video file group to prioritize
138+ * @param string $mainVideoUseGroup The main video use group to prioritize
135139 * @return string The initial mode ('video' or 'audio')
136140 */
137- private function determineInitialMode (array $ videoSources , string $ mainVideoFileGrp ): string
141+ private function determineInitialMode (array $ videoSources , string $ mainVideoUseGroup ): string
138142 {
139143 foreach ($ videoSources as $ videoSource ) {
140144 // TODO: Better guess of initial mode?
141145 // Perhaps we could look for VIDEOMD/AUDIOMD in METS
142- if ($ videoSource ['fileGrp ' ] === $ mainVideoFileGrp || strpos ($ videoSource ['mimeType ' ], 'video/ ' ) === 0 ) {
146+ if ($ videoSource ['fileGrp ' ] === $ mainVideoUseGroup || strpos ($ videoSource ['mimeType ' ], 'video/ ' ) === 0 ) {
143147 return 'video ' ;
144148 }
145149 }
@@ -162,29 +166,29 @@ private function collectVideoChapters(AbstractDocument $doc): array
162166 }
163167
164168 /**
165- * Collects additional video URLs like poster and waveform for a given document, page number, thumb file groups, and waveform file groups.
169+ * Collects additional video URLs like poster and waveform for a given document, page number, thumb file use groups, and waveform file use groups.
166170 *
167171 * @param AbstractDocument $doc The document object
168172 * @param int $pageNo The page number
169- * @param array $thumbFileGroups An array of thumb file groups
170- * @param array $waveformFileGroups An array of waveform file groups
173+ * @param array $thumbnailUseGroups An array of thumb file use groups
174+ * @param array $waveformUseGroups An array of waveform file use groups
171175 * @return array An array containing additional video URLs like poster and waveform
172176 */
173- private function collectAdditionalVideoUrls (AbstractDocument $ doc , int $ pageNo , array $ thumbFileGroups , array $ waveformFileGroups ): array
177+ private function collectAdditionalVideoUrls (AbstractDocument $ doc , int $ pageNo , array $ thumbnailUseGroups , array $ waveformUseGroups ): array
174178 {
175179 $ videoUrl = [];
176- if (!empty ($ thumbFiles = $ this ->findFiles ($ doc , 0 , $ thumbFileGroups )) // 0 = for whole video (not just chapter)
180+ if (!empty ($ thumbFiles = $ this ->findFiles ($ doc , 0 , $ thumbnailUseGroups )) // 0 = for whole video (not just chapter)
177181 && $ this ->settings ['constants ' ]['showPoster ' ] == 1 ) {
178182 $ videoUrl ['poster ' ] = $ thumbFiles [0 ];
179183 }
180- if (!empty ($ waveformFiles = $ this ->findFiles ($ doc , $ pageNo , $ waveformFileGroups ))) {
184+ if (!empty ($ waveformFiles = $ this ->findFiles ($ doc , $ pageNo , $ waveformUseGroups ))) {
181185 $ videoUrl ['waveform ' ] = $ waveformFiles [0 ];
182186 }
183187 return $ videoUrl ;
184188 }
185189
186190 /**
187- * Find files of the given file groups that are referenced on a page.
191+ * Find files of the given file use groups that are referenced on a page.
188192 *
189193 * @param AbstractDocument $doc
190194 * @param int $pageNo
0 commit comments