
![]() |
jammaster82
Ookay i have a little .swf that
plays a file at: http://70.174.120.48:222/index.html I need to keep track of the fact that someone played this song. I know i could parse the log but might as well learnsomethingnew ... Ajaxme?here is the code for the player and the index.html that calls it: <html> Johnnys mp3 player test. <script language=" JavaScript" src="http://70.174.120.48:222/audio/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://70.174.120.48:222/audio/player.swf" id="audioplayer1" height="24" width="290"> <param name="movie" value="http://70.174.120.48:222/audio/player.swf"> <param name="FlashVars" value="playerID=1&soundFile=http://70.174.120.48:222/audio/mindfields.mp3"> <param name="quality" value="high"> <param name="menu" value="false"> <param name="wmode" value="transparent"> </object> </html> vsloathe
Why not just use
PHPto keep track? Not really a reason toAJAXit up that I can see. Perhaps I'm missing something though.m0nkeymafia
Couldnt look at SWF cos at work
But you can make flash make calls, similar to the way an ajaxsolution would workSo basically make flash call a PHPlogging script, that way if someone hot links it or take the file off, you will still track playsElse if you want an on page load logging, then dont bother with ajaxitd be a waste of your time![]() jammaster82
@monkeymafia - didnt think of that i will try to
load the .swf file in macromedia (new experiment0I thought with ajaxi could log the user name cookiedata as well... @vs: Well, If someone clicks play on that page how can i keep track with phpthat they clickedplay... i get a hit in the log, but i thought i would need some javascriptorajaxor (tryingto learnhere) whatever to maybe a button when'onmou seover' or something that it wouldshoot off a post to a phppage that tallied the fact that someone displayed the player... how would you differentiate if there were say five players on the page and they only played two of them without javascriptor a newphppageclick? DangerMouse
I'd guess you would need some kind of flash trigger in the swf file to log if play has been hit. Even though you could do the logging with
AJAXas you suggest, you need something to 'call' thejavascriptin the first place.A really nasty kludge if you have no access to the swf player, or can't replace it with something with more events, would be to have some kind of javascriptfuntion monitoring mousedown on the play button co-ordinates, or a div over the play button - this is extremely unlikely to work though considering the myriad of browser settings/resolutions - I'm sure someone competent in CSS could achieve it, but its beyond me.DM vsloathe
Ok, I misunderstood. Thought you wanted something just to count a page hit in real time.
perkiset
Are you saying that while the MP3 is at the clients, they can start/stop/start/stop and you want to track that?
First off, I don't know about hooking shockwave (is it the same thing as flash or what?), but you can hook Flash with actionscript and do this sort of thing because it interacts pretty nicely with JS. In JS you could use any number of freeware players, then throw a dandelion whenever there is activity. You could also make the "play" button a JS that writes the request for the player to the DOM, rather than having it in the original page ie., write the code into the DOM on request rather than when you construct the page and when you do it throw a dandelion. <edit>Clarifying</edit> jammaster82
yea thats what i was thinking,
just the fact that they started it would be nice, both better! having the player pop up like the phone number does on superpages.com like in the following: http://yellowpages.superpages.com/listings.jsp?STYPE=S&search=Find+It&SRC=&channelId=&sessionId=&MCBP=true&CS=L&C=walmart&L=23692&searchbutton.x=0&searchbutton.y=0&searchbutton=Find+It are they 'inserting into the DOM' sounds like when the fat guy goes to prison.....nyuk nyuk ![]() dandelion? ... Document Object Model (DOM?) yea starts, stops ... (googling..) var ap_instances = new Array(); function ap_stopAll(playerID) { for(var i = 0;i<ap_instances.length;i++) { try { if(ap_instances<> != playerID) document.getElementById("audioplayer" + ap_instances<>.toString()).SetVariable("closePlayer", 1); else document.getElementById("audioplayer" + ap_instances<>.toString()).SetVariable("closePlayer", 0); } catch( errorObject ) { // stop any errors } } } function ap_registerPlayers() { var objectID; var objectTags = document.getElementsByTagName("object"); for(var i=0;i<objectTags.length;i++) { objectID = objectTags<>.id; if(objectID.indexOf("audioplayer" ![]() ap_instances<> = objectID.substring(11, objectID.length); } } } var ap_clearID = setInterval( ap_registerPlayers, 100 ); vsloathe
javascriptmakes my brain hurt.perkiset
DOM Document Object Model - that's what you're talking to when you say document.getElementByID('anode') - the DOM is the containing structure for all HTML entities on a page. You can create new ones on the fly, which is precisely how my XRPC class works as well (look in the JS repository I think - or just search here for XRPC)
Dandelion - my personal term for messages thrown at the server that you have no intention of answering. Imagine dandelions when you blow them - that's how I see a swarm of my tracking messages blowing out of the client towards the server. It is not even critical if they don't make it - they're thrown lots and light so they don't impact the client. (Editing previous post) jammaster82
Yes its the same as flash, .swf is 'shockwave/flash'.
Okay so as a starting point lets for example sake make a button that just brings up another button as a new element can you give me some sort of jumpoff point to do this,then ill tackle the dandelion... yea i googled 'dandelion/ javascript'....i like the analogy though. 1st to do simple element addition: <input type='submit' onclick=' ![]() total JS brand newbie..looking up xrpc now.. can you link me to where your talking about? btw- toonage: Robert Plant and Allyson Krauss - Raising Sand.... nice perkiset
quote author=jammaster82 link=topic=725.msg5045#msg5045 date=1201021657 Yes its the same as flash, .swf is 'shockwave/flash'. Thanks, thought so but haven't used the word "shockwave" in so damn long that I am confused quote author=jammaster82 link=topic=725.msg5045#msg5045 date=1201021657 Okay so as a starting point lets for example sake make a button that just brings up another button as a new element can you give me some sort of jumpoff point to do this,then ill tackle the dandelion... yea i googled 'dandelion/ javascript'....i like the analogy though. 1st to do simple element addition: <input type='submit' onclick='? ? ? ? ?'></input> total JS brand newbie..looking up xrpc now.. can you link me to where your talking about? http://www.perkiset.org/forum/ ajax/it%92s_time_to_dump_xmlhttprequest-t336.0.htmlI use this player in a few sites: http://www.jeroenwijering.com/?item=JW_FLV_Media_Player If you have actionscript, you can open it up and do some work on it if you like - that would give you exactly what you are looking for. quote author=jammaster82 link=topic=725.msg5045#msg5045 date=1201021657 btw- toonage: Robert Plant and Allyson Krauss - Raising Sand.... nice Hip, I like it - thanks! jammaster82
THANK YOU!!!
Ok i get it now. php, html,javascript, and now ACTIONSCRIPT..all in one page pull..... ::rolls eyes:: i left delphi for this? ;p http://70.174.120.48:222/test1.html thanks for your help... gonna Just open up a popup, hook the loading of the audioplayer.js with a stamp to a table saying 'someone displayed the player' and then to close it they click my link which runs a little function to record that they wanted to close the player, then self.close() (until client wants to record starts, stops which would be as insane as trying to program a timeclock.) starts should do... :: crosses fingers :: and actionscript is another lesson for a nother day.. thanks for your help, when you said DOM i read around and everything went CLICK! pretty interesting convulution for client server multi tier world dom purposes... found out how to display something on the fly for the next guy reading through forum pasted as follows: <html> <form> <INPUT TYPE="RADIO" NAME="opinion" VALUE="yes" onclick="hideText()"><B>Yes.</B> <br/> <INPUT TYPE="RADIO" NAME="opinion" VALUE="others" onClick="dispText()">OthersRs. <input type=text name="amt" style="display:none"><br/> <INPUT TYPE="RADIO" NAME="opinion" VALUE="no" onclick="hideText()">No.<br/> </form> <SCRIPT LANGUAGE=" JavaScript">function dispText() { document.forms[0].amt.style.display = ''; } function hideText() { document.forms[0].amt.style.display = 'none'; } </script> </html> thx 4 ur help ![]() off to make the admin panel and the ranking system... perkiset
JM - Read "
![]() |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads