···4455- **Native builds with [Tauri](https://tauri.app/)**.
66- Fixes playback issue with Google Drive on Safari/iOS.
77+- Improves Google Drive support, access tokens are now refreshed when needed (before it only refreshed on source processing)
7889910## 3.1.1
···13131414const EXCLUDE =
1515 [ "_headers"
1616- , "_redirects"
1717- , "CORS"
1616+ , "_redirects"
1717+ , "CORS"
1818 ]
19192020···7979 "Basic " + token
8080 )
81818282- // When doing a request with access token in the url, put it in the headers instead
8282+ // When doing a request with access token in the url, put it in the headers instead
8383 } else if (event.request.url.includes("bearer_token=")) {
8484 const url = new URL(event.request.url)
8585 const token = url.searchParams.get("bearer_token")
···9595 "Bearer " + token
9696 )
97979898- // Use cache if internal request and not using native app
9898+ // Use cache if internal request and not using native app
9999 } else if (isInternal) {
100100 event.respondWith(
101101 isNativeWrapper
···152152 request.headers.entries()
153153 )
154154155155- newHeaders["authorization"] = authToken
155155+ newHeaders[ "authorization" ] = authToken
156156157157 const newRequest = new Request(
158158 new Request(urlWithoutToken, event.request),
···170170171171 let retries = 0
172172173173+ // TODO: When request fails because access token is expired,
174174+ // refresh the token, and retry the request.
173175 const makeFetch = () => fetch(newRequest).then(r => {
174176 if (r.ok) {
175177 retries = 0
+26-26
src/Javascript/audio-engine.js
···151516161717const IS_SAFARI = !!navigator.platform.match(/iPhone|iPod|iPad/) ||
1818- navigator.vendor === "Apple Computer, Inc."
1818+ navigator.vendor === "Apple Computer, Inc."
191920202121···3838 let c
3939 let styles =
4040 [ "height: 0"
4141- , "width: 0"
4242- , "visibility: hidden"
4343- , "pointer-events: none"
4141+ , "width: 0"
4242+ , "visibility: hidden"
4343+ , "pointer-events: none"
4444 ]
45454646 c = document.createElement("div")
···117117 // initial promise
118118 const initialPromise = queueItem.isCached
119119 ? db.getFromIndex({ key: queueItem.trackId, store: db.storeNames.tracks }).then(blobUrl)
120120- : transformUrl(queueItem.url)
120120+ : transformUrl(queueItem.url, orchestrion.app)
121121122122 // find or create audio node
123123 let audioNode
···214214 n => n.parentNode.removeChild(n)
215215 )
216216217217- // audio element remains valid for 2 hours
218218- transformUrl(queueItem.url).then(url => {
217217+ // audio element remains valid for 45 minutes
218218+ transformUrl(queueItem.url, orchestrion.app).then(url => {
219219 const queueItemWithTransformedUrl =
220220 Object.assign({}, queueItem, { url: url })
221221222222 createAudioElement(
223223 orchestrion,
224224 queueItemWithTransformedUrl,
225225- Date.now() + 1000 * 60 * 60 * 2,
225225+ Date.now() + 1000 * 60 * 45,
226226 true
227227 )
228228 })
···285285}
286286287287288288- function showNetworkErrorNotification() {
289289- if (showedNoNetworkError) return
290290- showedNoNetworkError = true
291291- this.app.ports.showErrorNotification.send(
292292- navigator.onLine
293293- ? "I can't play this track because of a network error. I'll try to reconnect."
294294- : "I can't play this track because we're offline. I'll try to reconnect."
295295- )
296296- }
288288+function showNetworkErrorNotification() {
289289+ if (showedNoNetworkError) return
290290+ showedNoNetworkError = true
291291+ this.app.ports.showErrorNotification.send(
292292+ navigator.onLine
293293+ ? "I can't play this track because of a network error. I'll try to reconnect."
294294+ : "I can't play this track because we're offline. I'll try to reconnect."
295295+ )
296296+}
297297298298299299- function showUnsupportedSrcErrorNotification() {
300300- this.app.ports.showErrorNotification.send(
301301- "__I can't play this track because your browser didn't recognize it.__ Try checking your developer console for a warning to find out why."
302302- )
303303- }
299299+function showUnsupportedSrcErrorNotification() {
300300+ this.app.ports.showErrorNotification.send(
301301+ "__I can't play this track because your browser didn't recognize it.__ Try checking your developer console for a warning to find out why."
302302+ )
303303+}
304304305305306306function audioStalledEvent(event, notifyAppImmediately) {
···426426 !node ||
427427 node.getAttribute("data-preload") === "t"
428428 )
429429- ? false
430430- : orchestrion.activeQueueItem.trackId === audioElementTrackId(node)
429429+ ? false
430430+ : orchestrion.activeQueueItem.trackId === audioElementTrackId(node)
431431}
432432433433···492492 let artwork = []
493493494494 if (maybeArtwork && typeof maybeArtwork !== "string") {
495495- artwork = [{
495495+ artwork = [ {
496496 src: URL.createObjectURL(maybeArtwork),
497497 type: maybeArtwork.type
498498- }]
498498+ } ]
499499 }
500500501501 navigator.mediaSession.metadata = new MediaMetadata({