I'm working on a simple audio streaming app based on the Media app architecture from official Android documentation:
By using the MediaControllerCompat I'm trying to achieve the Repeat/Shuffle controls. But most of the options aren't working. E.g:
The following code enables shuffling:
getTransportControls().setShuffleMode(PlaybackStateCompat.SHUFFLE_MODE_ALL);
But if I set the mode to none the player is still shuffling and has no effect for cancelation.
getTransportControls().setShuffleMode(PlaybackStateCompat.SHUFFLE_MODE_NONE);
Also the single/all repeat option isn't working
getTransportControls().setRepeatMode(PlaybackStateCompat.REPEAT_MODE_ONE);
getTransportControls().setRepeatMode(PlaybackStateCompat.REPEAT_MODE_ALL);
Am I missing anything?
Related
How to properly use the VLC video player. I want the video to play with a pause/resume button, Seekbar, and some default features displayed on the player. There is no official documentation. Could you please assist me in locating the correct one?
LibVLC for Android is not like ExoPlayer. It does not come with a companion UI class or anything like that. Therefore, you have to build your very own UI for it.
A very good starting point would be to use ExoPlayer's very own UI and customize it to your need. Then you need to do your own bindings and listeners for the buttons.
LibVLC will be responsible for playing the video and anything related to the task, but it does not have anything that delegates user interaction with it. You have to do it manually.
If you face issues controlling and putting LibVLC to use, then you need to thoroughly inspect the code of VLC for Android. They made everything open-source so that's already a great thing. Check VLC Android - Repository
We want to play some YouTube videos in my React Native app without YouTube branding. We would like to give the user experience as if the video is playing in a native player. We already tried with webview, react-native-youtube-iframe but still, we are not able to achieve our goal. Either top or bottom section has a YouTube logo, then watch and share options are visible. We want to eliminate those. Any possible way to do this in React Native?
URLs of Youtube videos are different for normal videos and embedded videos.
Normal: https://www.youtube.com/watch?v=DGQwd1_dpuc
Embed: https://www.youtube.com/embed/DGQwd1_dpuc
Please change 'watch?v=' with '/embed/'.
You can also hide controls and information by passing 'showinfo=0' or 'controls=0'.
I recently tried to achieve the similar thing in one of my android app if you can somehow use this particular library
This is an android library and as you mentioned you want to do it in android.
android-youtube-player
I have used this library where i used a player with custom control which helps you override the controls and also this share and next button and even the youtube logo.
Let me know if you need any help further.
Edit:
To enable web UI
IFramePlayerOptions options = new IFramePlayerOptions.Builder().controls(1).build();
Then initialize the player with this controls.
You won't see any logo now.
I'm doing an App for android using delphi FMX and TWebbrowser, the user would select a video from the listview which will then playback the video in a TWebbrowser control, the problem I'm facing is, even if the video is a youtube video as an example, I press on the maximize symbol, the video wont go fullscreen, nothing changes. is the a work around or am I doing something wrong. thanks. I'm using delphi 10.3.3
You're not doing anything wrong - TWebBrowser needs to use a descendant of WebChromeClient (something that must be done in Java) that implements certain methods, as per this article:
https://medium.com/#oliverdamjan2013/fullscreen-youtube-video-in-webview-android-21f1c778cf56
I do something similar in this demo:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
Which makes use of a descendant of WebChromeClient that implements onShowFileChooser. The folder that has the Java code is here:
https://github.com/DelphiWorlds/Kastri/tree/master/Java/WebChromeClient
The code could be extended to implement the necessary methods (onShowCustomView etc) as per the other article linked to.
EDIT 10-NOV-2020
I've now updated the underlying Java code and updated the demo here:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
(rather than create a whole new demo)
To support viewing YouTube videos full screen. Please note that the demo relies on files in the Kastri library
I am developing a Android TV music app. I want to develop following UI. However the sample Google provide is using deprecated classes. Their documentation states to use the following classes.
I cant understand how to use MediaPlayerAdapter with PlaybackTransportControlGlue extending PlaybackSupportFragment to get the UI similar to MusicConsumptionFragment where one has CoverPhoto, title, description and a list of rows for episodes with like and add to playlist action.
I want to develop UI similar to this and referring to samples ClassicsKotlin and LeanbackShowcase (deprecated classes used in MusicConsumptionFragment to build Player UI). Classic Kotlin sample has a example to video and uses a UI for Video Playback but I want a Audio Player UI
I need help with understanding to build audio player UI, or change the Video sample UI into audio player UI.
I'd like to code my phonegap app so at a minimum the audio that is streaming/playing can stay active across pages. Even better would be a way to have it interact with the OS and stop when a call comes in or they play their own music or something else.
Has anyone accomplished either of these things yet?
Thanks!
The PhoneGap Media API plays just fine in the background on both iOS and Android.
In iOS you have to make sure to set the required background modes to include playback of audio:
"Support for some types of background execution must be declared in advance by the app that uses them. An app declares support for a service using its Info.plist file. Add the UIBackgroundModes key to your Info.plist file and set its value to an array containing one or more of the following strings:
audio—The app plays audible content to the user while in the background. (This content includes streaming audio or video content using AirPlay.)"
I don't think anything extra is required for Android.
NOTE: If you have multiple "pages" in your app and music must continue to play amongst them, be sure that the page changes are not actually "file" changes (i.e.: you are still really displaying index.html, just changing content via js/ajax/etc). The common mobile JS frameworks handle this just fine (jQuery Mobile, jQTouch, etc etc).