Getting Intrinsic HTML5 Video Dimensions

Posted by: K. Scott Allen, on 29 Nov 2011 | View original | Bookmarked: 0 time(s)

The HTML 5 DOM interface for a video element allows you to get the underlying video's width and height in pixels, but, be careful not to ask for the dimensions too early. If you ask as soon as the DOM is ready, like in the following code, you'll probably see width and height as 0. $(function () { var video = $("#video").get(0); var width = video.videoWidth; var height = video.videoHeight; // ... }); You'll want to wait for the video element to raise the loadedmetadata event before...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 267 | Hits: 16

Similar Posts

  • WebAii Testing Framework: From HTML to XAML and Back -- RadHtmlPlaceholder more
  • Simple jQuery Delete Link For ASP.NET MVC more
  • Html Encoding Code Blocks With ASP.NET 4 more
  • HTML Stripping Challenge more
  • ASP.NET MVC Controls and Good versus Evil more
  • Silverlight and Relative URIs for Image and Video Sources more
  • jQuery Delete Link With Downlevel Support more
  • VideoWicki A Open-Book Design-To-Delivery Silverlight 3 Project more
  • The Great Video Instruction Debate more
  • Silverlight and Relative URIs for Image and Video Sources more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD