audio_play

6 audio.pages.inc audio_play($node = FALSE)

Similar to audio_download, but for streaming playback instead of download.

Parameters

$nid: Node ID.

1 string reference to 'audio_play'

File

contributions/audio/audio.pages.inc, line 102

Code

function audio_play($node = FALSE) {
  // Increment the play count.
  db_query('UPDATE {audio} SET play_count = play_count + 1 WHERE vid = %d', $node->vid);

  // Playing counts as "viewing" the node.
  node_tag_new($node->nid);

  // Notify other modules.
  audio_invoke_audioapi('play', $node);

  $headers = array(
    'Pragma: public',
    'Expires: 0',
    'Cache-Control: must-revalidate, post-check=0, pre-check=0, private',
    'Content-Type: ' . mime_header_encode($node->audio['file']->filemime),
    'Content-Length: ' . $node->audio['file']->filesize,
    'Content-Disposition: inline;',
    'Content-Transfer-Encoding: binary',
  );
  // Required for IE, otherwise Content-disposition is ignored.
  ini_set('zlib.output_compression', 'Off');
  audio_file_transfer($node->audio['file']->filepath, $headers);
}