dineshkummarc / projekktor

projekktor
Other
1 stars 0 forks source link

getting "Invalid or malformed playlist data!" issue for speakker player on local system. #3

Open dineshkummarc opened 11 years ago

dineshkummarc commented 11 years ago

getting "Invalid or malformed playlist data!" issue for speakker player on local system.

dineshkummarc commented 11 years ago

according to http://www.projekktor.com/support/81/how-to-cross-domain-the-playlist :+1:

We are attempting to create a Speakker player so it can be used cross domain. We got the player to work great so far from our current domain without an issue (even serving graphics and audio from signed S3 urls), but when testing from another domain, it fails to load the playlist.php file due to the cross domain policies of javascript. (Erroneously stating "Invalid or malformed playlist data!" as the .json is indeed valid that is generated, just not communicated back to the referring page.)

We realized this idea was referenced in the Docs (ie: "You can't apply http://www.speakker.com/opentape/code/projekktor.php to your local test installation or within a page at an other domain due to Javascript security restrictions.") But we really thought there would be a simple workaround.

Is there indeed a work around for this? We've been researching JSONP as it can allow for cross domain communication of JSON data but we cannot see how to implement it for Speakker. We do see that JSONP is referenced in projekktor.min.js, but man that thing is confusing and we seriously don't want to hack it. :)

Any tips?

Can we place the raw playlist data in the $('#speakkerSmall').speakker without calling the additional .php file that generates the .json? As that appears to be the only hiccup in passing that .json file back to referring page.

dineshkummarc commented 11 years ago

according to the answer they gave for that ::

Yes, you´re right. There IS jsonp support implemented - also for Speakker. In fact the "Docs" (well, I call it "docs" but...) are somewhat outdated. So to load a JSON playlist via JSONP just set the type accordingly to "text/jsonp".

On serverside the JSON data must be wrapped into a function. I wrote a little example for opentape a while ago: http://www.projekktor.com/docs/examples_opentape

And overthere you´ll find a live demo of it: http://www.speakker.com/opentape/code/projekktor.php?callback=projekktor%28%27ryoyqzzn%27%29._jsonp_reelUpdate

It looks complicated but it´s pretty simple at all.

The Projekktor - core also supports JSON-data to be pumped in via "setFile" directly without involving any asynchronous processes, e.g: projekktor('#myvideoplayer').setFile({...my playlist json...}); or with the config parameter "playlist" to be filled with the same. In order to use this with Speakker you´ve to hack the speakker.js at line 78: http://code.google.com/p/speakker/source/browse/trunk/speakker.js#78

Just change: Code:

playlist: [{0: {src: config.file, type: ( (config.playlist===true) ? 'text/json' : '') }, 'config':{title:config.title}}]

to: Code:

playlist: config.playlist

and set up Speakker like this: Code:

The playlist-format is described here: http://www.projekktor.com/docs/playlists

I hope this helps.

ghost commented 11 years ago

this is what i was suppose to post here. thanks for the same.