How to zoom in and remove letterbox from a video (HTML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

The msZoom property can be used to zoom into a video to remove the letterbox or pillarbox from the rendered video.

Instructions

Using the msZoom attribute

If the native aspect ratio of a video frame, which is defined by the videoWidth and videoHeight attributes, does not match the aspect ratio of the Video tag, which is defined by the width and height attributes, the video is rendered with letterbox or pillarbox format. Letterbox and pillarbox are the black bars on either the left and right of the video or the top and bottom of the video.

When the msZoom attribute is set to True, the rendered video is trimmed to fit the dimensions of the Video object. Either the top and bottom of the video is trimmed or the left and right of the video is trimmed.

For instance, if the layout space for the video tag is a 4:3 aspect ratio, but the stream coming in is in 16:9 aspect ratio, the msZoom option can be used to render the 16:9 video in 4:3 aspect ratio. The rendered video will then take up the full space of the Video object.

This examples gets a Video object and sets the msZoom property to True.

   <script type="text/javascript">
       var myVideo = document.getElementById("videoTag1");
       myVideo.msZoom = true;
       myVideo.play();
   </script>

Media Playback Sample

msZoom