Removing elements from within the YouTubePlayerView in Android - android

My YouTube video shows an overflow menu, full screen, open in YouTube buttons from within the YouTubePlayerView or the YouTubePlayerFragment.
Is there any way to remove those items? I can't find anything in the docs.
Thanks.

Add the style YouTubePlayer.PlayerStyle.CHROMELESS in initialization to completely remove all available controls.
In onInitializationSuccess add ytPlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);.
Check here for more details.
Edit : You can add your own controls using either a DialogFragment or Dialog on top of the YoutubePlayer. This will allow you to control playback completely using your own buttons and seekbar. And it does the trick of removing Youtube App Button from player.

Yes You can disable full screen from default player,You need to just use below code with your player object.
//To disable full screen mode.
player.setShowFullscreenButton(false);
Use above line to hide full screen button from your default youtube player.Hope this will work for you.

Related

Custom TimeBar in ExoPlayer

I would like to create a custom timebar in exoplayer using PlayerView that:
cannot be dragged by user but only shows the progress in the video
UPDATE: Ok, so I was able to disable dragging by setting the touch_target_height to 0dp!
allows the underlying PlayerView to be clickable (I am losing clickability of PlayerView due to the controller on top)
is always shown on the PlayerView surface (the custom controller appears only on clicking PlayerView once)
I tried using DefaultTimeBar in a custom controller layout but couldn't disable dragging of time bar. Also, the controller is only shown when tapped I have tried the following so far:
On PlayerView component of layout XML, have added the following to disable hiding of controller, but it still requires clicking PlayerView the first time for controller to show up.
app:show_timeout="0"
app:hide_on_touch="false"
I need to capture onClick event on PlayerView which I was able to until I introduced the custom controller layout. I have PlayerView both focusable and clickable
android:focusable="true"
android:clickable="true"
Also, in an attempt to disable dragging of time bar in DefaultTimeBar, I did the following but it only removes the thumb (or scrubber) from the time bar, doesn't disable dragging:
app:scrubber_enabled_size="0dp"
app:scrubber_disabled_size="0dp"
app:scrubber_dragged_size="0dp"
Any ideas on how to do these 3 things?
Thanks,
AB
Regarding the third thing you can try to do it programmatically.
You can ovveride this methods in your DefaultTimeBar:
onScrubStart(...)
onScrubMove(...)
onScrubStop(...)
and implement your logic for each of them (maybe a simple return is enough).
Please check this link for more details: OnScrubListener

Android - Master/Detail flow with Media Player

how develop this type of layout?
if song playing then it show otherwise not..
which should display over master/Detail.... as well update progress of playing song.
i want it for Android 4.0 or above for both portrait & landscape
Please Help me..
In my opinion you should use FrameLayout. You can declare NavigationDrawer with ListView as the first layout (NavigationDrawer reference) and then a "steering" of music player layout with progressbar as the second. The progress bar can be achieved with a SeekBar.
You can show/hide the second layout programmatically with setVisibility(int visibility)
Here you have a nice reference and tutorial.

How to show Activity overlaying on another Activity?

I want to show a volume bar (SeekBar) when a speaker button is pressed. Changing the whole Activity just for a SeekBar might not be a good decision.
I think overlaying that SeekBar would be the best solution. (But how?)
How would you solve this problem?
You could use your own customized dialog and automatically dismiss it if the user hasn't touched the screen after a short while, but I would like to ask exactly why you need it.
The reason: not all Android devices even have volume buttons.
If you wish, you can easily just set the volume control to be MEDIA instead of the ringtone volume, so that if the user accesses the volume , it will show the control of the MEDIA . Here's how you do it:
setVolumeControlStream(AudioManager.STREAM_MUSIC);
I think you should use a custom Dialog with a SeekBar set as content.
As a side note, remember to get rid of the title requesting the right feature to your window:
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

adjust_pan behavior in Webview in fullscreen

I am trying to solve the issue that in my Webview, when a user selects a textfield, the keyboard that appears covers the text field below.
Instead, I need a behavior where the text field is moved right above the keyboard, like what the flag SOFT_INPUT_ADJUST_PAN would do.
Based on testing, it seems like by default on a Webview, it is displaying the keyboard below the field.
But my WebView is in fullscreen. I am calling this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN) in my activity);
and this seems to make android stop doing the default 'pan and scan' behavior.
I've tried to call
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
and even
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
but that did not fix it.
I need to set the activity to fullscreen because I want to hide both the title bar and the status bar, so removing it is not an option unless there is another way to hide the status bar.
Any idea on how to solve this issue?
Laurent
You need to remove FLAG_FULLSCREEN flag. There is a bug somewhere in the OS machinery and with some digging around i have found the following:
without any extra scroll view around web view adjustPan never worked for me. Unfortunatelly the add scroll view also not always helps.
adjustScroll works for me when FLAG_FULLSCREEN is not present for the activity the webview is in.
So to sum it up the safest option to go with when it comes to WebView is adjustResize not full screen activity.
For me this worked:
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Disable user controls in an Android VideoView object

I'm working on an app that plays a video. I cannot find a way to disable the user video controls (Play, pause, go to 1:23, etc...)
How do I remove the user controls from that object? Ideally the bottom bar of controls will not even show up.
VideoView doesn't have controls built in so I'm assuming you have a MediaController set up in your code, which has the controls that appear when tapping the screen and then go away. If that's the case you can remove it and your problem should be solved.

Categories

Resources