@@ -35,7 +35,37 @@ import io.github.vinceglb.filekit.PlatformFile
3535import kotlinx.coroutines.*
3636
3737@OptIn(UnstableApi ::class )
38- actual fun createVideoPlayerState (): VideoPlayerState = DefaultVideoPlayerState ()
38+ actual fun createVideoPlayerState (): VideoPlayerState =
39+ try {
40+ DefaultVideoPlayerState ()
41+ } catch (e: IllegalStateException ) {
42+ PreviewableVideoPlayerState (
43+ hasMedia = false ,
44+ isPlaying = false ,
45+ isLoading = false ,
46+ volume = 1f ,
47+ sliderPos = 0f ,
48+ userDragging = false ,
49+ loop = false ,
50+ playbackSpeed = 1f ,
51+ leftLevel = 0f ,
52+ rightLevel = 0f ,
53+ positionText = " 00:00" ,
54+ durationText = " 00:00" ,
55+ currentTime = 0.0 ,
56+ isFullscreen = false ,
57+ aspectRatio = 16f / 9f ,
58+ error = VideoPlayerError .UnknownError (
59+ " Android context is not available (preview or missing ContextProvider initialization)."
60+ ),
61+ metadata = VideoMetadata (),
62+ subtitlesEnabled = false ,
63+ currentSubtitleTrack = null ,
64+ availableSubtitleTracks = mutableListOf (),
65+ subtitleTextStyle = TextStyle .Default ,
66+ subtitleBackgroundColor = Color .Transparent
67+ )
68+ }
3969
4070/* *
4171 * Logger for WebAssembly video player surface
@@ -719,4 +749,4 @@ open class DefaultVideoPlayerState: VideoPlayerState {
719749 resetStates()
720750 }
721751 }
722- }
752+ }
0 commit comments