Chrome not respecting video source inline media queries

后端 未结 3 741
渐次进展
渐次进展 2021-02-13 00:24

Using the below, Chrome is not respecting the media queries to display the correct video source based on the device width. Chrome is just playing the first source it finds as yo

3条回答
  •  清酒与你
    2021-02-13 00:48

    Unfortunally, Chrome is not supporting media queries for video html 5 tag. A work around for this is to use plain Javascript or Jquery. It is no pretty, but works even in chrome.

    var video = $('#myvideo');
    
    var WindowWidth = $(window).width();
    
    if (WindowWidth < 1200) {
        //It is a small screen
        video.append("");
    } else {
        //It is a big screen or desktop
        video.append("");
    }
    

提交回复
热议问题