Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Access-Control-Allow-Origin and HTML5 skin

6 replies [Last post]
Reply

Hi folks,

I was trying to host a skin on Amazon S3. Well, it turns out you can't set Access-Control-Allow-Origin and the skin fails to load in HTML5 mode.

So, I made a little Python script that converts a zipped skin into a single self-contained JavaScript file with images embedded as data uris (the same way jwplayer.js has the default skin embedded).

Load the JavaScript skin right after jwplayer.js and it'll replace the default HTML5 skin with your own.

More details and the code are at: https://bitbucket.org/dbinit/jwskin2js

Note to JW Player authors - right now this code just replaces jwplayer.html5.defaultSkin. It would be great if multiple skins were supported by name like jwplayer.html5.skins['glow'] and have the loader check there before trying to download 'glow.xml'.
Or even better, make something like this standard and have the loader automatically try to load a JavaScript version with JSONP.

Reply

That is really awesome.

Reply

Hi DavidB, just wondered if you could point me in the right direction iv been trying to run your script but i keep getting an error would you know what I'm doing wrong?

James-MacBook-Pro:dbinit-jwskin2js-d3e61553ef20 jamesmunson$ python jwskin2js.py glow.zip
Traceback (most recent call last):
  File "jwskin2js.py", line 112, in <module>
    main()
  File "jwskin2js.py", line 108, in main
    process(args.zipfile, args.jsfile, args.embed)
  File "jwskin2js.py", line 66, in process
    skin_xml = parseString(zip.read(info))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py", line 1924, in parseString
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0

Many thanks

Reply

I'm not sure how often he browses this forum, you might want to try to contact him from - https://bitbucket.org/dbinit/jwskin2js as well.

Reply

THANX IN A MILLION

Reply

Thanks Ethan ill try that too and post back

Reply

Np

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options