0

I've been spending a couple days getting my server all set up for a tube site. After much frustration everything is running nicely, except for the script's proprietary video player.

It basically is very crappy dealing with pseudostreaming, which is important for bandwidth reasons, so I decided to go with Flowplayer.

I have confirmed that Flowplayer will work, EXCEPT the script is so messy that I can't even figure out why the default setup won't work (Javascript invocation)


So, I resorted to using an object tag. Now it works for the most part, except I hardcoded in one specific video for testing.

What I need to is dynamically determine the video id based on the current video page, from the URL, and have it set in the external .js config dynamically. I'm stumped. To make things even more confusing (for me at least), the template engine is Smarty, and the {literal} tags just weren't working out in my favor, so I have to place the Flowplayer configuration in an external .js file on AWS.

Here is the object code : http://pastebin.com/P7TrWFGm

Here is the external config : http://pastebin.com/xXhkkKxk

The video page URLs are like : mysite.net/videos/7/example-title.html

The video files are stored as such : mysite.net/vdata/7.flv Where '7' is the video ID.

I would greatly appreciate any help, thank you.

Kendrick Ledet
  • 673
  • 6
  • 9

2 Answers2

0

No question other than the title: How do I parse current page path dynamically from an external Javascript config hosted on AWS?

I am shortening the question to: How do I parse current page path dynamically?

Answer: document.url

Get current URL in web browser

Community
  • 1
  • 1
Steve H.
  • 6,912
  • 2
  • 30
  • 49
  • But the fact that it's an external .js file still does come into play. The way it's referenced..I just can't figure out how to do it correctly. Could you possibly tell me how I would go about using this to set the property in the config object? – Kendrick Ledet Apr 11 '12 at 20:55
  • I tried this - 'url': 'http://mysite.net/vdata/' + location.pathname.substring(1) + '.flv', and just got a white screen from Flowplayer. I dont know why the editor is putting that semicolon is there, but it's valid Javascript in the file. – Kendrick Ledet Apr 11 '12 at 20:57
  • I also tried `'path_array': window.location.pathname.split('/'),` and referencing it using `'url': 'http://mysite.net/vdata/' + path_array[2] + '.flv',` . See, it's really not that simple given the whole setup. But thanks for the link – Kendrick Ledet Apr 11 '12 at 21:14
  • Also, `document.URL.split('/')` . I guess I'm just screwed, then. – Kendrick Ledet Apr 11 '12 at 21:33
0

I got it. I went back to the default Flowplayer configuration and used {ldelim} and {rdelim} and took out {literal}{/literal} entirely. Works nicely

Hope this helps someone in the future.

Thanks..I guess

Kendrick Ledet
  • 673
  • 6
  • 9