Last active
August 11, 2021 08:04
-
-
Save halilozercan/b1dc6bf9f95b6f400b90c83c6cb8ff6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
} | |
} | |
} | |
} | |
} | |
} |
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
what is state, is it a function?