I am using ExoPlayer to play my streams. I have implemented Picture in Picture which works pretty good but i haven't been able to implement play, pause controls on PiP window until now. I know that by defaul Exoplayer + Picture in Picture does not give us the Picture in Picture media controls we see in the Youtube player for instance.
Anyway i searched a lot about this issue, and found out a code that may help me but the problem is that the code is in Kotlin and i am using Java, as a beginner i wasn't able to find the alternative code for Java to make it work.
This is the recommendation i got:
val mediaSession = MediaSessionCompat(this, packageName)
val mediaSessionConnector = MediaSessionConnector(mediaSession)
mediaSessionConnector.setPlayer(player, null)
mediaSession.isActive = true
I know that i should implement it onStart() after handling Exoplayer. I thinked about converting my project in Kotlin but as a beginner i would like to focus in Java and instead find a way to fix this.
Android will show media controls in Picture-in-picture mode automatically if there is an active media session for the app.
https://developer.android.com/guide/topics/ui/picture-in-picture
Also, the code you posted belongs to the media session extension library for exoplayer, so you need to add it to your build.gradle
https://github.com/google/ExoPlayer/tree/release-v2/extensions/mediasession
Related
I have array list of videos so users can watch video in android app. I would like to add Next and Previous button for playing next or previous video after current video is ended. I googled it but to no avail. I need your help. Thanks in advance. 🙏🏾
If you're using the MediaPlayer class then maybe try adding logic to the callback for setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener) that takes the user to the next video by getting what's next from the list and starting playback.
See Android Docs for more information. Without knowing what you're trying it's almost impossible to help you solve your problem. Please share the code from your solution related to your question.
Since using Card.io for credit card scanning,
I had to face with some limitations and looking for alternative solutions.
The issues;
1- Is there any way to customize 'KEYBOARD' button on scanning screen?
2- Is there a way to start my own view after clicking on 'KEYBOARD' button?
3- Is there any way to start my own view after scanning the card for entering expiration date, cvv, card holder name?
It doesn't look like the Card.io library provides any way to modify the text of that button.
It doesn't look like they provide any way to hook your own logic into the button either.
On iOS, it's possible to use the CardIOView class to integrate a card scanning component into your own view which would allow you to implement whatever flow you'd like... but on Android, there doesn't seem to be an equivalent to that class.
It seems like the Card.io library is rather limited on Android, but I haven't yet been able to find any viable alternatives that support both iOS and Android.
I'll try to create transition animation between headers list and BrowseFragment like in this video on 44 second:
google developers video.
Maybe a must use BrowseTransitionListener, but i don't understand how.
Thanks.
This animation is built in, but does not work on API level 17.
Unfortunately it's not in the documentation.
I'm trying to show some information about the currently casted media inside the cast menu like this. The example apps provided by Google are using the CastCompanionLibrary, which won't be available in my project.
There isn't any hint in the Development Guide, so I really hope that there is anybody out there who knows how to do this.
Thanks in advance!
You need to write your own MediaRouteDialogFactory which needs your MediaRouteControllerDialogFragment which needs your MediaRouteControllerDialog.
Then use it via [Cast Icon] or [action bar menu item].setDialogFactory(yourMediaRouteDialogFactory).
Best to take a look at the Video Sample App.
Is the question about how to get info, or you are also asking about how to show a custom dialog when a cast icon is clicked on *while casting)? As for information, the image you referred to currently shows (a) some metadata about the media that is playing there (icon, title, ..) and (b) the playback status (paused/playing). These info are available from RemoteMediaPlayer.getMediaInfo() and getMediaStatus(). You should also register the dialog to listen to updates to media status and metadata so when the dialog is open, it can reflect the changes.
CCL is just a wrapper around the SDK apis so you can look at its code to see how it is using the SDK apis to accomplish these tasks.
I have created a media player and it is working. The issue I have is that only the video names are displayed in my list view. How can I see the name and a thumbnail image of the video in my list view?
Came across this SO Thread while searching to answer your question. Not sure if that will work on Android or not. You give it a try.