Krakor92 / some-custom-dataviews

Some Obsidian dvjs views
5 stars 1 forks source link

Re-opening paused/stopped jukebox on mobile plays all songs simultaneously. #2

Open TheGoldenSeal opened 1 year ago

TheGoldenSeal commented 1 year ago

I noticed this bug on mobile iphone.

ISSUE: The jukebox loads fine and plays song fine. But if you leave obsidian to use other apps and the jukebox stops playing the last song (or it's paused, not sure), sometimes when you return to obsidian it will suddenly play all the songs simultaneously.

Reproducing this bug. (Not 100% reproduceable)

  1. Load the jukebox and play some songs.
  2. Leave the obsidian app while a song is playing.
  3. Swipe down from the top of the iphone to open the audio controls
  4. Pause the audio
  5. Use other apps on your phone
  6. Allow a certain amount of time to elapse. Maybe 20 minutes?
  7. Return to obsidian. The jukebox will be the active page and all the songs will start playing simultaneously.

I'll see if I can make this more reproduceable. Here's the code I'm using.

await dv.view("_js/jukebox", {
    filter: (qs) => {
        const from = '#🎼 AND "jukebox/songs"'

        const tagA = qs.from(from)
          .withTags("#music/rockA")
          ._pages

        const tagB = qs.from(from)
          .withTags("#music/rockB")
          ._pages

        const tagC = qs.from(from)
          .withTags("#music/rockC")
          ._pages

        qs.setPages(qs.joinPages(tagA, tagB, tagC))
    },
    sort: { shuffle: true },
    disable: "addscore"
})
Krakor92 commented 1 year ago

Thank you for reporting that 😃

I don't have an iPhone but I've managed to reproduce it on my iPad.

This is not a blocking bug, as you can simply close the file and open it again to bypass it. You'll loose the sorting order if you were on shuffle but It's not that big of a deal

Unfortunatly It's very time consuming to reproduce the state in which this bug occurs + As far as I know, I have zero tool to properly debug the mobile app (expect maybe logging information with the default notice system) so I don't think there is much I can do to fix this problem...

I'll try anyway but don't expect a fix anytime soon 😞

TheGoldenSeal commented 1 year ago

Thanks @Krakor92, this is a minor bug anyway. I'm mostly reporting it since I know you will eventually release this to a wider audience. Also, the jukebox already does what I need and is great, even with this strange behavior.

I am curious, however, to see what happens when I have a page with 100+ songs!! Lol. I’ll report back my results.

As always, thank you for providing this useful code. Very appreciated.