question about bookmarklet

18 views
Skip to first unread message

steven hodges

unread,
Sep 28, 2014, 7:19:02 PM9/28/14
to media...@googlegroups.com
Hi...

We're very close to having a working local instance of the Fall 2014 release -- there's just one issue (I think) that remains -- the bookmarklet does not recognize media on pages from our institutional media repository. This worked in previous Mediathread releases, and I'm not sure what has changed. I think my options are either to write a new hosthandler, or figure out why the jwplayer5 assethandler isn't seeing the media.

Before I spend time on either of those, I wanted to see if it's obvious to anyone what the problem is. The code on the player page seems pretty simple:


This is using jwplayer6 rather than 5, but I don't see any obvious reason it should not work the same -- in looking at the jw6 code, it looks like the functions that the bookmarklet uses are still there -- but I'm not good enough with javascript to really know what I'm doing.

I would be grateful for any pointers. Thank you--

-steve

steven hodges

unread,
Sep 29, 2014, 7:07:25 PM9/29/14
to media...@googlegroups.com
Hi again...

Looking into this a bit more, it seems that jwplayer6 has changed in several ways from jwplayer5, and in general the API seems a bit stripped down. I hacked together this stanza that seems to work, at least for purposes of the media source we need to use:


But my feeling is that there MUST be a better way to do this, other than this ugly hack. Some notes:

-sendEvent apparently no longer exists

-getPlaylist seems to have been replaced with jwGetPlayList

-getConfig and getPluginConfig seem not to exist either; instead I used jwGetWidth and jwGetHeight or left things out that it seemed like I could live without, like startparam

-it seems like item.file now contains info that used to be divided between item.streamer and item.file; and since it seems that having the double // between the conjoined string is important in Mediathread, I made a step to manually insert that (blech!)

Anyway, just passing this along in case it's of use to anyone else.

Jed Davis

unread,
Oct 2, 2014, 10:57:51 AM10/2/14
to media...@googlegroups.com
Steve,

I meant to post this reply a few days ago:

In comparing the existing bookmarklet code to what is on the page I found a few things:

Mainly, the "obj" variable (argument) being passed to the jwplayer function is not a function... rather it a reference to the video embed (html). So, none of the functions on the jwplayer are available in this context. 

Also from what I can see,  it appears the JWPlayer code is missing a few methods on the JS object. For example jwGetPlaylistIndex() is now just getPlaylistIndex(). This might be a bug on our side, but also sendEvent, getConfig, and getPluginConfig are no longer there. Instead the newer JWPlayer is using a .config namespace on the object and not a get function. 

If you are curious to write a domain exception (which imho, might be easiest) I would start with creating a instance of the player object on the page to do all your work. So a:

var playerInstance = new jwplayer();

then you can do:

playlistIndex = playerInstance.getPlaylistIndex()
config = playerInstance.config

etc...

I hope this helps.

On Sunday, September 28, 2014 7:19:02 PM UTC-4, steven hodges wrote:
Reply all
Reply to author
Forward
0 new messages