Skip to content

Commit

Permalink
fix: crash after rotating device in open content
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid committed Mar 8, 2024
1 parent d38625a commit 47855f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class HtmlUnitFragment : Fragment() {
},
onWebPageLoaded = {
isLoading = false
viewModel.setWebPageLoaded(requireContext().assets)
if (isAdded) viewModel.setWebPageLoaded(requireContext().assets)
}
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ class EncodedVideoUnitViewModel(
initPlayer()

val executor = Executors.newSingleThreadExecutor()
castContext = CastContext.getSharedInstance(context, executor).result
castContext?.let {
castPlayer = CastPlayer(it)
CastContext.getSharedInstance(context, executor).addOnCompleteListener {
it.result?.let { castContext ->
this.castContext = castContext
castPlayer = CastPlayer(castContext)
}
}
}

Expand Down

0 comments on commit 47855f0

Please sign in to comment.