Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-17 19:12:55

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

File download not working

Hi. Ive used the file download txp tag to insert the url to a video in a flash player but the generated URL is wrong. (ive changed the domain name to a generic one in this code example)

i get..

<script type="text/javascript">
var so = new SWFObject("/assets/player/720.swf", "flvplayer", "720", "480", "9");
so.addParam("FlashVars", "flvAddress=http://www.domain.co.uk/file_download/4/video.flv");
so.addParam("quality", "high");
so.addParam("wmode", "transparent");
so.write("flashcontent");
</script>

surely the url should be www.domain.co.uk/files/video.flv

When I access the url it fails to link to the video. Im using the current release, however i did update the database from a local mamp install. Could this be causing a problem?

Thanks for any insights.

Last edited by CodeWalker (2010-02-17 19:20:56)

Offline

#2 2010-02-17 19:33:12

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

OK some more info…when i go to the download section of text pattern in the admin, i can click the link to file and it does indeed start a download of the video. My guess is that flash isnt aware of the apache rewrites. It needs a real un modified url to work. How do i get around this?

Thanks

-CW

Offline

#3 2010-02-17 19:37:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,942
Website GitHub

Re: File download not working

CodeWalker wrote:

surely the url should be www.domain.co.uk/files/video.flv

Nope, the download tag will make a link to the file via the (pseudo) /file_download URL. This is so the download can be counted towards the stats: txp does some verification of file status, logs the file access, updates the database counter, etc, and then hands off control to the actual /files/video.flv file for downloading.

When I access the url it fails to link to the video.

You mean, directly? i.e. if you visit www.domain.co.uk.file_download/4/video.flv directly from the browser? If so, the main thing to check would be your advanced preferences. The Path to files entry might be wrong (which could well still be pointing to your local mamp installation). Try that and let us know how you get on.

EDIT: Ah, our posts crossed. Looks like the path is correct then. In which case, perhaps it is apache. Odd, though. Alternatively it could be the flash script. What happes if you hand-craft your javascript block containing the swfobject and change the URL directly to /files/video.flv? Does it work then?

Last edited by Bloke (2010-02-17 19:41:30)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2010-02-17 19:43:22

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

Thanks bloke. This is a tried and tested flash script ive used many times before so i know it works and i built the actual player with VideoMaru. So must be something else up. Is there a way to get just the filename rather then the whole url? if so i cud fudge it by hardcoding the first half of the url. Bit sloppy if you ask me.

ill try hardcoding the url as a test

Any thoughts?

-cw

Last edited by CodeWalker (2010-02-17 19:44:45)

Offline

#5 2010-02-17 19:45:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,942
Website GitHub

Re: File download not working

CodeWalker wrote:

if so i cud fudge it by hardcoding the first half of the url. Bit sloppy if you ask me.

Yeah, it is but if the script asks for the direct link there’s not much else you can do other than:

flvAddress=<txp:site_url />/files/<txp:file_download_name />

or equivalent in your file_download_list form/container. Not quite ideal. Can’t think of any other solution off the top of my head, though others migt have some insight here.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2010-02-17 19:49:07

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

ive hard coded the real url (not generated by textpatterm) and the videoplayer works great so its the url being rewritten thats the prob. thanks bloke if thats the only way to go. i am on the verge of cheking out ur remoted download plugin, would that be of use?

Offline

#7 2010-02-17 19:55:52

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

bizzare. Ive tried the way u suggested and it doesnt show up yet its indentical to hardcoding it. Perhaps the video player is trying to access the url BEFORE textpattern has done its thing and put the url together. bummer.

Offline

#8 2010-02-17 19:58:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,942
Website GitHub

Re: File download not working

CodeWalker wrote:

i am on the verge of cheking out ur remoted download plugin, would that be of use?

Not sure. It still redirects via /file_download so in this case it might not work. I have used it successfully for storing large vids on remote servers though, and delivering them to flash players to play in the browser, so it can be done. Just depends on the player I guess. Might require some lovin’ (or some additional swfobject parameters to allow it to understand redirects — stabbing in the dark here)?

Another thing you could try is the Live HTTP Headers plugin for Firefox (or Firebug’s Net pane). That might give you some more insight into what’s going on and whether the flv player is choking on the URL.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2010-02-17 20:00:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,942
Website GitHub

Re: File download not working

CodeWalker wrote:

Perhaps the video player is trying to access the url BEFORE textpattern has done its thing and put the url together. bummer.

Yeah maybe. Does wrapping the javascript block in jQuery’s:

jQuery(function() {
   // js here
});

help at all so the DOM is fully loaded first? (again, a long shot — I’m good at those!)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2010-02-17 20:02:18

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

out of intrest which flash player do you use? i like VideoMaru since i can build my own GUI – im not a fan of the controls on most ready to go embedable players. they look ugly on my lovingly crafted website. :)

Offline

#11 2010-02-17 20:04:51

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: File download not working

Probably a redundant remark, but the file download tags you are using need to be inside file_download_list tags…

Offline

#12 2010-02-17 20:10:06

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: File download not working

i kicked it off with in a page and the player is in video_layout – the actual player is fine, its just getting the url formed BEFORE the player trys to access it. If i do a view source the url is correct but not displaying in the player at all. it does if i hardcode the url in video_layout so i know the player is set up right, its just getting a properly formed url to it when its expecting it.

<txp:file_download_list category="<txp:custom_field name="gallery_images" />" form="video_layout" />

The video_layout form just contains this:
<div id="flashcontent">
</div>
<script type="text/javascript">
var so = new SWFObject("/assets/player/720.swf", "flvplayer", "720", "480", "9");
so.addParam("FlashVars", "flvAddress=<txp:site_url />downloads/<txp:file_download_name />
");
so.addParam("quality", "high");
so.addParam("wmode", "transparent");
so.write("flashcontent");
</script>

Last edited by CodeWalker (2010-02-17 20:19:41)

Offline

Board footer

Powered by FluxBB