Skip to content

Instantly share code, notes, and snippets.

@halilozercan
Last active August 11, 2021 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halilozercan/b1dc6bf9f95b6f400b90c83c6cb8ff6e to your computer and use it in GitHub Desktop.
Save halilozercan/b1dc6bf9f95b6f400b90c83c6cb8ff6e to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ComposeTubeTheme {
var source by remember {
mutableStateOf(
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
)
}
Column {
VideoPlayer(source)
Button(onClick = {
// Elephant Dream by Blender Foundation
source = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"
}) {
Text("Another Video")
}
}
}
}
}
}
@jahidulhub
Copy link

jahidulhub commented Aug 11, 2021

what is state, is it a function?

@halilozercan
Copy link
Author

Ooops, this is very outdated. state was removed from compose a while ago. The replacement is

remember { mutableStateOf() }

I'm going to edit the gist as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment