Chromecast v3: Mini Controller showing progressbar instead of Play/Pause button - android

I am using below way to integrate mini_controller in my chromecast app. However, I always seeing progressbar instead of pause/play button in mini controller.
<fragment
android:id="#+id/cast_mini_controller"
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:castControlButtons="#array/cast_mini_controller_control_buttons"
app:castProgressBarColor="#color/colorPrimary"
app:castShowImageThumbnail="true" />
Can anybody please suggest what can be the issue it might be?
I tried various articles and none of them able to resolve this issue. All is working fine except the fact that I can not pause the chromecast video through mini controller inside my app as its showing progressbar always.
Note: My application is using queuing mechanism in order to load the chunk of videos at once.

Make sure you are specifying the correct set of buttons for the fragment:
<array name="cast_mini_controller_control_buttons">
<item>#id/cast_button_type_rewind_30_seconds</item>
<item>#id/cast_button_type_play_pause_toggle</item>
<item>#id/cast_button_type_forward_30_seconds</item>
</array>

I know it's old, but... I've had a similar problem, - always is showing only 2 instead of 3 buttons. My solution is 'app:castShowImageThumbnail="false"'. After that, 3rd button appears.
https://developers.google.com/cast/docs/android_sender/customize_ui#choose_buttons
"Note: If app:castShowImageThumbnail="false", the album art will be hidden and slots 1, 2, and 3 will be available for control buttons. Otherwise, since the album art will be shown in slot 1, you can provide an empty button for slot 1 and control buttons for slots 2 and 3."

Related

Chromecast - Lock screen/Notification/Mini Controller - Stop Button instead of a Pause button

I've implemented Cast SDK 3 into my application for Android, everything is working as expected when following the guidelines from the Cast SDK website, the only thing that I can't wrap my head around is the button for play_pause_toggle_button, the screen shot from the Cast SDK website shows a proper pause button, but I get stop button instead (in which pauses the video) is there something I'm not doing correctly that may not be obvious?
First post, please go easy :)
If I were to guess, I would say you have set the stream type of your MediaInfo objects to MediaInfo.STREAM_TYPE_LIVE. If so, change them to MediaInfo.STREAM_TYPE_BUFFERED and see if that fixes your problem.

Is this possible to fix these issues in roku?

Im working on a roku app using scene graph component. I am facing many issues like...
During video buffering i want to pause video. Im using this code but not working
video.control = "pause"
During video buffering a blank screen is displaying. I want to show last video image instead of blank screen.
I want to show dialog box to check internet connection on splash screen.
Is this possible to use BrightScript component like "roImageCanvas" or "roListScreen" in scene graph component?
Since Im working first time on brightscript so i don't know does roku supports this type of job or not.
Please suggest any ideas to fix the above issues.
Thank you
1) Not sure what's causing it for you, please share the code for better help.
2) I don't think Scene Graph enables you to do that yet! Couldn't find any reference to any such ability.
3) In your main.brs, at the very beginning you can use Dialog node to show a dialog box, to show message or to take input (buttons), and to check for the network you can use the method GetLinkStatus() of the object roDeviceInfo.
4) For all the substtues for Brightscript Components, look up here: https://sdkdocs.roku.com/display/sdkdoc/Transitioning+to+Scene+Graph

Youtube API Player on Android Automatically pauses every 2 seconds

I'm making an app that uses the YouTube API to play YouTube videos. When I go into full screen mode, I switch the player style to CHROMELESS because I want to create my own set of media controls.
I have developed a set of gestures that map to changing volume, brightness, and seeking. When these changes occur, a progress bar pops up over the video showing the user their changes in real time. I have placed all my Views in a single FrameLayout in order to get the progress bars to show up on screen when the player is fullscreen.
The problem is that (before I added volume control functionality) the video would automatically pause as soon as I entered fullscreen mode. I am handling orientation and screenSize changes myself. I noticed that it would pause roughly 2 seconds after my personally made seekbar would pop up.
So for testing, I altered my code by NOT changing the player style to CHROMELESS, that is, I left it as DEFAULT. I removed my seekbar as well and now the video worked fine; I could change brightness and play the video with no problem. During another test, I removed all instances of youtubePlayer.pause() from my code, left the seekbar in, and changed back to CHROMELESS. But the problem returned--so it must be something to do with the seekbar.
Now, however, I have added volume control functionality and when I run it (even when I'm not fullscreen) the player pauses almost immediately after I press play and it doesn't work at all afterwards.
Can anyone help me out? I'll add some of my code when I get back to my computer. I really appreciate your help.
Following reasons are among the most common ones:
UNAUTHORIZED_OVERLAY - Other views overlapping with youtube view
PLAYER_VIEW_TOO_SMALL - Youtube view too small
USER_DECLINED_RESTRICTED_CONTENT - Trying to play restricted content
BLOCKED_FOR_APP - Certain videos are blocked for app.
You can read about these and other problems in detail at link
You can not Cover anyView on YoutubePlayView that should be clean.
try the following
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/player_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
If you want that youtube android player controls do not show after every two seconds. you have to true focusable in your layout.
<com.google.android.youtube.player.YouTubePlayerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/youtube_view"
android:focusable="true"
android:layout_height="match_parent"
android:layout_width="match_parent" />
I think your problem is due to your controls overlaying the player. Take a look at your logcat to verify.
As mentioned in the YouTubePlayerView JavaDoc, "it is not permitted to overlay the [player] view with other views while a video is playing".
Take a look at this question: Views overlayed above YouTubePlayerFragment or YouTubePlayerView in the layout hierarchy cause playback to pause immediately
This problem can be easily solved using a library that I've build: Android-YouTube-Player. Other than being more stable than the official API this library gives you more freedom, eg. you can overlay whatever you want to your player.
Please check the logcat to identify your issue.
When i had the issue, it was because of UNAUTHORIZED_OVERLAY.
<RelativeLayout
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/scImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
<FrameLayout
andriod:id"#+id/youtube_parent
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
The imageview was below the framelayout which had the youtube player. I moved it to the top (The final, fixed layout is the example above) and it started to work.(I tried setting the Zindex it didnt help).
For my case, I have the status bar in the player activity. Just set the acitivity with full screen style to fix the issue
Remove paddings and margins in your Youtube Viewlayout
The problem is only with the layout, the YouTube Player doesn't permit any view staying over it, neither invisible nor transparent.
In order to make this visible in your device, enable layout bounds in developer option. (warning with paddings and margins)
OR
Use below code. I hope it's working
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Google Glass Android : How can i use voice trigger from current Activity (to switch cards from cardscroller)

I am using a cardscrollview in an Activity to show text and pitcures on different cards.
Today i can scroll by using touchpad and swipe left or right but i want to scroll between cards using voice.
Example : when i say "next" i would like to scroll forward, and when i say "prev" i would like to scroll backwards.
I saw different answers on stackoverflow like this one or this one and it looks like you can't include GlassVoice.jar anymore (tried it but not working). I saw on google documentation that i could use Contextual voice commands but i don't really understand how to include it for my case.
I would like to have something like that :
if(voicetrigger == "next"){
scrollForward();
}
Do you think it's possible to do ? I would be grateful if someone could help me or have ideas to make it work.
Thanks
Implement contextual voice commands with menu items such as "Next" and "Previous." Once one of those items is triggered, call setSelection(int position) on your CardScrollView with the parameter being either the current position + 1 or -1.
Here's a sample of how I use that method in my onMenuItemSelected:
mCardScroller.setSelection(mCardScroller.getSelectedItemPosition() + 1);

How to Have multiple buttons inside Android SlidingDrawer Control

I am making a quiz application in which i am planning to use the SlidingDrawer control for displaying different question numbers. Clicking on a number will allow the user to jump to a specific question.
I have implemented the sliding drawer control but it is able to display only 6-7 buttons inside it depending on the screen size. Trying to add more buttons to it gives an exception.
I tried using a GridView inside the SlidingDrawer but i keep getting an error.
Is there anyway i can have around 20-30 buttons inside the SlidingDrawer control arranged in a grid like manner ?
Please give suggestions on any other way i can implement similar functionality in a way that doesn't take up much screen space ?
Yes, it's possible, as a matter of fact previous Android versions (1.6 if I'm not wrong) implemented the application Launcher that way.
Search the source for that version and you'll have a working sample.

Categories

Resources