Project

General

Profile

WMediaPlayer errors

Added by Alan Finley over 8 years ago

I use WMediaPlayer to play flv videos. Sometimes when I open a page with my player I get a popup with this error:

Wt internal error: TypeError: Object [object Object] has no method 'jPlayer', code: undefined, description: undefined

After I reload the page, the player works fine.

This happens at random times. How can I fix this problem?


Replies (11)

RE: WMediaPlayer errors - Added by Koen Deforche over 8 years ago

Hey Alan,

That sounds like there is something wrong with the loading of the JavaScript file. What version of Wt is this?

Could you reproduce this in a test case?

Regards,

koen

RE: WMediaPlayer errors - Added by Alan Finley over 8 years ago

I use Wt 3.3.0.

I can't reproduce this because this error occurs at random times.

RE: WMediaPlayer errors - Added by Alan Finley over 8 years ago

I can reproduce another error with WMediaPlayer js file loading.

It's pretty simple:

#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WContainerWidget>
#include <Wt/WMediaPlayer>

Wt::WApplication* createApplication(const Wt::WEnvironment& env)
{
    Wt::WApplication *app = new Wt::WApplication(env);
    app->root()->addWidget(new Wt::WMediaPlayer(Wt::WMediaPlayer::Video));

    return app;
}

int main(int argc, char **argv)
{
    return WRun(argc, argv, &createApplication);
}

If I start to continuously reload this page (I just hold down the F5 key) I get this error:

Fatal error: failed loading /resources/jPlayer/jquery.jplayer.min.js

RE: WMediaPlayer errors - Added by Koen Deforche over 8 years ago

Hey,

I can reproduce that too (after a while) but that is really expected behavior: the download of the JavaScript file is being cancelled by the refresh and then this error is the result (since Wt cannot differentiate between a cancel by the user versus a network problem).

However you should not get this if you are not cancelling/refreshing the page while it is loading?

Regards,

koen

RE: WMediaPlayer errors - Added by Alan Finley over 8 years ago

I'm really concerned with this problem.

If it appears first time I can navigate through my app withtin a single session and always get the same error.

Maybe I can somehow 'preload' WMediaPlayer js files when new session is created?

RE: WMediaPlayer errors - Added by Alan Finley about 8 years ago

I still get this problem in version Wt 3.3.1.

Maybe this call stack may help:

Wt internal error: TypeError: Object [object Object] has no method 'jPlayer', code: undefined, description: undefined, stack:
TypeError: Object [object Object] has no method 'jPlayer'
    at eval (eval at doJavaScript (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:2662:14), <anonymous>:3:27)
    at eval (eval at doJavaScript (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:2662:14), <anonymous>:43:92)
    at eval (native)
    at doJavaScript (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:2662:14)
    at handleResponse (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:2683:7)
    at handleResponse (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:362:6)
    at XMLHttpRequest.recvCallback (http://192.168.77.143:9097/wt?wtd=0oj3w7fm8A6AJP06&sid=-1330861007&tz=240&htmlHistory=true&deployPath=%2Fwt&request=script&rand=318017471:388:6)

RE: WMediaPlayer errors - Added by Alan Finley about 8 years ago

I've found these lines in the WMediaPlayer sources:

LOAD_JAVASCRIPT(app, "js/WMediaPlayer.js", "WMediaPlayer", wtjs1);

std::string res = WApplication::relativeResourcesUrl() + "jPlayer/";

if (!app->environment().ajax())
  app->require(res + "jquery.min.js");

Is it possible to check at runtime whether those js files were loaded, and if not, try to load them again?

RE: WMediaPlayer errors - Added by Koen Deforche about 8 years ago

Hey Alan,

If you don't get an error (with a popup) then it's loading fine.

Can you isolate this in a test case, perhaps there is something relevant in how you instantiate and use the media player?

Regards,

koen

RE: WMediaPlayer errors - Added by Alan Finley almost 8 years ago

Koen Deforche wrote:

If you don't get an error (with a popup) then it's loading fine.

Can you isolate this in a test case, perhaps there is something relevant in how you instantiate and use the media player?

I've made an example that reproduces my problem and filed a bug

RE: WMediaPlayer errors - Added by Georgiy Gluhoedov almost 8 years ago

You need to run the following command in the console:

sudo ln -s /usr/share/Wt/resources/ ~/Qt5.3.1/Project/WT/build-NAME_OF_YOUR_APPLICATION-Desktop_Qt_5_3_GCC_32bit-Debug/

and collect the sample application: http://www.webtoolkit.eu/widgets/media

RE: WMediaPlayer errors - Added by Alan Finley almost 8 years ago

Georgiy, I already have a correct link to Wt resource directory. The problem reproduces when I load custom jQuery only.

    (1-11/11)