pillarbox-apple icon indicating copy to clipboard operation
pillarbox-apple copied to clipboard

Items skipped when navigating a playlist containing failed items fast

Open defagos opened this issue 2 years ago • 1 comments

Description of the problem

When navigating a playlist containing failed items fast (forward and backward in sequence), items might be skipped.

Relevant stack trace or log output

No response

Reproducibility

Always

Steps to reproduce

  1. Open the demo.
  2. Open the playlist with a failed URL example.
  3. Use the arrows to navigate forward and back fast. After passing the failed item once navigating forward might skip the last item. Navigating backwards might skip the first item in the same way.

Library version

0.1.0

Operating system

iOS 17

Code sample

No response

Is there an existing issue for this?

  • [X] I have searched existing issues and found no similar bug report.

defagos avatar Feb 26 '24 15:02 defagos

Here is the test reproducing the issue:

func testAdvancingFromAnError() {
        let player = Player(items: [
            .simple(url: Stream.unauthorized.url),
            .simple(url: Stream.onDemand.url)
        ])
        player.advanceToNextItem()
        expect(player.streamType).toEventually(equal(.onDemand))
        expectEqualPublished(values: [1, 0, 1], from: player.$currentIndex, during: .seconds(3)) {
            player.returnToPrevious()
            player.advanceToNextItem()
        }
    }

Unfortunately, I cannot find a quick win solution.

waliid avatar Mar 11 '24 12:03 waliid

Can still be reproduced with 5.0.0 and the following updated test:

func testAdvancingFromAnError() {
    let item1 = PlayerItem.simple(url: Stream.unauthorized.url)
    let item2 = PlayerItem.simple(url: Stream.onDemand.url)
    let player = Player(items: [item1, item2])
    player.advanceToNextItem()
    expect(player.streamType).toEventually(equal(.onDemand))
    expectEqualPublished(values: [item2, item1, item2], from: player.$currentItem, during: .seconds(3)) {
        player.returnToPrevious()
        player.advanceToNextItem()
    }
}

I really struggled to reproduce this issue, though. Pretty sure this is a very minor problem.

defagos avatar Oct 14 '24 05:10 defagos

As discussed with @waliid this is really a minor issue. Closed.

defagos avatar Oct 14 '24 07:10 defagos