{"_id":"59bba3e215d1e1002426166e","category":{"_id":"59bba3e115d1e10024261656","version":"59bba3e115d1e10024261652","project":"55e6dcb32d0d3021000daf70","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-04T14:49:28.154Z","from_sync":false,"order":2,"slug":"player-parameters","title":"Parameters"},"project":"55e6dcb32d0d3021000daf70","user":"55e6dc8a2d0d3021000daf6e","parentDoc":null,"version":{"_id":"59bba3e115d1e10024261652","project":"55e6dcb32d0d3021000daf70","__v":1,"createdAt":"2017-09-15T09:56:49.752Z","releaseDate":"2017-09-15T09:56:49.752Z","categories":["59bba3e115d1e10024261653","59bba3e115d1e10024261654","59bba3e115d1e10024261655","59bba3e115d1e10024261656","59bba3e115d1e10024261657"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-04T14:57:44.614Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"All parameters on this page are optional\",\n  \"body\": \"For a working player, you don't need more than the four [mandatory parameters](doc:mandatory-parameters). All parameters on this page are optional, that means you don't have to use them.\"\n}\n[/block]\nafterglow will scale your video player according to the video's aspect ratio within it's parent element. The proposed way to create a player that you can style and size to your will with ease is to put a wrapper element around your video player. This way you can provide a width to your wrapper which afterglow will scale into.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<div class=\\\"videowrapper\\\">\\n  <video class=\\\"afterglow\\\" id=\\\"myvideo\\\" width=\\\"1920\\\" height=\\\"1080\\\">\\n  \\t<source type=\\\"video/mp4\\\" src=\\\"my/video.mp4\\\" />\\n  </video>\\n</div>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nThis setup allows you to scale the video dynamically or with fixed dimensions and to use media queries. Make sure to have your video wrapper have some kind of `position` in order to make it a scaling reference for child elements.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \".videowrapper{\\n\\twidth: 500px;\\n  position:relative;\\n  height: auto;\\n}\",\n      \"language\": \"css\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Disable responsiveness\"\n}\n[/block]\nIn order to disable this behaviour ('responsive scaling'), you have to pass this parameter to the player:\n\n---\n\n> data-autoresize=\"none\"\n\nIf you pass this parameter to your video element, afterglow will use the [width and height](doc:mandatory-parameters) you provided (or some other value you might have set via CSS). \n\n---","excerpt":"This page explains how to enable afterglow's reponsive scaling feature.","slug":"responsive-scaling","type":"basic","title":"Responsive scaling"}

Responsive scaling

This page explains how to enable afterglow's reponsive scaling feature.

[block:callout] { "type": "info", "title": "All parameters on this page are optional", "body": "For a working player, you don't need more than the four [mandatory parameters](doc:mandatory-parameters). All parameters on this page are optional, that means you don't have to use them." } [/block] afterglow will scale your video player according to the video's aspect ratio within it's parent element. The proposed way to create a player that you can style and size to your will with ease is to put a wrapper element around your video player. This way you can provide a width to your wrapper which afterglow will scale into. [block:code] { "codes": [ { "code": "<div class=\"videowrapper\">\n <video class=\"afterglow\" id=\"myvideo\" width=\"1920\" height=\"1080\">\n \t<source type=\"video/mp4\" src=\"my/video.mp4\" />\n </video>\n</div>", "language": "html" } ] } [/block] This setup allows you to scale the video dynamically or with fixed dimensions and to use media queries. Make sure to have your video wrapper have some kind of `position` in order to make it a scaling reference for child elements. [block:code] { "codes": [ { "code": ".videowrapper{\n\twidth: 500px;\n position:relative;\n height: auto;\n}", "language": "css" } ] } [/block] [block:api-header] { "title": "Disable responsiveness" } [/block] In order to disable this behaviour ('responsive scaling'), you have to pass this parameter to the player: --- > data-autoresize="none" If you pass this parameter to your video element, afterglow will use the [width and height](doc:mandatory-parameters) you provided (or some other value you might have set via CSS). ---