Welcome to TalkGraphics.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2014
    Location
    Florida
    Posts
    129

    Default How do I play an audio file directly in the web page or browser?

    I linked an audio file to a line of text. When I click on it, the default audio player on my computer opens and plays the file. I want to play the file directly from the webpage or browser. How can I do this? The file is an mp3.

  2. #2
    Join Date
    Feb 2014
    Location
    Florida
    Posts
    129

    Default Re: How do I play an audio file directly in the web page or browser?

    UPDATE:

    I discovered that the Windows default player only opens when I click the link from the Xara preview window. When I open the page in a browser, the audio plays in the browser. However, it changes the page to dark gray with an audio player in the middle. When the audio is done I have to go back to the original page.

    I also discovered that you can drag and drop the mp3 file directly onto the page, but when I do that it creates a small audio player and I could not find a way to link it to a line of text. It also repeats the audio over and over until I pause. I could not figure out how to make it play only once.

    Is there a way to click on a line of text to play audio without it changing the page or opening a new tab or window? I'm pretty sure I have seen this before, but unfortunately I can't recall where or I would post an example.

    Any help will be appreciated.

  3. #3
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: How do I play an audio file directly in the web page or browser?

    Did not do that before but I think you will need to include some player like audio.js or jplayer.
    There also is an <audio> tag supported by modern browsers but I don't know if it can be customized to your needs. See http://www.w3schools.com/html/html5_audio.asp

  4. #4

    Default Re: How do I play an audio file directly in the web page or browser?

    Quote Originally Posted by TheCapn View Post
    .... I also discovered that you can drag and drop the mp3 file directly onto the page, but when I do that it creates a small audio player and I could not find a way to link it to a line of text. It also repeats the audio over and over until I pause. I could not figure out how to make it play only once...
    well, one part figured out...how to only play once

    select the web properties of the player>placeholder>html code (head) and add the line "playLoop":false,
    save changes by selecting "ok" and then "apply"

    i'll see what else i can figure out before i crash for the night
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	player loop_0.jpg 
Views:	98 
Size:	71.9 KB 
ID:	109790  

  5. #5
    Join Date
    Feb 2014
    Location
    Florida
    Posts
    129

    Default Re: How do I play an audio file directly in the web page or browser?

    Thanks "mikeymopar", the 'playloop' code worked.

    I have two other questions,

    1. Is there a way to specify the volume level when it starts playing?
    2. The last second of audio is getting cut off, any way to prevent this?

    Thanks again.

  6. #6

    Default Re: How do I play an audio file directly in the web page or browser?

    Quote Originally Posted by TheCapn View Post
    I have two other questions,

    1. Is there a way to specify the volume level when it starts playing?
    2. The last second of audio is getting cut off, any way to prevent this?
    had a few minutes here between jobs and figured out for default volume in the same place you added playLoop also add "defaultVol":#.##,
    such that it's in terms of a percentage - 0.00=muted, 0.5=50%, 1.00=max volume, etc...

    you can find these variables by looking at the top of the html that you're modding for script that it calls. in this case when you look at the top you can find it calls in the index_htm_files folder the magix_player.js (i just exported the most simple doc only having the mp3 file as a website in order to see the build files). then using an editor (notepad++, sublime, etc) i searched magix_player.js for "default" and found defaultVol. same way to find playLoop verbiage

    still haven't played with linking it yet. ionno off-hand why it would cut off the last second either.

  7. #7
    Join Date
    Feb 2014
    Location
    Florida
    Posts
    129

    Default Re: How do I play an audio file directly in the web page or browser?

    Thanks, adding "defaultVol" did the trick. Thanks for explaining where I can find other variables as well. Now, to figure out why the audio is getting cut off. I thought perhaps it had something to do with the variable "duration:*", but changing the value does nothing. I think I'll post a new thread for that. Thanks again for all your help "mikeymopar".

 

 

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
  •