Open Megubit opened 4 years ago
That is slightly incorrect. The onPlayerError
is called for non-Promise errors. The load
, unload
, etc methods have to pass the block, which acts like the Promise in JavaScript. Once the block is called, the Promise is resolved. The onPlayerError
is called for asynchronous errors, like decoding errors. The block is given errors from the Promise like HTTP_ERROR from the manifest.
I must have understood it wrong then. Got confused with the weird way it worked for me. I thought the andBlock
was optional based on the description of onPlayerError
.
So, every time I play a different stream, I have to set the andBlock
, maybe it would be better if the errors are always caught by onPlayerError
. In my opinion, it seems unnecessary to always set andBlock
when switching streams, since the error handling should be the same throughout the life cycle of the app.
If I understand correctly, ShakaPlayerClient onPlayerError is optional, and it will be called if there is no
andBlock
given to the player load.If there is no
andBlock
:[self.player load:self.assetURI withStartTime:startTime];
xCode gives an errorNo visible @interface for 'ShakaPlayerView' declares the selector 'load:withStartTime:'
That's from the sample project, and in this case theandBlock
is mandatory, which means the optional onPlayerError will never be called as we have to give the callback.Now I'm not sure what's the difference in the way I'm doing the implementation (maybe because of Qt), as I'm making it based on the sample project, but in my code it generates a warning
[self.player load:url withStartTime:startTime ];
Instance method '-load:withStartTime:' not found (return type defaults to 'id')
and it let's me compile and run it. Causing an error will trigger theonPlayerError
as expected, with the correct response. However, the stream will always be set to the end, even ifstartTime
is set to 0.Calling it like this
[self.player load:url ];
will also trigger a warningInstance method '-load:' not found (return type defaults to 'id')
but the stream will start from the beginning.