I have a set of video views with a firebase storage video link, but I want to play videos like TikTok and Instagram reel do when the video view is switched to viewpager2.
One strategy would be to handle video playback with a library like ExoPlayer and then store and get the video URLs using a Firebase Realtime Database. The videos can then be added to the pages using a custom ViewPager2 adapter, and ExoPlayer can be used to play the films as the user swipes across the pages.
AFAIK, you can store the video in Firebase Storage and the video URLs and information in Firebase Database. The clips can then be added to the ViewPager2 using a FirebaseRecyclerAdapter.
This method allows you to load the videos into ExoPlayer or VideoView using the Glide library.
Thanks for your answers but do both methods handle the events like pausing or restarting the videos?
Yes, in both scenarios, handling the required lifecycle events is also required to guarantee that the films are properly paused, restarted, and delivered as the user navigates the app.
While trying the suggested methods, ExoPlayer is getting 403 responses from the server, what should I do now?
The common meaning of a 403 response from a server is that the client does not have the authorization to access the requested resource. In order to access the resource, the client might need to authenticate or give the server legitimate credentials.
Additionally, the server could be set up to prevent specific user agents or IP addresses from accessing the resource. Verify the accuracy of the provided credentials and whether the server is set up to permit access from your client.