Hi,
I'm in desperat need to know how the Audio module can track play counts. I need this functionality but in combination with another mp3 player module.
I've studied the code but still I can't figure out how the number of plays are calculated. I've found a function audio_play in the audio.pages.inc. This function does, by other things, increase the play count. The big problem is I cannot find any place where the function is called. Could it be that it is inside the mp3 flash-player? Can it be that changes has been made to the Audio module's mp3 flash players?
function audio_play($node = FALSE) {
// Increment the play count.
db_query('UPDATE {audio} SET play_count = play_count + 1 WHERE vid = %d', $node->vid);
The only place I find a reference to function audio_play is in the audio.module meny_hook:
$items['audio/play/%node'] = array(
'page callback' => 'audio_play',
'page arguments' => array(2),
'file' => 'audio.pages.inc',
'access callback' => '_audio_allow_play',
'access arguments' => array(2),
'type' => MENU_CALLBACK,
);
Any help is much appreciated!
Comments
Comment #1
HorsePunchKid commentedThe function
audio_menutells Drupal what function to call when a certain URL is accessed. In this case, it says that whenhttp://example.com/audio/play/314is accessed, call the functionaudio_play($node)with node number 314. So nothing in the audio module directly calls that function, but the function does get called when that URL is accessed.Comment #2
MrVictor commentedOkey, I see. Thank you for your answer.
Any idea how I can use the same solution with the MP3-player module? Can I make changes to the MP3 module to make this work?