Throw PlaybackException instead of Error in PlayerService::createDataSourceFactory

This commit is contained in:
vfsfitvnm
2022-06-05 11:55:09 +02:00
parent e8bd63bdee
commit 7f164d7898

View File

@@ -330,10 +330,17 @@ class PlayerService : MediaSessionService(), MediaSession.MediaItemFiller,
dataSpec.withUri(url.value.toUri()) dataSpec.withUri(url.value.toUri())
.subrange(dataSpec.uriPositionOffset, chunkLength) .subrange(dataSpec.uriPositionOffset, chunkLength)
} }
// TODO is Outcome.Error.Network -> throw PlaybackException(
is Outcome.Error.Network -> throw Error("no network") "Couldn't reach the internet",
null,
PlaybackException.ERROR_CODE_REMOTE_ERROR
)
is Outcome.Error.Unhandled -> throw url.throwable is Outcome.Error.Unhandled -> throw url.throwable
else -> TODO("unreachable") else -> throw PlaybackException(
"Unexpected error",
null,
PlaybackException.ERROR_CODE_REMOTE_ERROR
)
} }
} }
} }