Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

HTML Html5 video is laggy in browser

profoundDmd

New Coder
What's up everybody, got a question/problem here:

I created a website and would like to play some videos in it.

HTML:
<video id="oldtv" width="1200" height="680" data-setup='{}'>

  <source src="" type="video/mp4">

</video>

Src is empty because the actual link to the video is dynamically changed.

JavaScript:
$("#oldtv").find("source").attr("src", "video/vid" + (index + 1) + ".mp4");

The problem is that the video is played (very) laggy. Nothing too bad really, but it's not supposed to happen. I can play youtube-videos and stuff without any problem. This site won't be used online and will always run on localhost, so a slow internet connection is not the problem. When I open it in Quicktime player for example, it plays fine, not slow, no lag, nothing. But when I view it in my webbrowser it almost seems like it's being played over slow internet.... It happens in Chrome and FF (haven't tried other browsers), hardware acceleration does nothing. Videos are only around 70mb, not even full hd...yet. They're all mp4's, that shouldn't be a problem, right? Maybe there's something wrong with the html5 video-tag? Haven't used it before, so maybe i'm missing something obvious? Any suggestions?

Thnx!
 
Last edited:
What's up everybody, got a question/problem here:

I created a website and would like to play some videos in it.

<video id="oldtv" width="1200" height="680" data-setup='{}'> <source src="" type="video/mp4"> </video>

Src is empty because the actual link to the video is dynamically changed.

$("#oldtv").find("source").attr("src", "video/vid" + (index + 1) + ".mp4");

The problem is that the video is played (very) laggy. Nothing too bad really, but it's not supposed to happen. I can play youtube-videos and stuff without any problem. This site won't be used online and will always run on localhost, so a slow internet connection is not the problem. When I open it in Quicktime player for example, it plays fine, not slow, no lag, nothing. But when I view it in my webbrowser it almost seems like it's being played over slow internet.... It happens in Chrome and FF (haven't tried other browsers), hardware acceleration does nothing. Videos are only around 70mb, not even full hd...yet. There all mp4's, that shouldn't be a problem, right? Maybe there's something wrong with the html5 video-tag? Haven't used it before, so maybe i'm missing something obvious? Any suggestions?

Thnx!
Hi there, after some digging... it seems this was a common issue a few years ago. I found a few solutions you can try out, towards the end of this thread...

 
Back
Top Bottom