简体   繁体   中英

How do I parse current page path dynamically from an external Javascript config hosted on AWS?

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM