Thursday, May 5, 2011

Re: mp3 player in flash

having the mp3 in a dir named music is fine within the webroot dir is fine.

is your app installed in a folder named cake and artist a controller

or is the app within artist?

it looks to me the latter (although other parts of your email make me think that artist is a controller)
and the fix may be as simple as make the flash instance recieve
/cake/artist/webroot/music/myfile.mp3
that should be the same as
/cake/artist/music/myfile.mp3

I think your passing a relative url to the flash instance
since it finds the mp3 from the index but not the detailView action

I have an app that plays mp3s from a flash header
my mp3s are in a dir named mp3 - I load playlists of mp3s from a dir xml (which has absolute paths)

irrespective of the url in the browser the mp3 is played - below is a simplified version of the setup I used (in addition to loading the header I have various other swfobjects for videos, photos etc that all use the same principal - my header also has a signup feature using ajax to pass send/repond data between flash & cake)

var flObj = {
  flashvars: {
    logoObject:'flash/logo.swf',
    xmlFile:'xml/blank.xml',
    file:"xml/playlist.xml",mp3swf:"flash/mp3player.swf"
    },
    params:{
      base:siteCfg.path
    }
};


swfobject.embedSWF(
  siteCfg.path+"/flash/myheader.swf",
  "targetDiv",977,220,"8.0.0",false,
  flObj.flashvars,
  flObj.params
);


since the flash params.base is set I can pass additional files to my flash to load the additional files are passed relative to location in webroot
and the flash instance concats the url of loaded file from the siteCfg.path

so my app installed in /cakemp3playingapp/ on example.com - the following will all work

example.com/cakemp3playingapp/
example.com/cakemp3playingapp/artists/
example.com/cakemp3playingapp/artists/details/1/
example.com/cakemp3playingapp/contact/

my example uses an xml playlist - but thats optional

hth  - S




On 6 May 2011 05:24, Kane The Pirate <kanethepirate@gmail.com> wrote:


On 3 maio, 23:24, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> perhaps its due to cakes use of mod rewrite
>
> if so I suggest using firebug's net tab to see the urls of the mp3's being
> loaded
> then firgure out a way to ensure the your app has correct urls consistently
>
> are you using absolute paths to the mp3s within your xml file or as params
> passed to swfobject?
>
> I pass a basePath to swfobjects in cake apps and use this within
> actionscript to get easy abs paths
> then it does not matter is the app is in subdir or not the actionscript does
> not need to be recoded
>
>  - S
>
> On 4 May 2011 02:47, Kane The Pirate <kanethepir...@gmail.com> wrote:
>
> > Its workin now! but just in my index page, and only if I access my url
> > without any slashes after the index.
> > ex: localhost/cake/artist - this works
> > ex: localhost/cake/artist/ - this doesn't work
> > ex: localhost/cake/artist/detailView/12 - doesn't work.
>
> > I'm trying to understand. I used the router to see if there are
> > differences, but there is none difference between the index and other
> > pages.
>
> > I'm just using swfobject for cakephp.
>
> > Thanks.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

I'm passing by params.
something like webroot/music/myfile.mp3.


in index show me the following url:
localhost/cake/artist/webroot/music/myfile.mp3

in other shows this:
localhost/cake/artist/detailview/1/webroot/music/myfile.mp3

However in my index it run, in my detailview not.

I tought if is better to change the route, or put my files outside
webroot.

Thanks

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: