Allow dynamic change of src in video element
Short description:
The page embeds a video element. Depending on the platform (mobile vs. desktop mainly), the video source element points to specific CDN assets, in that case either a high-resolution MP4 or a low-res MP4 version.
An "HD" button allows the user to toggle between the different sources.
Currently, this is only doable through JS. We'd like an AMP version of that functionality to allow users/developers to change src
As an example, please refer to https://gfycat.com/OldfashionedShrillBorderterrier
You can do resolution dependent video with media queries on the <source> tag. It won't give you manual HD switching but it will give you the ability to switch automatically based on screen res.
<source src="video-small.mp4" type="video/mp4" media="all and (max-width: 480px)">
<source src="video-small.webm" type="video/webm" media="all and (max-width: 480px)">
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
/cc @ericlindley-g @rudygalfi /cc @aghassemi for context
Has some similarity to image-src-swapping based on thumbnail clicks in https://github.com/ampproject/amphtml/issues/4500. The UI is different, so it may strengthen the case for a generalized way of doing this.
Do we still need this FR? Thanks
yes, let's keep it.
+1 to keeping this for now. I should note that I think amp-bind covers this, using the amp-video component (you can see a demo in the last example on this page). Note that amp-bind is currently experimental, so it is not yet in production.
@ericlindley-g Can we close this issue? Looks like bind covers this use-case, as you mentioned.
+1 Closing