Search code examples
htmlcssvideomp4

mp4 video not playing on iphone; box is blank


I have an mp4 video that I am trying to play on my website www.mylabzoe.com, and it is now not playing. It was playing before and now it stopped for some reason =(.

I tried changing type="mp4" to type="H.264/AVC". Do I need to change the type of file format for the video? I am trying to make this so that I can play it on PC's, Iphones, and androids. I definitely want to make this playable for mobile phones.

Just to clarify, this plays on my PC but will not play on my iphone using sarai or chrome.

<video id="videofetch" controls>
    <source src="D_Videos\William_VS_Lab_Playing_Fetch.mp4" type="mp4">
    <source src="D_Videos\William_VS_Lab_Playing_Fetch.mp4" type="video/ogg">
</video>
#videofetch {
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 2px solid white; 
    width: 12.5rem;
    height: auto;
}

/* 375 pixels */
@media (min-width: 23rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 12.5rem;
        height: auto;
    }
}

/* 425 pixels */
@media (min-width: 26rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 17.5rem;
        height: auto;
    }
}

/* 768 pixels */

@media (min-width: 48rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 22rem;
        height: auto;
    }
}

/* 1024 pixels */

@media (min-width: 64rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 22.5rem;
        height: auto;
    }
}

/* 1440 pixels */

@media (min-width: 90rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 30rem;
        height: auto;
    }
}
/* 2560 pixels */

@media (min-width: 160rem) {
    #videofetch {
        display: block;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid white; 
        width: 32.5rem;
        height: auto;
    }
}


Solution

  • You are using backslashes (\) in your video path. Windows tends to be ok with backslashes, but everything else prefers slashes (/). Also, the correct type is video/mp4 So try this:

    <video id="videofetch" controls>
        <source src="D_Videos/William_VS_Lab_Playing_Fetch.mp4" type="video/mp4">
        <source src="D_Videos/William_VS_Lab_Playing_Fetch.mp4" type="video/ogg">
    </video>