From d03fc0c58b0a760bdef17b4e6ef7c59c96562521 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Wed, 17 Jul 2019 22:32:59 -0400 Subject: fixes for audio annotations --- src/client/views/nodes/ImageBox.scss | 18 ++++++++++++++++++ src/client/views/nodes/ImageBox.tsx | 25 +++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ImageBox.scss b/src/client/views/nodes/ImageBox.scss index f1b73a676..697f19f0d 100644 --- a/src/client/views/nodes/ImageBox.scss +++ b/src/client/views/nodes/ImageBox.scss @@ -38,4 +38,22 @@ border: none; width: 100%; height: 100%; +} + +.imageBox-audioBackground { + display: inline-block; + width: 10%; + position: absolute; + top: 0px; + left: 0px; + border-radius: 25px; + background: white; + opacity: 0.3; + svg { + width: 90% !important; + height: 70%; + position: absolute; + left: 5%; + top: 15%; + } } \ No newline at end of file diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index ebe3732e6..7daed86f8 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -284,15 +284,17 @@ export class ImageBox extends DocComponent(ImageD let self = this; let audioAnnos = DocListCast(this.extensionDoc.audioAnnotations); if (audioAnnos.length && this._audioState === 0) { - audioAnnos.map(anno => anno.data instanceof AudioField && new Howl({ + let anno = audioAnnos[Math.floor(Math.random() * audioAnnos.length)]; + anno.data instanceof AudioField && new Howl({ src: [anno.data.url.href], + format: ["mp3"], autoplay: true, loop: false, volume: 0.5, onend: function () { runInAction(() => self._audioState = 0); } - })); + }); this._audioState = 1; } // else { @@ -350,28 +352,23 @@ export class ImageBox extends DocComponent(ImageD return (
{paths.length > 1 ? this.dots(paths) : (null)} -
- +
+
{/* {this.lightbox(paths)} */}
); -- cgit v1.2.3-70-g09d2