6 Replies - 998 Views - Last Post: 03 October 2011 - 06:19 PM Rate Topic: -----

#1 dbeaird727  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 238
  • Joined: 13-December 10

default audio player by browser?

Posted 03 October 2011 - 02:07 PM

Is there a way to use the browsers default audio player to pull files from my server to play? After someone uploads any audio to my site and it is successful i get this success message:
The file has been uploaded. Your file is >Here< and when I click this it takes me to a blank white screen with an audio player on it defaulted by the browser? Is there any way to use this same default player functionally in my site?
    //Rename the file to an MD5 version
    rename("uploads/".$filename, "uploads/".$hashedfilename);

    echo "The file ".  basename( $filename ). "
      has been uploaded.  Your file is <a href='uploads/$hashedfilename'>here</a>.";
   
    }  



Is This A Good Question/Topic? 0
  • +

Replies To: default audio player by browser?

#2 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: default audio player by browser?

Posted 03 October 2011 - 04:55 PM

The default audio player depends on what plugin the client installed on their browser. You don't have any control over what they use to play the MP3 file.
Was This Post Helpful? 1
  • +
  • -

#3 dbeaird727  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 238
  • Joined: 13-December 10

Re: default audio player by browser?

Posted 03 October 2011 - 05:01 PM

Whats the easiest way to use a media play (even if its html5) when pulling audio files from a server? I dont need anything fancy just the simplest way? and I know this isn't necessarily a PHP question I am just curious because my script seems to play the file with just the default browser audio player.
Was This Post Helpful? 0
  • +
  • -

#4 fromTheSprawl  Icon User is offline

  • Monomania
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,063
  • Joined: 28-December 10

Re: default audio player by browser?

Posted 03 October 2011 - 05:03 PM

You could force them to use HTML5 compliant browsers since the tag <audio> is native to that.

http://www.w3schools...5/tag_audio.asp
Was This Post Helpful? 1
  • +
  • -

#5 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: default audio player by browser?

Posted 03 October 2011 - 05:14 PM

HTML5 has an audio tag which could be used. It's pretty good too but it will require some Javascript to get full functionality.
<audio id="player">
	<source src="mp3_file.mp3">
</audio>



There are a lot of JS players you can import if you do a quick Google search.
Was This Post Helpful? 0
  • +
  • -

#6 dbeaird727  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 238
  • Joined: 13-December 10

Re: default audio player by browser?

Posted 03 October 2011 - 05:27 PM

Awesome! I was looking into jwplayer and it seems pretty straight forward.. I know I will probably figure this out but my curiosity is getting the better of me.. How are the files played? Like if i have the audio file on my server but a record of that file in my database how do i query the database and pull the file from the server at the same time? Just a general round a bout answer is all im looking for :)
Was This Post Helpful? 0
  • +
  • -

#7 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: default audio player by browser?

Posted 03 October 2011 - 06:19 PM

It depends on how you're storing it. If you're storing simply the file location then a simply query should get you the path which you can stick into the src attribute. If you're storing it as a BLOB type then that's a different case. You'll have to send the application/mp3 header then output the binary data retrieved from the database.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1