I'm trying to fit an arbitrary number of HD videos on screen so that they all have equal size, maximizing the size of the videos, with no scrollbars appearing.
Given N number of tiles of equal aspect ratio (16:9), displayed in a viewport of arbitrary height and width, how can I resize the tiles so that:
a) all tiles are the same size
b) all tiles maintain their aspect ratio
c) all tiles fit within the viewport (i.e., no scrolling)
d) the tiles are as large as possible, while maintaining c)