aspect-ratio

How can I scale video in ExoPlayer-V2 - Play Video In Full Screen

不羁的心 提交于 2019-11-29 01:00:25
问题 I am playing video from URL on Exoplayer , it stretching the video on resizing/on using resize_mode as I have mentioned in layout file using this I am not able to maintain the aspect ratio of video. I want to do scale type CENTER_CROP like we do in TextureSurface as mentioned in image2 but I am getting output as image1 I have tried following example Exoplayer Demo Example My Output (Img 1) and Expected Output (Img 2) exoplayer layout code <com.google.android.exoplayer2.ui.SimpleExoPlayerView

Pure CSS Solution - Square Elements? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-11-28 21:18:29
This question already has an answer here: Maintain the aspect ratio of a div with CSS 22 answers If I have a <div> with a relative width (such as width: 50% ), is there a simple way to make it have the same width as it does height without resorting to JavaScript? Tomasz Kowalczyk It is actually possible to achieve it with this neat trick i found at this blog #square { width: 100%; height: 0; padding-bottom: 100%; } Hope that helps No, and Yes (Kinda) Okay, so the short answer is "no," not possible. The long answer is, "yes," given certain constraints and concessions (i.e. extra html markup,

Algorithm to resize image and maintain aspect ratio to fit iPhone

江枫思渺然 提交于 2019-11-28 20:37:09
问题 I'm creating a web service for an iPhone app to interact with. When my client uploads images server-side, I want my php script to resize the image, whilst maintaining the aspect ratio , so that it will fit onto the iPhone screen. (i.e. the longest side is <= 960 and the shortest <= 640 I've created a mock-up in JS, simply because I find it easier to do quickly. I'm pretty sure, though I may be wrong, that this isn't the most efficient way of doing it. Could someone correct me with either

Multiple screen resolutions/aspect ratios (games)

泪湿孤枕 提交于 2019-11-28 15:37:34
问题 EDIT: Thanks for all your answers and comments. After thinking about it i would rephrase the core of the question to: "How to determine and limit the minimum resolution/ratio my game is able to run on". Because imo either the game becomes unplayable on the smallest screen/ratio (lack of detail) or supporting even the smallest screen/ratio degrades the experience for all the others significantly. Besides we do not even know what the smallest resolution is or can restrict it in any way other

Maintain aspect ratio of a div according to height [duplicate]

半腔热情 提交于 2019-11-28 12:19:22
This question already has an answer here: Maintain div aspect ratio according to height 4 answers I have to maintain the aspect ratio of a div with respect to the height on window resize. I can maintain the aspect ratio(x:y) with regard to the width(X%) using padding-bottom; or padding-top; . So from the analogy, I tried using padding-left; .wrapper{ height: Y%, position: relative; } .wrapper:after{ padding-left: Y(x/y)%; display:block; } But the percentage value of padding-left does not give any width to the wrapper. How can I maintain the aspect ratio of that div according to its height? As

Make table cells square

∥☆過路亽.° 提交于 2019-11-28 04:59:08
How to ensure that each cell of table should become square without using fixed sizes? And be responsive when they change width. table { width: 90%; } td { width: 30%; } tr { /** what should go here? **/ } <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> <table> web-tiki You can use the technique described in: Grid of responsive squares . Adapted to your usecase with a table and square table cells , it would look like this: table { width: 90%; } td { width: 33.33%; position: relative; } td:after { content

How Can I Only Allow Uniform Resizing in a WPF Window?

ぐ巨炮叔叔 提交于 2019-11-28 04:34:48
I don't want my window to be resized either "only horizontally" or "only vertically." Is there a property I can set on my window that can enforce this, or is there a nifty code-behind trick I can use? Gant You can reserve aspect ratio of contents using WPF's ViewBox with control with fixed width and height inside. Let's give this a try. You can change "Stretch" attribute of ViewBox to experience different results. Here is my screeen shot: <Window x:Class="TestWPF.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Proportionally resize iframe to fit in a DIV using jQuery

蹲街弑〆低调 提交于 2019-11-28 00:25:41
I have an iframe of a video inside a div, like so: <div class="media"> <iframe> </div> I set the DIV's size dynamically on window resize. I want to scale the iframe to fit inside the div, while maintaining it's aspect ratio . Most of the code out there deals with scaling images, which is easier. This is what I have so far, but it doesn't work: jQuery.fn.fitToParent = function() { this.each(function() { var width = jQuery(this).width(); var height = jQuery(this).height(); var parentWidth = jQuery(this).parent().width(); var parentHeight = jQuery(this).parent().height(); if(width < parentWidth)

Fixed aspect ratio View

…衆ロ難τιáo~ 提交于 2019-11-27 19:09:08
问题 How would I go implementing a fixed aspect ratio View ? I'd like to have items with 1:1 aspect ratio in a GridView . I think it's better to subclass the children than the GridView ? EDIT: I assume this needs to be done programmatically, that's no problem. Also, I don't want to limit the size, only the aspect ratio. 回答1: I implemented FixedAspectRatioFrameLayout, so I can reuse it and have any hosted view be with fixed aspect ratio: public class FixedAspectRatioFrameLayout extends FrameLayout

Fixed aspect ratio View

五迷三道 提交于 2019-11-27 17:31:05
How would I go implementing a fixed aspect ratio View ? I'd like to have items with 1:1 aspect ratio in a GridView . I think it's better to subclass the children than the GridView ? EDIT: I assume this needs to be done programmatically, that's no problem. Also, I don't want to limit the size, only the aspect ratio. TalL I implemented FixedAspectRatioFrameLayout, so I can reuse it and have any hosted view be with fixed aspect ratio: public class FixedAspectRatioFrameLayout extends FrameLayout { private int mAspectRatioWidth; private int mAspectRatioHeight; public FixedAspectRatioFrameLayout