TricomB2B / object-fit-videos

Polyfill for object-fit and object-position CSS properties on video elements. Works with IE9-11, Edge, Safari <10.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Video autoplays when resizing window

MadMaxMcKinney opened this issue · comments

I'm using WinJS in a UWP app and currently the video seems to re-render during page resizing, which if you have the video set to autoplay in the html video tag means it will play again during the resize.

My workaround is to set autoplay to false in the html tag and manually trigger a play in JS, this prevents it from playing again during a re-render. However this functionality should be looked at if possible to allow the native html autoplay tag to work as intended.

We trigger play() if autoplay is set, because otherwise the video does not autoplay at all in Edge and IE (believe those were the two trouble browsers). The resize event uses the same function to size the video as the initial video sizing, so it triggers play() as well. I don't think it would be too difficult to implement, but I don't think this is that big of a deal so without a PR I am not sure when I'd be able to implement.

Out of curiosity, what's your usecase where this is an issue that users would care about?

We use the video as a background image that plays upon first load and then stays static on the last frame. It's a small utility application so it works out well in terms of visuals while still scaling nicely. The UI also animates in during the initial load.

This is why having the video repeat itself when the user resizes the window looks strange, the background randomly disappears and plays the 'intro' again.

I guess I'm wondering how often does a user actually resize their window in your app? It's not something we typically worry about. It's not typical user behavior. They just don't resize their browsers very often while they are using an app, unlike web developers who resize their browser often...

That said I do agree that ideally we'll keep the default browser behavior in place. I'm not arguing against it, I'm just not too worried about it. If you were able to submit a PR we could get it published much sooner.

We are building a Universal Windows Platform application with WinJS as the tech stack for it. I agree that most users don't resize their web browser very often, but we've experienced a large amount of people who will resize their regular application windows. Not only that but because it's a UWP app it is a requirement that it is very scalable to various sizes.

I'll get a PR up soon for y'all.