I have a super simple video player on Android TV / Fire TV, basically my UI is just a 'Layoutmatching parent and then inside aPlayerView` also matching parent.
On both Android TV and Fire TV on different TVs I'm getting about 2.5% overscan. I can easily correct for this following the guidelines of Android TV development but should I make that apply to all my users? I fear that if I release an update with this then some users will end up with the video not filling the entire TV. Is there maybe a way to know if I need to account for overscan?
This is my layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/black"
tools:context=".connected.VideoFragment">
<com.google.android.exoplayer2.ui.PlayerView
android:id="#+id/videoView"
app:surface_type="texture_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="#layout/custom_player_controls" />
</androidx.appcompat.widget.LinearLayoutCompat>
Edit: I would like to mention that I played a YouTube video in the YouTube app that shows you the amount of overscan and the YouTube app also has 2.5% overscan. Replicated this on 3 tvs.
The amount of overscan is specific to the TV panel. Some TVs don't have any but some have up to 5%. Some models allow the user to adjust the overscan, but not all unfortunately. For professional video (e.g., Hollywood movies or TV shows), overscan is considered in the framing of all the content, so it's safe to go edge-to-edge. Some TVs will cut off a small portion of the video, but it won't be anything vital like titles, subtitles, etc. For other types of video, it can be more problematic, especially for screen recordings where menus and tools can be cut off, so it depends on your use case a bit. You can consider making it user-adjustable.
For all of your non-video content, you should account for the overscan for anything important to the user (menus, buttons, text, etc.) but typically a background image will go edge-to-edge. A simple XML layout would be something like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Screen elements that can render outside the overscan safe area go here -->
<!-- Nested RelativeLayout with overscan-safe margin -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="27dp"
android:layout_marginBottom="27dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp">
<!-- Screen elements that need to be within the overscan safe area go here -->
</RelativeLayout>
</RelativeLayout>
Note: If you're using the AndroidX Leanback fragments (e.g., BrowseSupportFragment), then overscan is handled for you.
Related
I have a problem with my toolbar when using my KitKat device. On my lollipop device everything works fine.
The problem is that my toolbar doesnt notice my touch in my action button in the toolbar.
I've already tried using a cardview but that didnt helped me.
Also with the cardview my toolbar doesnt fill the hole space in my KitKat device
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0610DB"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="0dp">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0610DB"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:minHeight="?attr/actionBarSize"/>
</android.support.v7.widget.CardView>
I am trying to show images in a full screen view and using the following code:
// Target to write the image to local storage.
Target target = new Target() {
// Target implementation.
}
// (1) Download and save the image locally.
Picasso.with(context)
.load(url)
.into(target);
// (2) Use the cached version of the image and load the ImageView.
Picasso.with(context)
.load(url)
.into(imgDisplay);
This code works well on newer phones, but on phones with 32MB VMs, I get out of memory issues. So I tried changing (2) to:
Picasso.with(context)
.load(url)
.fit()
.into(imgDisplay);
This resulted in distorted images. Since I do not know the dimensions of the image until it is downloaded, I cannot set the ImageView dimensions, and hence the image is being resized without any consideration to aspect ratio in to my ImageView:
<ImageView
android:id="#+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
What is the best way to handle this situation? My original images have max width 768, and height 1024, and I want to downsample when the screens are much smaller than this. If I try to use resize(), my code becomes complicated, as I have to wait for (1) to finish the download and then add the resize() in (2).
I am assuming Transformations do not help in this case, as the input to public Bitmap transform(Bitmap source) will already have the large bitmap which will cause me to run out of memory.
You can combine fit() with centerCrop() or centerInside(), depending on how you want the image to fit your View:
Picasso.with(context)
.load(url)
.fit()
.centerCrop()
.into(imgDisplay);
Picasso.with(context)
.load(url)
.fit()
.centerInside()
.into(imgDisplay);
I tell the window to create with a size of 32x32
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
showStatusBar="false"
width="32"
height="32">
but it appears like this
The yellow box is an image that's 32x32.
try setting minWidth=32 minHeight=32
You have something in your window that is more than 32X32 so the window got resized to fit its content, sharing your full code will help us finding the problem.
The AIR application config xml file has a minwidth property. I assume you're on windows. In that case, the close, minimize, fullscreen buttons should always be visible, so you can't make smaller window (try resizing notepad.exe to understand). If you want smaller, you have to make a chromeless application / window (again in the config xml). That will allow you to create 1x1 px windows as well, but you'll have to add your own close button.
<systemChrome>none</systemChrome>
I'm using mxml to create a spark video player with controls. When I click on the "fullscreen" button in Chrome, it goes full screen on the browser but I am unable to go back to normal size. In Internet Explorer, the whole screen is filled up but the zoom on the video is too big and thus my controls are no longer visible.
Is there any way that I can use ActionScript to control the size of the fullscreen? How would convert the mxml to Actionscript to override this?
Thanks!
Source code from: Flex Video Player
The code I'm using to create the player:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:VideoPlayer
source="video.flv"
horizontalCenter="0"
verticalCenter="0"
autoPlay="false" />
</s:Application>
You can try to constrain the area for fullscreen display using stage's fullScreenSourceRect property.
In the opening application tag of my Flex 4 app, I set the width and height properties as follows:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
backgroundColor.mainState="0x303030"
xmlns:components="components.*"
width="798"
height="240">
What I go into Design mode in Flash Builder 4, the app is the correct size. But when I embed the .swf file into a HTML page, the application's background color covers the whole screen, and when the Flash Player Settings message box pops up it is outside of the area I defined in the code above. What am I doing wrong? Thanks for reading.
Set the Flex Application width and height to 100%.
No matter what, the html template's width and height are always 100%,
you have to set the flex application width and height to 100%. Flex
Application itself cannot render on the browser. It needs some kind
of wrapper to render it on the browser. Hence Flex Application gets
wrapped inside an HTML template and the Browser eventually renders
the Flex Application.
Flex Application --> HTML Template --> Browser
Check the index.template.html in the html-template folder. That's the file that generates your index.html when you build; perhaps you could address your problems in there.