Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9123333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:18:50+00:00 2026-06-17T06:18:50+00:00

I try to build a local JS-based mediathek with HTML5 video. the code is

  • 0

I try to build a local JS-based mediathek with HTML5 video. the code is the same like in this JSBIN, where it is working well for online content. but when I use this code with local files (like you could find here) Safari throws the error

INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an
object that is not, or is no longer, usable.

after starting the video the third time by klicking on the thumb image, which opens the player and loads the video URL.

the error comes from ‘$vplayer.currentTime = 0.0;’ without this line the problem stays, but no error is thrown at all.

I know this error means that the video is not loaded and it is caused by – but why did it load the first two times before?

edit: I also tried different approaches with absolute paths from ‘file://’ to ‘file:///’ – nothing changes.

edit: I found out that this behaviour is gone when using the browser engine of a objective-c WebView component (iOS). also it works when using chrome. so it seems to be a bug of safari?

the code used:

<html>

<head>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />    
</head>
<body>

  <div data-role="page" id="gamepad">
    <div id="videolink">
    </div>
            <div data-role="popup" id="vplayerpopup" data-position-to="window" data-overlay-theme="a" data-theme="a" class="ui-content" data-tolerance="5,5,5,5" data-transition="fade">
            <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
            <video id="vplayer" width="640" height="360" controls> 
                <source id="vsource" src="" type="video/mp4" />
            </video>
        </div>

  </div>

</body>
</html>

and

var $videoblock =   '<div class="ui-block-a videoblock">'
    +                   '   <div class="videoPreviewImageWrapper">'
      +                 '       <a href="#vplayerpopup" data-rel="popup" onclick="mediathekVideolink = \'http://blog.gingertech.net/wp-content/uploads/2011/01/LCA_MM_AVProc2011/HelloWorld.mp4\';">'
        +                   '           <div class="videolink">'
          +                 '               <img src="http://leanbackplayer.com/videos/poster/sintel_640x360.jpg" width="218" height="164" alt="Movie Title">'
            +                   '               <div class="mediathek_film_titel">Movie Title</div>'
              +                 '               <div class="mediathek_film_dauer">03:56</div>'
                +                   '               <div class="mediathek_film_text">Some Text about the video</div>'
                  +                 '           </div>'
                    +                   '       </a>'
                      +                 '   </div>'
                        +                   '</div>';

$('#videolink').append($videoblock);

var mediathekVideolink = 'none';
var mediaplayerIsPlaying = false;

$( '#gamepad' ).live( 'pagebeforeshow', function(){

    $( "#vplayerpopup" ).on({
            popupbeforeposition: function(opt1, opt2) { //console.log('mediathekVideolink: ' + mediathekVideolink);
                //console.log('popupbeforeposition');
                $('#vsource').attr('src', mediathekVideolink); 
                var $vplayer = $('#vplayer').get(0); 
                if(!mediaplayerIsPlaying) {
                    $vplayer.load();
                    $vplayer.play();
                    mediaplayerIsPlaying = true;
                }
            },
            popupafterclose: function() {
                //console.log('popupafterclose');
                mediaplayerIsPlaying = false;
                var $vplayer = $('#vplayer').get(0); //console.log('currentTime: ' + $vplayer.currentTime); console.log('currentSrc: ' + $vplayer.currentSrc);
                $vplayer.pause();
                $vplayer.currentTime = 0.0;
            }
        });
});

$( '#gamepad' ).live( 'pagehide', function(){
    $( "#vplayerpopup" ).off();

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:18:51+00:00Added an answer on June 17, 2026 at 6:18 am

    I now managed to work around this by refreshing the page every time I close the videoplayers popup using

    function stopVideo(n){
        mediaplayerIsPlaying = false;
        var video = document.getElementsByTagName('video')[n];
        video.pause();
        location.reload();
    }
    

    this is only the worst case workaround solution – but at least I can deliver this as ‘kind of working’…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've used this tutorial to build OpenCV on ubuntu. Everything goes well until I
I try build wrap panel with vertical buttons. Every button consist from image and
I try to build a JSF 2.0 Web application which is using libraries including
I try to build a nice box with only 1 image and 1 div.
I try to build a metro-style-app with Javascript and when I run the Windows
i try to build a app that is in landsscape mode all the time.
Im try to build my plugins that sit in a seperate directory on the
I try to build libtorrent(rasterbar- libtorrent). It cannot be build. the build log is
I try to build project in Eclipse on Linux Ubuntu. Eclipse show error message:
When I try to build a project in Visual Studio 2005 that has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.