Error calling method on NPObject

3,661 views
Skip to first unread message

Davide Prati

unread,
Jan 12, 2012, 9:33:11 AM1/12/12
to vhx...@googlegroups.com
  1. Hello, i'm tring to embed this example https://raw.github.com/gist/1217547/553ddf5bf0a4c842aa4a29837160c3b20791b850/megaplaya-advanced-embed.html in local. If i use the url video url give in the example, http://vimeo.com/api/v2/vhx/videos.json, there is no problem, when i try to change it with another url that displays a json response, I have this error:

  2. Uncaught Error: Error calling method on NPObject.
    1. megaplaya_call
    2. (anonymous function)
    3. onclick

      Does anybody know a solution?

Davide Prati

unread,
Jan 12, 2012, 9:51:59 AM1/12/12
to vhx...@googlegroups.com
That was the error in chrome. in Firefox i've got this: "uncaught exception: Error in Actionscript. Use a try/catch block to find error."

Casey Pugh

unread,
Jan 12, 2012, 11:05:03 AM1/12/12
to vhx...@googlegroups.com
Hi Davide - What's the URL you are using that's causing it to break? 

Davide Prati

unread,
Jan 12, 2012, 11:43:33 AM1/12/12
to vhx...@googlegroups.com, ca...@vhx.tv
Hey Casey, thanks for your answer.
This is the url

Davide Prati

unread,
Jan 12, 2012, 11:45:41 AM1/12/12
to vhx...@googlegroups.com, ca...@vhx.tv

Casey Pugh

unread,
Jan 12, 2012, 12:30:22 PM1/12/12
to vhx...@googlegroups.com
For me it seems to be a JSON parsing issue:

$.ajax({
      type: "GET",
      dataType: "jsonp",
      success: function(videos, status, ajax) {
        if (videos) {
          megaplaya.api_playQueue(videos);
        }
      },
      error: function() {
        console.log(arguments);
      }
     });

If you add an "error" callback to $.ajax, you'll see that jQuery fails to parse the JSON response. Here's the output I received: http://sht.tl/OmrhT

I'd check to make sure your server isnt doing anything funky with it's JSON response.

Davide Prati

unread,
Jan 12, 2012, 1:09:42 PM1/12/12
to vhx...@googlegroups.com
thanks, I'll check the json response.
Another question, can I use the same example with an xml files?
dataType: "xml"
and then read an external xml file?

Casey Pugh

unread,
Jan 12, 2012, 1:24:55 PM1/12/12
to vhx...@googlegroups.com
You can use any format you'd like as long as the end result is an array of objects containing a "url" attribute that gets passed to the video player.

Here's a basic example:

Jamie Wilkinson

unread,
Jan 12, 2012, 1:32:31 PM1/12/12
to vhx...@googlegroups.com
To clarify: that "dataType" param is part of jQuery's $.ajax function, which I believe handles xml, but might require some massaging.

I think your JSON issues might be caused because your JSON is not JSONP, which requires a ?callback=foobar parameter. jQuery is hiding some of this magic:

      dataType: "jsonp",

is functionally equivalent to:

        dataType: "json",

The "Error calling method on NPObject" was an exception from the VHX megaplaya, but like Casey pointed out it was caused by the malformed JSON. We'll add more informative debugging to the player.

-jamiew

Davide Prati

unread,
Jan 12, 2012, 2:35:47 PM1/12/12
to vhx...@googlegroups.com


On Thursday, January 12, 2012 7:32:31 PM UTC+1, Jamie Wilkinson wrote:
To clarify: that "dataType" param is part of jQuery's $.ajax function, which I believe handles xml, but might require some massaging.
Yes, probably some massaging. I've written a script that parse the youtube api and generates a static file. Probably for this purpose an XML file it's better than a JSON file.The generated file is something like this http://www.iocose.org/files/videos.xml but it doesn't work.
I will work it out tomorrow,
thanks for your answer
Reply all
Reply to author
Forward
0 new messages