Video Not Being Responsive

David Schure
David Schure used Ask the Experts™
on
I have a video on a website.  The problem that I have that it's not resizing to fit phones, tablets, etc,

http://www.mediascrubber.com

margin-right: auto;
margin-left: auto;
display:block;

Open in new window


<video width="1000" controls>
  					<source src="media/Permission.mp4" type="video/mp4">
  					<source src="media/Permission.mp4" type="video/ogg">
  					Your browser does not support the video tag.
					</video>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi,

you can use a script like https://github.com/videojs/video.js

this will be easier to get it resized / responsive
https://docs.videojs.com/tutorial-layout.html#responsive-mode

Plus don't set a fix width as it won't resized...
You can use a min-width instead...

 or you can set your media queries with CSS
https://www.w3schools.com/css/css_rwd_mediaqueries.asp

Author

Commented:
Thank you but this is over my head.  This is suppose to work....

video {
margin-right: auto;
margin-left: auto;
display:block;
max-width: 100%;
height: auto;
}

Open in new window


but doesn't....
You have Bootstrap but you are not using it correctly, you have to use the syntax
check the grid layout and follow one of them
https://getbootstrap.com/docs/4.1/layout/grid/

container / row / column

<div class="container">
  <div class="row">
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
  </div>
</div>

Open in new window


You may want to take the time to learn Bootstrap 4 on Udemy there are plenty of free course on that topic
https://www.udemy.com/bootstrap-4-tutorials/

 if your video code is outside the grid it won't resized...
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
What are we looking for?

If I look at the site on a small screen the video resizes - what should I be looking for.
Analyst Developer
Distinguished Expert 2018
Commented:
Thank you but this is over my head.  This is supposed to work....

I totally agree with you, just make sure that you've added the rules inside the <style> tag :

<style>
    video {
        margin-right: auto;
        margin-left: auto;
        display:block;
        max-width: 100%;
        height: auto;
    }
</style>

Open in new window


Since as I can see right now there's no CSS rules for video inside the deployed project.

Example after adding the rules and resizing :

Screenshot_1.png

Author

Commented:
I just figured that out.  I thought that once that happened The site would center on the phone but I am still getting horizontal scroll bars for some reason.  Any help is appreciated.

video {
    /*margin-right: auto;
    margin-left: auto;
    display:block;*/
    max-width: 100%;
    height: auto;
}

Open in new window

Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Do you get the scroll bars in Mobile emulation
F12
Firefox click the icon on the top right of the dev console that looks like a small portrait rectangle on a larger one
Chrome Top left of dev bar the icon that looks like a phone.

Do you see scroll bars in either of these?

Author

Commented:
I don't see the scroll bars in Google Chrome Dev. window.  But I get them on my actual iphone 6.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial