Interaction of external libraries with element from inside the element

137 views
Skip to first unread message

ram...@gmail.com

unread,
Feb 4, 2014, 6:27:54 AM2/4/14
to polym...@googlegroups.com

hi, I'm trying to create a jwplayer polymer element. I need to have the element I'm attaching the player to in the dom. I tried all the element's lifecycle callbacks with no success. How should I approach this?

The same issue also exists when I want to use jquery

Rami Grossman

unread,
Feb 4, 2014, 7:48:47 AM2/4/14
to polym...@googlegroups.com
Here is a simple exemple

בתאריך יום שלישי, 4 בפברואר 2014 13:27:54 UTC+2, מאת Rami Grossman:

Rami Grossman

unread,
Feb 4, 2014, 10:26:57 AM2/4/14
to polym...@googlegroups.com
thanks to locks from the #polymer IRC channel it works now when using lightdom. Is there a way to make it work with shadowdom? I read that lightdom is experimental and has some quirks
Thanks! 

בתאריך יום שלישי, 4 בפברואר 2014 14:48:47 UTC+2, מאת Rami Grossman:

Steve Orvell

unread,
Feb 4, 2014, 10:58:05 AM2/4/14
to Rami Grossman, polym...@googlegroups.com
The 'attached' method is called when the element is attached into the dom. I recommend using this and reporting any issues you encounter.

The lightdom option is being removed so I don't recommend using it.


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/31ec5c57-41bc-4cbe-ae67-220c27d7d017%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Rami Grossman

unread,
Feb 4, 2014, 11:10:25 AM2/4/14
to Steve Orvell, polym...@googlegroups.com
Hi thanks Steve!

I tried and it doesn
t work

Please have a look:

Steve Orvell

unread,
Feb 4, 2014, 1:21:50 PM2/4/14
to Rami Grossman, polym...@googlegroups.com
It looks like jwplayer must be initialized by giving it an id of an element in the main document. That's not compatible with ShadowDOM. Typically, libraries like this also have a way to initialize an element via a reference rather than just an id. I couldn't find that for jwplayer, but maybe I missed it.

Here's an example of how you might workaround this. It's not pretty, but without better support from jwplayer, this is what I'd recommend:

Rami Grossman

unread,
Feb 5, 2014, 3:03:37 AM2/5/14
to Steve Orvell, polym...@googlegroups.com
thanks for the workaround.

Does the attached method solves my issue and it just don't work well?
I guess there are many libraries which will have the same problem.

Rami Grossman

unread,
Feb 5, 2014, 4:45:15 AM2/5/14
to Sébastien Cevey, Steve Orvell, polym...@googlegroups.com
I just tested and it really works (passing the node) but not with shadowdom.


Any idea?


On Wed, Feb 5, 2014 at 10:56 AM, Sébastien Cevey <seb....@guardian.co.uk> wrote:

I've worked with jwplayer before and you can pass in either a document ID or a Node to jwplayer (at least in v6). It's buried in the docs somewhat but it is possible.


For more options, visit https://groups.google.com/groups/opt_out.
Please consider the environment before printing this email.
------------------------------------------------------------------
Visit theguardian.com   

On your mobile, download the Guardian iPhone app theguardian.com/iphone and our iPad edition theguardian.com/iPad   
Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access.
Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also
be privileged. If you are not the named recipient, please notify
the sender and delete the e-mail and all attachments immediately.
Do not disclose the contents to another person. You may not use
the information for any purpose, or store, or copy, it in any way.
 
Guardian News & Media Limited is not liable for any computer
viruses or other material transmitted with or as part of this
e-mail. You should employ virus checking software.
 
Guardian News & Media Limited
 
A member of Guardian Media Group plc
Registered Office
PO Box 68164
Kings Place
90 York Way
London
N1P 2AP
 
Registered in England Number 908396

--------------------------------------------------------------------------


Rami Grossman

unread,
Feb 5, 2014, 4:50:04 AM2/5/14
to Sébastien Cevey, Steve Orvell, polym...@googlegroups.com
ok, now it works:

thanks for your assistance

btw, why doesn't it work when I pass this.shadowRoot.querySelector("#playerInt")
it does work when I pass this.$.playerInt


Rami Grossman

unread,
Feb 5, 2014, 5:34:54 AM2/5/14
to Sébastien Cevey, Steve Orvell, polym...@googlegroups.com
oh it works when I use setTimeout

thanks everyone for your help!

Sébastien Cevey

unread,
Feb 5, 2014, 3:56:00 AM2/5/14
to Rami Grossman, Steve Orvell, polym...@googlegroups.com

I've worked with jwplayer before and you can pass in either a document ID or a Node to jwplayer (at least in v6). It's buried in the docs somewhat but it is possible.


For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages