diff options
author | mehekj <mehek.jethani@gmail.com> | 2022-08-11 13:09:11 -0400 |
---|---|---|
committer | mehekj <mehek.jethani@gmail.com> | 2022-08-11 13:09:11 -0400 |
commit | e611aa3096a9eda6ac94e20c86f263d338533d49 (patch) | |
tree | 2737d472b15e88e2f5640358a21b7a95071d3d99 /src/client/util/DocumentManager.ts | |
parent | 5c4b22b50e4693419daac777669b258b155f6ea9 (diff) | |
parent | 3c08d65a63e04d421954193742a49d539b842c20 (diff) |
Merge branch 'master' into schema-mehek
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r-- | src/client/util/DocumentManager.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index d3ac2f03f..52b643c04 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -12,6 +12,9 @@ import { CollectionFreeFormView } from '../views/collections/collectionFreeForm' import { CollectionView } from '../views/collections/CollectionView'; import { ScriptingGlobals } from './ScriptingGlobals'; import { SelectionManager } from './SelectionManager'; +import { listSpec } from '../../fields/Schema'; +import { AudioField } from '../../fields/URLField'; +const { Howl } = require('howler'); export class DocumentManager { //global holds all of the nodes (regardless of which collection they're in) @@ -186,6 +189,20 @@ export class DocumentManager { } else { finalTargetDoc.hidden && (finalTargetDoc.hidden = undefined); !noSelect && docView?.select(false); + if (originatingDoc?.followLinkAudio) { + const anno = Cast(finalTargetDoc[Doc.LayoutFieldKey(finalTargetDoc) + '-audioAnnotations'], listSpec(AudioField), null).lastElement(); + if (anno) { + if (anno instanceof AudioField) { + new Howl({ + src: [anno.url.href], + format: ['mp3'], + autoplay: true, + loop: false, + volume: 0.5, + }); + } + } + } } finished?.(); }; |