Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Killeon Patterson
Killeon Patterson
18,528 Points

Video/image is breaking the browser

Hello, I'm using local mp4 and png files in my React project. When I add these files, it appears to be effecting my browser. It freezes the developer toolbar and won't allow me to open the responsive views. When I remove the media files and restart the server, the browser works as expected. Do you have any suggestions how to get better result from my media files? Thank you for your time. Best, Killeon.

import React, { useState, useEffect } from 'react';
import axios from 'axios';
import '../video.css';

function VideoHold () {



  return(
      <div className="container ">
      <div className="shadow-sm p-1 mb-4 card-title"
            style={{
              marginTop: "1%",
              fontFamily: "Gowun Batang, serif",
              fontSize: "30px",
              lineSpacing: "1px",
              textAlign: "center",
              border: "solid",
              borderTop: "none",
              borderRight: "none",
              fontWeight: "bold",
              borderLeft: "none",
              borderColor: "silver",
              borderWidth: "2px",
              borderRadius: "10px"

          }}> </div>

          <div className="labelHead">
            <h1 className="lead">
              PDX Community
            </h1>
          </div>

    <div className="divVid">
        <h1 className="titleH">Taco Gang PDX </h1>
         <p className="addy"> 2623 SE Belmont St, Portland, OR 97214</p>
    <video className="theVideo" controls muted >
     <source src="./Taco Gang Mexico 2.mp4" type="video/mp4">
     </source>
     </video>

    </div>


    <div className="divVid">
        <h1 className="titleH">Escape From New York </h1>
         <p className="addy">622 NW 23rd Ave, Portland, OR 97210</p>

    <video className="theVideo" controls muted >
     <source src="./escape from the pizza.mp4" type="video/mp4">
     </source>
     </video>

    </div>


    <div className="divVid">
        <h1 className="titleH">Shawarma Express</h1>
         <p className="addy">1825 N Williams Ave</p>

    <video className="theVideo" controls muted >
     <source src="./shar.mp4" type="video/mp4">
     </source>
     </video>

    </div>


    </div>
  )
}

export default VideoHold;


```CSS 

.labelHead {
  border-radius: 30px;
  margin-bottom: 2.7%;
  border: 1.5px solid #000;
  background-color: #fff;
}

.lead {
  font-weight: 500;
  font-family: 'Segoe UI';
  font-size: 1.2em;
  margin-left: 2%;
  margin-bottom: .3%;
}


.divVid {
  display: inline-block;
  padding: 5px;
  margin-top: 1%;
  margin-left: 3.1%;
  width: 100%;
  length: 100%;
   border: 1px none silver;

}

.titleH {
  font-size: 45px;
  margin-left: 9%;
  margin-bottom: 1px;
}

.addy {
  font-size: 20px;
  margin-left: 9.5%;
  margin-bottom: 2%;

}

.theVideo {

  margin-left: 9%;
  width: 75%;
  length: 83%;

}

.socialIcon {
 margin-left: 50%;
 margin-top: 2%;
  margin-bottom: 5%;
}

.bigIdea {
  margin-left: 20%;
  max-width: 61%;
  max-height: 61%;
}

@media only screen and (min-width: 360px){

  .titleH {
    font-size: 25px;
    margin-left: 9%;
    margin-bottom: 1px;
  }

  .addy {
    font-size: 12px;
    margin-left: 9.5%;
    margin-bottom: 2%;

  }

  .socialIcon {
   margin-left: 47%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

@media only screen and (min-width: 412px){

  .socialIcon {
   margin-left: 47%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

@media only screen and (min-width: 540px){

  .socialIcon {
   margin-left: 48%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

@media only screen and (min-width: 768px){

  .socialIcon {
   margin-left: 49%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}


@media only screen and (min-width: 912px){

  .socialIcon {
   margin-left: 49%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

@media only screen and (min-width: 1024px){

  .socialIcon {
   margin-left: 50%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

@media only screen and (min-width: 1280px){

  .titleH {
    font-size: 45px;
    margin-left: 9%;
    margin-bottom: 1px;
  }

  .addy {
    font-size: 25px;
    margin-left: 9.5%;
    margin-bottom: 2%;

  }

  .socialIcon {
   margin-left: 50%;
   margin-top: 2%;
    margin-bottom: 5%;
  }


}

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I can't say that it's behaviour I've ever noticed before from adding media in HTML.

Could you post the code you've been trying to use to make it work and we'll see if we can get to the bottom of why that might be happening. Thanks. :)

Killeon Patterson
Killeon Patterson
18,528 Points

Hello Jonathan,

Thank you for your response. I got the browser to respond like I expected, but it sometimes takes refreshing. On Microsoft Edge it works as expected every time. I think maybe the size of the video files might be too big and causing it to act funny? I have experienced other errors because of that reason. That's why I think that.

I did edit the code above to show my React and CSS code, if you did have time to look it over. Either way, thank you for your time.

Best, Killeon