SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    ? big bad opus's Avatar
    Join Date
    Jun 2001
    Location
    DC
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using php to stream real audio

    PHP Code:
    $link mysql_connect($host$user$password);

    $query mysql_query("UPDATE $tablename SET count=count+1 WHERE file = $audio");

    mysql_db_query($dbname$query$link);

    header("content-Type: audio/x-pn-realaudio");

    include(
    "$audio");

    echo 
    mysql_error(); 
    okay this is what i came up with in attempts to make php file that would stream real audio and keep track of how many times the audio is requested.

    problem is what i have written is trying to open the radio file and turn it into text instead of sending it to my realplayer. anyone have any suggestions of what i should do?

  2. #2
    SitePoint Enthusiast mandi_nole's Avatar
    Join Date
    Jun 2001
    Location
    Orlando, FL
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure whether this directly answers your question, but to stream RealAudio, you should be using RealServer equipment...in which case, the file would be downloaded by clicking on a link to a .ram or .rm file (depending on whether you're archiving or not).

    Unless there've been some advances since the last time I did streaming media...in which case, groovy.

    Mandi
    Love ya - mean it!

  3. #3
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by mandi_nole
    I'm not sure whether this directly answers your question, but to stream RealAudio, you should be using RealServer equipment...in which case, the file would be downloaded by clicking on a link to a .ram or .rm file (depending on whether you're archiving or not).
    no, it can HTTP stream fine IF the host supports/allows it. i assume his does if he's trying this.

    opus, instead of trying to send the data from the PHP script, which it looks like you're trying to do, why don't you, after you update your counter, just redirect to the actual file?

    PHP Code:
    header("Location: $path_to_ra_file"); 
    Last edited by DR_LaRRY_PEpPeR; Jul 9, 2001 at 16:35.

  4. #4
    ? big bad opus's Avatar
    Join Date
    Jun 2001
    Location
    DC
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    perfect larry, thanks

  5. #5
    SitePoint Enthusiast mandi_nole's Avatar
    Join Date
    Jun 2001
    Location
    Orlando, FL
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As an aside...

    Perhaps there should be a better distinction made between "streaming" media and downloading files on demand...big difference in technologies involved...

    Anyway - glad the problem's solved!

    Mandi
    Love ya - mean it!

  6. #6
    ? big bad opus's Avatar
    Join Date
    Jun 2001
    Location
    DC
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually the problems wasn't solved.

    it was streaming but its now updating the count because of the period in the audio file name.

    does anyone know a way around this?

  7. #7
    ? big bad opus's Avatar
    Join Date
    Jun 2001
    Location
    DC
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    the problem continues

    my link is like http://trickology.com/stream.php?id=#&audio=filename.rm

    PHP Code:
    $link*=*mysql_connect($host,*$user,*$password);

    $query*=*mysql_query("UPDATE*$tablename*SET*count=count+1*WHERE*id=$id");

    mysql_db_query($dbname,*$query,*$link);

    header("location:http://www.trickology.com/$audio");

    echo*mysql_error(); 
    the file will stream but the counter won't update. i have no idea of what to do now.
    Last edited by big bad opus; Jul 10, 2001 at 08:46.

  8. #8
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: the problem continues

    Originally posted by big bad opus
    it was streaming but its now updating the count because of the period in the audio file name.
    the period in the file name wouldn't matter.


    Originally posted by big bad opus
    PHP Code:
    $link*=*mysql_connect($host,*$user,*$password);

    $query*=*mysql_query("UPDATE*$tablename*SET*count=count+1*WHERE*id=$id");

    mysql_db_query($dbname,*$query,*$link);

    header("location:http://www.trickology.com/$audio");

    echo*mysql_error(); 
    the file will stream but the counter won't update. i have no idea of what to do now.
    your code's messed up, that's why.

    this:

    PHP Code:
    $query mysql_query("UPDATE $tablename SET count=count+1 WHERE id=$id"); 
    is assigning the result id from mysql_query() to $query. and then when you run mysql_db_query(), your "query" is just a number. BTW, i missed that in your first post cuz i was only thinking about the RA problem.

    change to this:

    PHP Code:
    $link mysql_connect($host$user$password);

    $query "UPDATE $tablename SET count=count+1 WHERE id=$id";

    mysql_db_query($dbname$query$link);

    header("location:http://www.trickology.com/$audio");

    echo 
    mysql_error(); 
    should work...
    Last edited by DR_LaRRY_PEpPeR; Jul 10, 2001 at 13:57.

  9. #9
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by mandi_nole
    Perhaps there should be a better distinction made between "streaming" media and downloading files on demand...big difference in technologies involved...
    no, streaming will still STREAM via HTTP. not just a download and play file.

    no RealServer needed in any case.
    Last edited by DR_LaRRY_PEpPeR; Jul 10, 2001 at 13:57.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •