Ticket #1091 (closed bug: fixed)
Percentage width and height fail for setup call
| Reported by: | zach | Owned by: | zach |
|---|---|---|---|
| Priority: | Milestone: | Player 5.4 | |
| Component: | html5 | Keywords: | |
| Cc: | Forum thread: | http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/14953/flash-works-at-100-width-and-height-but-html5-player-does-not |
Description
"When I enter width: "100%", height: "100%" the Flash player displays fine at 100%, but the HTML5 player does not. If I hard code a <video> tag I can set it at 100%"
This should work for both mechanisms
Change History
comment:2 Changed 3 years ago by zach
if (typeof config.width == "string" && config.width.lastIndexOf("%") > -1){
percentage = parseFloat(config.width.substring(0, config.width.lastIndexOf("%"))) / 100;
config.width = Math.round(container.parentNode.getBoundingClientRect().width * percentage);
}
if (typeof config.height == "string" && config.height.lastIndexOf("%") > -1){
percentage = parseFloat(config.height.substring(0, config.height.lastIndexOf("%"))) / 100;
console.log(container.parentNode.getBoundingClientRect());
config.height = Math.round(container.parentNode.getBoundingClientRect().height * percentage);
}
Note: See
TracTickets for help on using
tickets.
