shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.23k stars 1.34k forks source link

OPERATION_ABORTED when preload is destroyed immediately after creation #7618

Closed HokkanenTeemu closed 1 week ago

HokkanenTeemu commented 1 week ago

Have you read the FAQ and checked for duplicate open issues? Yes

If the problem is related to FairPlay, have you read the tutorial?

What version of Shaka Player are you using?

4.12.0 I have also seen this error with many earlier versions (4.10.x, 4.11.x).

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Custom

If custom app, can you reproduce the issue using our demo app? I have not tested

What browser and OS are you using? Many, including MacOS 15 + Safari 18 and Windows 11 + Edge 130.0.6723.117

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

What configuration are you using? What is the output of player.getNonDefaultConfiguration()?

What did you do?

I try to destroy preload after soon after creating it.

shaka.polyfill.installAll()
const video = document.querySelector("video")
const player = new shaka.Player()
await player.attach(video)

const preload = await player.preload("https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd")
await preload.destroy()

What did you expect to happen? According to the preload tutorial I should be able to cancel preload with destroy, so I expect no error to be thrown.

What actually happened? Shaka error is logged to console with code 7001, which I'm not expecting as explanation for the code is: An internal error which indicates that an operation was aborted. This should not be seen by applications.

Are you planning send a PR to fix it? No

HokkanenTeemu commented 1 week ago

I found out that I can catch the error with preloadManager.waitForFinish so that it won't propagate to console. This "fix" applies also to some other errors that I'm seeing when destroying non finished preload.

shaka.polyfill.installAll()
const video = document.querySelector("video")
const player = new shaka.Player()
await player.attach(video)

const preload = await player.preload("https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd")
preload.waitForFinish().catch(()=> {}) // ignore error
await preload.destroy()
theodab commented 1 week ago

It looks like while we're catching operation aborted errors that are fired during segment prefetching, we still surface operation aborted errors from other network requests. In this case, from the network request to load the manifest.

I'll just change the preload manager to not surface aborted errors at all.