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

  • SEARCH
  • Home
  • 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 9207143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:19:30+00:00 2026-06-18T00:19:30+00:00

How do I debug my own video because at the moment no alert is

  • 0

How do I debug my own video because at the moment no alert is appearing. I am using IE9 and the player is jwplayer. Am I missing something or have I put the javascript code for debugging in wrong place because I tried to put it below and above the jwplayer element. Am I suppose to see the alert when I click on play or is it suppose to appear straight away?

<div id="myElement">Loading the player...</div>

<?php echo 'This is the videoPath '.$dbVideoFile; ?>

<script type="text/javascript">

    jwplayer("myElement").setup({
        file: "<?php echo $dbVideoFile; ?>",
    });


var myvid = document.getElementById('myElement');
if (myvid.error) {
 switch (myvid.error.code) {
   case MEDIA_ERR_ABORTED:
      alert("You stopped the video.");
      break;
   case MEDIA_ERR_NETWORK:
      alert("Network error - please try again later.");
      break;
   case MEDIA_ERR_DECODE:
      alert("Video is broken..");
      break;
   case MEDIA_ERR_SRC_NOT_SUPPORTED:
      alert("Sorry, your browser can't play this video.");
      break;
 }
}
</script>
  • 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-18T00:19:31+00:00Added an answer on June 18, 2026 at 12:19 am

    First of all you’re trying to get error from div element instead of video, second thing you’re trying to do that instantly when code is loaded – jwplayer runs probably on page/document load or at least with some timeout and in that particular moment there is no player yet. You should attach callback function to onError jwplayer event and then try to find what is wrong. Also MediaError code constants are not defined in global scope, they are bound to MediaError object, so you should use for example MediaError.MEDIA_ERR_ABORTED instead of just MEDIA_ERR_ABORTED

    jwplayer("myElement").setup({
        file: "<?php echo $dbVideoFile; ?>",
        events: {
            onError: function (message) {
    
                console.error('Video error: ' + message);
    
                // note that jwplayer is replacing your original div element with new one with same id
                // you can try to get video tag created by jwplayer:
                var videos = document.getElementById('myElement').getElementsByTagName();
                if (videos.length && videos[0].error) {
                    switch (videos[0].error.code) {
                        case MediaError.MEDIA_ERR_ABORTED:
                           alert("You stopped the video.");
                           break;
                        case MediaError.MEDIA_ERR_NETWORK:
                           alert("Network error - please try again later.");
                           break;
                        case MediaError.MEDIA_ERR_DECODE:
                           alert("Video is broken..");
                           break;
                        case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
                           alert("Sorry, your browser can't play this video.");
                           break;
                        default:
                           alert('Unknown error');
                           break;
                    }
                }
            }
        }
    });
    

    see documentation for jwplayer events

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

Sidebar

Related Questions

I have written my own assertion debug. #define ASSERT_EQUALS(a,b) \ do { \ if
in php i wrote my own debug function which have two arguments: text and
I have my own sandbox/testing system and I want to rewrite g/something to g/something.php
Debug HTTP is easy, you have all sort of tools to do it (like
I run wsgen in its own profile because I don't want it to run
I'm wondered is it possible to debug .net embedded js files in WebStorm? Because,
I have a project due soon about using signals and sighandlers and I'm essentially
How can a user of a library run his own initialization code (setting debug
I created my own library with path: library/Mylib . I have a class in
I'm a web developer working on my own using django, and I'm trying to

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.