|
|
@ -17,7 +17,7 @@ import rootScope from "../lib/rootScope"; |
|
|
|
import './middleEllipsis'; |
|
|
|
import './middleEllipsis'; |
|
|
|
import { SearchSuperContext } from "./appSearchSuper."; |
|
|
|
import { SearchSuperContext } from "./appSearchSuper."; |
|
|
|
import { cancelEvent } from "../helpers/dom/cancelEvent"; |
|
|
|
import { cancelEvent } from "../helpers/dom/cancelEvent"; |
|
|
|
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent"; |
|
|
|
import { attachClickEvent } from "../helpers/dom/clickEvent"; |
|
|
|
import LazyLoadQueue from "./lazyLoadQueue"; |
|
|
|
import LazyLoadQueue from "./lazyLoadQueue"; |
|
|
|
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise"; |
|
|
|
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise"; |
|
|
|
import ListenerSetter, { Listener } from "../helpers/listenerSetter"; |
|
|
|
import ListenerSetter, { Listener } from "../helpers/listenerSetter"; |
|
|
@ -28,10 +28,12 @@ import { MiddleEllipsisElement } from "./middleEllipsis"; |
|
|
|
import htmlToSpan from "../helpers/dom/htmlToSpan"; |
|
|
|
import htmlToSpan from "../helpers/dom/htmlToSpan"; |
|
|
|
import { formatFullSentTime } from "../helpers/date"; |
|
|
|
import { formatFullSentTime } from "../helpers/date"; |
|
|
|
import { formatBytes } from "../helpers/number"; |
|
|
|
import { formatBytes } from "../helpers/number"; |
|
|
|
|
|
|
|
import throttleWithRaf from "../helpers/schedulers/throttleWithRaf"; |
|
|
|
|
|
|
|
|
|
|
|
rootScope.addEventListener('messages_media_read', ({mids, peerId}) => { |
|
|
|
rootScope.addEventListener('messages_media_read', ({mids, peerId}) => { |
|
|
|
mids.forEach(mid => { |
|
|
|
mids.forEach(mid => { |
|
|
|
(Array.from(document.querySelectorAll('audio-element[data-mid="' + mid + '"][data-peer-id="' + peerId + '"].is-unread')) as AudioElement[]).forEach(elem => { |
|
|
|
const attr = `[data-mid="${mid}"][data-peer-id="${peerId}"]`; |
|
|
|
|
|
|
|
(Array.from(document.querySelectorAll(`audio-element.is-unread${attr}, .media-round.is-unread${attr}`)) as AudioElement[]).forEach(elem => { |
|
|
|
elem.classList.remove('is-unread'); |
|
|
|
elem.classList.remove('is-unread'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -80,11 +82,6 @@ function wrapVoiceMessage(audioEl: AudioElement) { |
|
|
|
|
|
|
|
|
|
|
|
const message = audioEl.message; |
|
|
|
const message = audioEl.message; |
|
|
|
const doc = (message.media.document || message.media.webpage.document) as MyDocument; |
|
|
|
const doc = (message.media.document || message.media.webpage.document) as MyDocument; |
|
|
|
const isOut = message.fromId === rootScope.myId && message.peerId !== rootScope.myId; |
|
|
|
|
|
|
|
let isUnread = message && message.pFlags.media_unread; |
|
|
|
|
|
|
|
if(isUnread) { |
|
|
|
|
|
|
|
audioEl.classList.add('is-unread'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(message.pFlags.out) { |
|
|
|
if(message.pFlags.out) { |
|
|
|
audioEl.classList.add('is-out'); |
|
|
|
audioEl.classList.add('is-out'); |
|
|
@ -154,59 +151,28 @@ function wrapVoiceMessage(audioEl: AudioElement) { |
|
|
|
let progress = audioEl.querySelector('.audio-waveform') as HTMLDivElement; |
|
|
|
let progress = audioEl.querySelector('.audio-waveform') as HTMLDivElement; |
|
|
|
|
|
|
|
|
|
|
|
const onLoad = () => { |
|
|
|
const onLoad = () => { |
|
|
|
let interval = 0; |
|
|
|
|
|
|
|
let lastIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let audio = audioEl.audio; |
|
|
|
let audio = audioEl.audio; |
|
|
|
|
|
|
|
|
|
|
|
if(!audio.paused || (audio.currentTime > 0 && audio.currentTime !== audio.duration)) { |
|
|
|
const onTimeUpdate = () => { |
|
|
|
lastIndex = Math.round(audio.currentTime / audio.duration * barCount); |
|
|
|
const lastIndex = audio.currentTime === audio.duration ? 0 : Math.ceil(audio.currentTime / audio.duration * barCount); |
|
|
|
rects.slice(0, lastIndex + 1).forEach(node => node.classList.add('active')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let start = () => { |
|
|
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
interval = window.setInterval(() => { |
|
|
|
|
|
|
|
if(lastIndex > svg.childElementCount || isNaN(audio.duration) || audio.paused) { |
|
|
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lastIndex = Math.round(audio.currentTime / audio.duration * barCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//svg.children[lastIndex].setAttributeNS(null, 'fill', '#000');
|
|
|
|
//svg.children[lastIndex].setAttributeNS(null, 'fill', '#000');
|
|
|
|
//svg.children[lastIndex].classList.add('active'); #Иногда пропускает полоски..
|
|
|
|
//svg.children[lastIndex].classList.add('active'); #Иногда пропускает полоски..
|
|
|
|
rects.slice(0, lastIndex + 1).forEach(node => node.classList.add('active')); |
|
|
|
rects.forEach((node, idx) => node.classList.toggle('active', idx < lastIndex)); |
|
|
|
//++lastIndex;
|
|
|
|
//++lastIndex;
|
|
|
|
//console.log('lastIndex:', lastIndex, audio.currentTime);
|
|
|
|
//console.log('lastIndex:', lastIndex, audio.currentTime);
|
|
|
|
//}, duration * 1000 / svg.childElementCount | 0/* 63 * duration / 10 */);
|
|
|
|
//}, duration * 1000 / svg.childElementCount | 0/* 63 * duration / 10 */);
|
|
|
|
}, 20); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(!audio.paused) { |
|
|
|
if(!audio.paused || (audio.currentTime > 0 && audio.currentTime !== audio.duration)) { |
|
|
|
start(); |
|
|
|
onTimeUpdate(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
audioEl.addAudioListener('play', () => { |
|
|
|
|
|
|
|
if(isUnread && !isOut && audioEl.classList.contains('is-unread')) { |
|
|
|
|
|
|
|
audioEl.classList.remove('is-unread'); |
|
|
|
|
|
|
|
appMessagesManager.readMessages(audioEl.message.peerId, [audioEl.message.mid]); |
|
|
|
|
|
|
|
isUnread = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//rects.forEach(node => node.classList.remove('active'));
|
|
|
|
const throttledTimeUpdate = throttleWithRaf(onTimeUpdate); |
|
|
|
start(); |
|
|
|
audioEl.addAudioListener('timeupdate', throttledTimeUpdate); |
|
|
|
}); |
|
|
|
audioEl.addAudioListener('ended', throttledTimeUpdate); |
|
|
|
|
|
|
|
|
|
|
|
audioEl.addAudioListener('pause', () => { |
|
|
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
audioEl.addAudioListener('ended', () => { |
|
|
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
rects.forEach(node => node.classList.remove('active')); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
audioEl.readyPromise.then(() => { |
|
|
|
let mousedown = false, mousemove = false; |
|
|
|
let mousedown = false, mousemove = false; |
|
|
|
progress.addEventListener('mouseleave', (e) => { |
|
|
|
progress.addEventListener('mouseleave', (e) => { |
|
|
|
if(mousedown) { |
|
|
|
if(mousedown) { |
|
|
@ -221,7 +187,7 @@ function wrapVoiceMessage(audioEl: AudioElement) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
progress.addEventListener('mousedown', (e) => { |
|
|
|
progress.addEventListener('mousedown', (e) => { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
if(e.button !== 1) return; |
|
|
|
if(e.button !== 0) return; |
|
|
|
if(!audio.paused) { |
|
|
|
if(!audio.paused) { |
|
|
|
audio.pause(); |
|
|
|
audio.pause(); |
|
|
|
} |
|
|
|
} |
|
|
@ -230,7 +196,7 @@ function wrapVoiceMessage(audioEl: AudioElement) { |
|
|
|
mousedown = true; |
|
|
|
mousedown = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
progress.addEventListener('mouseup', (e) => { |
|
|
|
progress.addEventListener('mouseup', (e) => { |
|
|
|
if (mousemove && mousedown) { |
|
|
|
if(mousemove && mousedown) { |
|
|
|
audio.play(); |
|
|
|
audio.play(); |
|
|
|
mousedown = false; |
|
|
|
mousedown = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -250,17 +216,11 @@ function wrapVoiceMessage(audioEl: AudioElement) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const scrubTime = offsetX / availW /* width */ * audio.duration; |
|
|
|
const scrubTime = offsetX / availW /* width */ * audio.duration; |
|
|
|
lastIndex = Math.round(scrubTime / audio.duration * barCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rects.slice(0, lastIndex + 1).forEach(node => node.classList.add('active')); |
|
|
|
|
|
|
|
for(let i = lastIndex + 1; i < rects.length; ++i) { |
|
|
|
|
|
|
|
rects[i].classList.remove('active') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
audio.currentTime = scrubTime; |
|
|
|
audio.currentTime = scrubTime; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
clearInterval(interval); |
|
|
|
|
|
|
|
progress.remove(); |
|
|
|
progress.remove(); |
|
|
|
progress = null; |
|
|
|
progress = null; |
|
|
|
audio = null; |
|
|
|
audio = null; |
|
|
@ -367,8 +327,11 @@ function wrapAudio(audioEl: AudioElement) { |
|
|
|
function constructDownloadPreloader(tryAgainOnFail = true) { |
|
|
|
function constructDownloadPreloader(tryAgainOnFail = true) { |
|
|
|
const preloader = new ProgressivePreloader({cancelable: true, tryAgainOnFail}); |
|
|
|
const preloader = new ProgressivePreloader({cancelable: true, tryAgainOnFail}); |
|
|
|
preloader.construct(); |
|
|
|
preloader.construct(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!tryAgainOnFail) { |
|
|
|
preloader.circle.setAttributeNS(null, 'r', '23'); |
|
|
|
preloader.circle.setAttributeNS(null, 'r', '23'); |
|
|
|
preloader.totalLength = 143.58203125; |
|
|
|
preloader.totalLength = 143.58203125; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return preloader; |
|
|
|
return preloader; |
|
|
|
} |
|
|
|
} |
|
|
@ -388,7 +351,7 @@ export default class AudioElement extends HTMLElement { |
|
|
|
private listenerSetter = new ListenerSetter(); |
|
|
|
private listenerSetter = new ListenerSetter(); |
|
|
|
private onTypeDisconnect: () => void; |
|
|
|
private onTypeDisconnect: () => void; |
|
|
|
public onLoad: (autoload?: boolean) => void; |
|
|
|
public onLoad: (autoload?: boolean) => void; |
|
|
|
private readyPromise: CancellablePromise<void>; |
|
|
|
public readyPromise: CancellablePromise<void>; |
|
|
|
|
|
|
|
|
|
|
|
public render() { |
|
|
|
public render() { |
|
|
|
this.classList.add('audio'); |
|
|
|
this.classList.add('audio'); |
|
|
@ -414,6 +377,11 @@ export default class AudioElement extends HTMLElement { |
|
|
|
const downloadDiv = document.createElement('div'); |
|
|
|
const downloadDiv = document.createElement('div'); |
|
|
|
downloadDiv.classList.add('audio-download'); |
|
|
|
downloadDiv.classList.add('audio-download'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isUnread = doc.type !== 'audio' && this.message && this.message.pFlags.media_unread; |
|
|
|
|
|
|
|
if(isUnread) { |
|
|
|
|
|
|
|
this.classList.add('is-unread'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(uploading) { |
|
|
|
if(uploading) { |
|
|
|
this.classList.add('is-outgoing'); |
|
|
|
this.classList.add('is-outgoing'); |
|
|
|
this.append(downloadDiv); |
|
|
|
this.append(downloadDiv); |
|
|
@ -424,11 +392,17 @@ export default class AudioElement extends HTMLElement { |
|
|
|
const audioTimeDiv = this.querySelector('.audio-time') as HTMLDivElement; |
|
|
|
const audioTimeDiv = this.querySelector('.audio-time') as HTMLDivElement; |
|
|
|
audioTimeDiv.innerHTML = durationStr; |
|
|
|
audioTimeDiv.innerHTML = durationStr; |
|
|
|
|
|
|
|
|
|
|
|
const onLoad = this.onLoad = (autoload = true) => { |
|
|
|
const onLoad = this.onLoad = (autoload: boolean) => { |
|
|
|
this.onLoad = undefined; |
|
|
|
this.onLoad = undefined; |
|
|
|
|
|
|
|
|
|
|
|
const audio = this.audio = appMediaPlaybackController.addMedia(this.message.peerId, this.message.media.document || this.message.media.webpage.document, this.message.mid, autoload); |
|
|
|
const audio = this.audio = appMediaPlaybackController.addMedia(this.message.peerId, this.message.media.document || this.message.media.webpage.document, this.message.mid, autoload); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.readyPromise = deferredPromise<void>(); |
|
|
|
|
|
|
|
if(this.audio.readyState >= 2) this.readyPromise.resolve(); |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
this.addAudioListener('canplay', () => this.readyPromise.resolve(), {once: true}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.onTypeDisconnect = onTypeLoad(); |
|
|
|
this.onTypeDisconnect = onTypeLoad(); |
|
|
|
|
|
|
|
|
|
|
|
const getTimeStr = () => String(audio.currentTime | 0).toHHMMSS() + (isVoice ? (' / ' + durationStr) : ''); |
|
|
|
const getTimeStr = () => String(audio.currentTime | 0).toHHMMSS() + (isVoice ? (' / ' + durationStr) : ''); |
|
|
@ -492,52 +466,7 @@ export default class AudioElement extends HTMLElement { |
|
|
|
if(!isOutgoing) { |
|
|
|
if(!isOutgoing) { |
|
|
|
let preloader: ProgressivePreloader = this.preloader; |
|
|
|
let preloader: ProgressivePreloader = this.preloader; |
|
|
|
|
|
|
|
|
|
|
|
const getDownloadPromise = () => appDocsManager.downloadDoc(doc); |
|
|
|
onLoad(doc.type !== 'audio' && !this.noAutoDownload); |
|
|
|
|
|
|
|
|
|
|
|
if(isRealVoice) { |
|
|
|
|
|
|
|
if(!preloader) { |
|
|
|
|
|
|
|
preloader = constructDownloadPreloader(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const load = () => { |
|
|
|
|
|
|
|
const download = getDownloadPromise(); |
|
|
|
|
|
|
|
preloader.attach(downloadDiv, false, download); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!downloadDiv.parentElement) { |
|
|
|
|
|
|
|
this.append(downloadDiv); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(download as Promise<any>).then(() => { |
|
|
|
|
|
|
|
detachClickEvent(this, onClick); |
|
|
|
|
|
|
|
onLoad(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
downloadDiv.classList.add('downloaded'); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
downloadDiv.remove(); |
|
|
|
|
|
|
|
}, 200); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {download}; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// preloader.construct();
|
|
|
|
|
|
|
|
preloader.setManual(); |
|
|
|
|
|
|
|
preloader.attach(downloadDiv); |
|
|
|
|
|
|
|
preloader.setDownloadFunction(load); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onClick = (e?: Event) => { |
|
|
|
|
|
|
|
preloader.onClick(e); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attachClickEvent(this, onClick); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!this.noAutoDownload) { |
|
|
|
|
|
|
|
onClick(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// if(doc.supportsStreaming) {
|
|
|
|
|
|
|
|
onLoad(false); |
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(doc.thumbs) { |
|
|
|
if(doc.thumbs) { |
|
|
|
const imgs: HTMLImageElement[] = []; |
|
|
|
const imgs: HTMLImageElement[] = []; |
|
|
@ -559,32 +488,24 @@ export default class AudioElement extends HTMLElement { |
|
|
|
imgs.forEach(img => img.classList.add('audio-thumb')); |
|
|
|
imgs.forEach(img => img.classList.add('audio-thumb')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if(appMediaPlaybackController.mediaExists(mid)) { // чтобы показать прогресс, если аудио уже было скачано
|
|
|
|
const r = (shouldPlay: boolean) => { |
|
|
|
//onLoad();
|
|
|
|
|
|
|
|
//} else {
|
|
|
|
|
|
|
|
const r = (e: Event) => { |
|
|
|
|
|
|
|
if(!this.audio) { |
|
|
|
|
|
|
|
const togglePlay = onLoad(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.audio.src) { |
|
|
|
if(this.audio.src) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
appMediaPlaybackController.resolveWaitingForLoadMedia(this.message.peerId, this.message.mid); |
|
|
|
appMediaPlaybackController.resolveWaitingForLoadMedia(this.message.peerId, this.message.mid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onDownloadInit = () => { |
|
|
|
|
|
|
|
if(shouldPlay) { |
|
|
|
appMediaPlaybackController.willBePlayed(this.audio); // prepare for loading audio
|
|
|
|
appMediaPlaybackController.willBePlayed(this.audio); // prepare for loading audio
|
|
|
|
|
|
|
|
|
|
|
|
if(IS_SAFARI) { |
|
|
|
if(IS_SAFARI && !this.audio.autoplay) { |
|
|
|
this.audio.autoplay = true; |
|
|
|
this.audio.autoplay = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// togglePlay(undefined, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.readyPromise = deferredPromise<void>(); |
|
|
|
|
|
|
|
if(this.audio.readyState >= 2) this.readyPromise.resolve(); |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
this.addAudioListener('canplay', () => this.readyPromise.resolve(), {once: true}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onDownloadInit(); |
|
|
|
|
|
|
|
|
|
|
|
if(!preloader) { |
|
|
|
if(!preloader) { |
|
|
|
if(doc.supportsStreaming) { |
|
|
|
if(doc.supportsStreaming) { |
|
|
@ -610,6 +531,8 @@ export default class AudioElement extends HTMLElement { |
|
|
|
pauseListener = this.addAudioListener('pause', () => { |
|
|
|
pauseListener = this.addAudioListener('pause', () => { |
|
|
|
deferred.cancel(); |
|
|
|
deferred.cancel(); |
|
|
|
}, {once: true}) as any; |
|
|
|
}, {once: true}) as any; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onDownloadInit(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* if(!this.audio.paused) { |
|
|
|
/* if(!this.audio.paused) { |
|
|
@ -625,7 +548,9 @@ export default class AudioElement extends HTMLElement { |
|
|
|
preloader = constructDownloadPreloader(); |
|
|
|
preloader = constructDownloadPreloader(); |
|
|
|
|
|
|
|
|
|
|
|
const load = () => { |
|
|
|
const load = () => { |
|
|
|
const download = getDownloadPromise(); |
|
|
|
onDownloadInit(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const download = appDocsManager.downloadDoc(doc); |
|
|
|
preloader.attach(downloadDiv, false, download); |
|
|
|
preloader.attach(downloadDiv, false, download); |
|
|
|
return {download}; |
|
|
|
return {download}; |
|
|
|
}; |
|
|
|
}; |
|
|
@ -657,9 +582,13 @@ export default class AudioElement extends HTMLElement { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(!this.audio?.src) { |
|
|
|
if(!this.audio?.src) { |
|
|
|
attachClickEvent(toggle, r, {once: true, capture: true, passive: false}); |
|
|
|
if(doc.type !== 'audio' && !this.noAutoDownload) { |
|
|
|
|
|
|
|
r(false); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
attachClickEvent(toggle, () => { |
|
|
|
|
|
|
|
r(true); |
|
|
|
|
|
|
|
}, {once: true, capture: true, passive: false, listenerSetter: this.listenerSetter}); |
|
|
|
} |
|
|
|
} |
|
|
|
//}
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else if(uploading) { |
|
|
|
} else if(uploading) { |
|
|
|
this.preloader.attach(downloadDiv, false); |
|
|
|
this.preloader.attach(downloadDiv, false); |
|
|
|