EXO Player - MEDIA3 in Android Jetpack Compose.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello my friends and welcome back to new video in this video I'm going to continue the previous video in the last video I showed you how to create two types of video players one to play the videos from the YouTube and the other one to play the videos that we are located them in the resource files of our application and this video belongs to exop player we are using exop player to play the videos directly from the UR when you are working with a remote server using for example uh retrofit and you have vdos in your server to play you can use EXO player to play them through the URL of the video let's get started this is the application that we are going to build together and as you can see we have a video player with controller and here you can see that it's buffering the video and playing it you have the timer here 5 Second backward 15 seconds forward and pause and play and here you have the speed and audio and everything this is the application that we built together last uh video here and here we have two types of the video players I'm going to comment them because I want it to be in my GitHub as a reference for you and I'm going to comment this as well because we don't need them and uh okay here I've created a new file inside of it we have a composable we do player EXO we need this variable with URL and here we can can call this uh video player EXO and we need this video URL so either you can create a variable here just like this Val URL equals [Music] to and if you search for uh free video URLs for test you will achieve a GitHub page it has uh some links and you can use them to test your application uh I've chosen the first one and we are going to use it for the test but if you check them and it didn't work remember to add this s uh after the HTTP and now I'm going to pass it here with URL okay in the build that I have added these three lines these dependencies and you can add them and press the sync after syncing go to the Manifest add the internet permission as well here and then we are ready to start writing our codes regarding to work with EXO player we need the context as the beginning equals to local context. current and we need a player equals to EXO player dot Builder let's import it okay passing the context to it dot build and Dot apply in the next line we are going to set this URL on this player so set media item and media item from URI and you are going to pass this video URL into it then we need to create a player view passing the context into it let me import it and we need another variable to check if the player is ready or not so play play ready by remember saveable [Music] and mutable state of let me import it and true okay then we have to connect them together so here the player uh player view dot player equals to the player so we set this player as the player of this player View and now we need a launch effect to uh like monitor this player and after any change uh we are going to prepare it and uh play it when it's ready uh we can use launch effect when we have only a single item just like this example we have this single item here and if you have have multiple items list and you want to uh like monitor them whenever the user clicks on one of the items you want to play in new video uh you can use disposable effect and uh after clicking on the new item you have to use the on dispose to release the player and clean the previous URL from the pack stack so here I'm going to use launch effect as the key I'm going to pass the player and then after any change on player we are going [Music] to repair it again and player dot play when ready dot uh not DOT equals to play when ready okay or you can simply pass here through this is the uh like a standard structure that we can use okay here now uh we need to use the Android view as the other uh players Android view has a factory so in the factory we can pass the player View and that's enough to play a video but but if you want you can use a modifier to modify this Android view let me copy and paste the previous design like here the modifier and here paste it so you have a modifier field Max with pading of 8 DP clip 16 DPS of round rounded Corner shape and everything is done let's check it on the emulator okay as you can see it's buffering and playing the video and I can use this to show you how to fast go the video okay that's it that was everything about EXO player here uh in this video if you want me to create that list view with list of the items and play one by one uh write down below in the comment section and if you have this request I will make that video If you like this video please give me a thumbs up if you are new in the chn please subscribe to the channel and if you have any other comments you can write down below in the description the source code is available in the description and uh you can use them through my GitHub page have a good day bye-bye
Info
Channel: MkrDeveloper
Views: 1,898
Rating: undefined out of 5
Keywords: Mkr Developer, jetpack compose EXO Player - MEDIA3, EXO Player - MEDIA3 in jetpack compose. Android studio | Kotlin, EXO Player - MEDIA3 - jetpack compose, android jetpack compose EXO Player - MEDIA3, EXO Player - MEDIA3 - Jetpack Compose - Android, jetpack compose mohsen mashkour, jetpack compose for beginners, jetpack compose tutorial, Mohsen mashkour, android jetpack compose, jetpack compose, Jetpack compose in android kotlin, exoplayer jetpack compose, ExoPlayer
Id: DU3KFHqV85E
Channel Id: undefined
Length: 10min 17sec (617 seconds)
Published: Sat Feb 10 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.