The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 19, 2019, 02:51:40 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Crunch Time: Ajax Needed?  (Read 9371 times)
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« on: January 21, 2008, 08:57:34 PM »

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 learn something
new ...Ajax me?

here is the code for the player and the
index.html that calls it:
Code:


<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&amp;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>

« Last Edit: January 22, 2008, 07:04:02 AM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #1 on: January 22, 2008, 08:14:35 AM »

Why not just use PHP to keep track? Not really a reason to AJAX it up that I can see. Perhaps I'm missing something though.
Logged

hai
m0nkeymafia
Expert
****
Offline Offline

Posts: 240


Check it!


View Profile
« Reply #2 on: January 22, 2008, 08:25:31 AM »

Couldnt look at SWF cos at work
But you can make flash make calls, similar to the way an ajax solution would work
So basically make flash call a PHP logging script, that way if someone hot links it or take the file off, you will still track plays

Else if you want an on page load logging, then dont bother with ajax itd be a waste of your time Smiley
Logged

I am Tyler Durden
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #3 on: January 22, 2008, 08:31:57 AM »

@monkeymafia - didnt think of that i will try to
load the .swf file in macromedia (new experiment0
I thought with ajax i could log the user name cookie
data as well...

@vs: Well, If someone clicks play on that page
how can i keep track with php that they clicked
play... i get a hit in the log, but i thought i
would need some javascript or ajax or (trying
to learn here) whatever to maybe a button when
'onmouseover' or something that it would
shoot off a post to a php
page 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 javascript or a new php page
click?
« Last Edit: January 22, 2008, 08:38:21 AM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #4 on: January 22, 2008, 08:48:01 AM »

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 AJAX as you suggest, you need something to 'call' the javascript in 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 javascript funtion 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
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #5 on: January 22, 2008, 09:22:34 AM »

Ok, I misunderstood. Thought you wanted something just to count a page hit in real time.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: January 22, 2008, 09:40:25 AM »

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>
« Last Edit: January 22, 2008, 09:54:07 AM by perkiset » Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #7 on: January 22, 2008, 09:52:04 AM »

javascript makes my brain hurt.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #8 on: January 22, 2008, 09:52:55 AM »

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)
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #9 on: January 22, 2008, 10:07:37 AM »

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='Huh???'></input>

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
« Last Edit: January 22, 2008, 10:33:21 AM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #10 on: January 22, 2008, 10:51:56 AM »

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


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.html

I 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.

btw- toonage: Robert Plant and Allyson Krauss - Raising Sand.... nice
Hip, I like it - thanks!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #11 on: January 23, 2008, 06:58:25 PM »

JM - Read "DOM Scripting" by Keith, Friendsof press. You'll love what it all means.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!