bloom-player 2.15.2 → 2.16.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bloomPlayer-DZmRaLMc.css → bloomPlayer-XPqbUuvA.css} +1 -1
- package/dist/{bloomPlayer.B8cIzLLQ.js → bloomPlayer.DULzZOJ6.js} +40 -40
- package/dist/bloomplayer.htm +2 -2
- package/lib/animation.d.ts +50 -0
- package/lib/index.d.ts +1 -0
- package/lib/narration.d.ts +1 -1
- package/lib/shared.es.js +3569 -3294
- package/lib/shared.es.js.map +1 -1
- package/package.json +1 -1
- package/src/shared/index.ts +3 -0
- package/src/shared/narration.ts +24 -8
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A library for displaying Bloom books in iframes or WebViews",
|
|
4
4
|
"author": "SIL Global",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.16.0-alpha.2",
|
|
7
7
|
"private": false,
|
|
8
8
|
"// sideeffects might need to be ['*.css'] to avoid 'shaking' our CSS, if we ever get tree shaking working": "",
|
|
9
9
|
"sideEffects": false,
|
package/src/shared/index.ts
CHANGED
package/src/shared/narration.ts
CHANGED
|
@@ -250,12 +250,15 @@ let audioPlayCurrentStartTime: number | null = null; // milliseconds (since 1970
|
|
|
250
250
|
|
|
251
251
|
// Roughly equivalent to BloomDesktop's AudioRecording::listen() function.
|
|
252
252
|
// As long as there is audio on the page, this method will play it.
|
|
253
|
-
export function playAllSentences(
|
|
253
|
+
export function playAllSentences(
|
|
254
|
+
page: HTMLElement | null,
|
|
255
|
+
canvasToExclude?: HTMLElement,
|
|
256
|
+
): void {
|
|
254
257
|
if (!page && !currentPlayPage) {
|
|
255
258
|
return; // this shouldn't happen
|
|
256
259
|
}
|
|
257
260
|
const pageToPlay = page ?? currentPlayPage!;
|
|
258
|
-
playAllAudio(getPageAudioElements(pageToPlay), pageToPlay);
|
|
261
|
+
playAllAudio(getPageAudioElements(pageToPlay, canvasToExclude), pageToPlay);
|
|
259
262
|
}
|
|
260
263
|
|
|
261
264
|
export function playAllAudio(elements: HTMLElement[], page: HTMLElement): void {
|
|
@@ -1125,26 +1128,39 @@ function findAll(
|
|
|
1125
1128
|
: allMatches.filter((match) => !isImageDescriptionSegment(match));
|
|
1126
1129
|
}
|
|
1127
1130
|
|
|
1128
|
-
function getPlayableDivs(
|
|
1131
|
+
function getPlayableDivs(
|
|
1132
|
+
container: HTMLElement,
|
|
1133
|
+
canvasToExclude?: HTMLElement,
|
|
1134
|
+
) {
|
|
1129
1135
|
// We want to play any audio we have from divs the user can see.
|
|
1130
1136
|
// This is a crude test, but currently we always use display:none to hide unwanted languages.
|
|
1131
|
-
|
|
1137
|
+
var results = findAll(".bloom-editable", container).filter(
|
|
1132
1138
|
(e) => window.getComputedStyle(e).display !== "none",
|
|
1133
1139
|
);
|
|
1140
|
+
if (canvasToExclude) {
|
|
1141
|
+
results = results.filter((e) => !canvasToExclude.contains(e));
|
|
1142
|
+
}
|
|
1143
|
+
return results;
|
|
1134
1144
|
}
|
|
1135
1145
|
|
|
1136
1146
|
// Optional param is for use when 'playerPage' has NOT been initialized.
|
|
1137
1147
|
// Not using the optional param assumes 'playerPage' has been initialized
|
|
1138
|
-
function getPagePlayableDivs(
|
|
1139
|
-
|
|
1148
|
+
function getPagePlayableDivs(
|
|
1149
|
+
page?: HTMLElement,
|
|
1150
|
+
canvasToExclude?: HTMLElement,
|
|
1151
|
+
): HTMLElement[] {
|
|
1152
|
+
return getPlayableDivs(page ? page : currentPlayPage!, canvasToExclude);
|
|
1140
1153
|
}
|
|
1141
1154
|
|
|
1142
1155
|
// Optional param is for use when 'playerPage' has NOT been initialized.
|
|
1143
1156
|
// Not using the optional param assumes 'playerPage' has been initialized
|
|
1144
|
-
function getPageAudioElements(
|
|
1157
|
+
function getPageAudioElements(
|
|
1158
|
+
page?: HTMLElement,
|
|
1159
|
+
canvasToExclude?: HTMLElement,
|
|
1160
|
+
): HTMLElement[] {
|
|
1145
1161
|
return [].concat.apply(
|
|
1146
1162
|
[],
|
|
1147
|
-
getPagePlayableDivs(page).map((x) =>
|
|
1163
|
+
getPagePlayableDivs(page, canvasToExclude).map((x) =>
|
|
1148
1164
|
findAll(".audio-sentence", x, true),
|
|
1149
1165
|
),
|
|
1150
1166
|
);
|