473,770 Members | 6,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript audio player

tolkienarda
316 Contributor
hi all

my friend e-mailed me this quesion, i am more of a php person so i would appreciate it if you could help me look smart here is the quetsion
I am trying to write a simple script to play audio files for this guys
website and i need some help.

in the <head> if have:
Expand|Select|Wrap|Line Numbers
  1. /<script language="javascript">
  2. function player(source)
  3. {
  4. document.player.hidden(false);
  5. document.player.src(source);
  6. document.player.play(true);
  7. }
  8. </script>
  9.  
/In the <body> i have:
Expand|Select|Wrap|Line Numbers
  1. /<embed src="" loop=false name="player" controls=console hidden=true>
  2.  
/And then later:
Expand|Select|Wrap|Line Numbers
  1. /<a href="#top" onClick="player("audio/01.mp3")">Play</a>
  2.  
/It does nothing, like it doesn't even go into the function... Its been
so long since i have used javascript, its probably a simple problem. I
attached a copy of the html file. If you could take a look at it i would
appreciate it.


Ben
now i know that with the <a ...> tag that calls the javascript he could have just used the onclick, don't know why he didn't but i have changed that in another place but still it won't work.

thanks for any assistance

eirc
Feb 15 '07 #1
1 6068
Atli
5,058 Recognized Expert Expert
Hi.

At first glance...
[HTML]<a href="#top" onClick="player ("audio/01.mp3")">Play</a>[/HTML]

Double quote marks to open the onClick value, and then the double quotes in the function parameter will cause the value of onClick to be
"player(" and you would get a js error.

try
[HTML]<a href="#top" onClick="player ('audio/01.mp3')">Play</a>[/HTML]
Feb 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4429
by: gsb | last post by:
I want to stream audio into a hidden frame and load, stop, and control volume via JavaScript. I'm thinking w/ Windows Media Player. Any thought as to how? Thanks, gsb
1
4299
by: Ron Provost | last post by:
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. I'm using python 2.4 with pymedia on XP. I started out with the example in the tutorials section of the pymedia website. The pymedia docs imply to me that playback using Output's play() method should already be asynchronous and controllable. I...
1
1404
by: ray well | last post by:
hi, i'm looking for a .net audio player control, that can play wav, mp3, and some other common formats. i need to plays some audio in my app. i'm not looking for any whole audio studio, just a simple player. i don't want it to have to registered in the registry on the user's side, just for it to be able to sit the apps folder and work.
1
7625
by: richardscheff | last post by:
Video selector works for IE but not other browsers. for not IE <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv" width="320" height="280"> <param name="filename" value="video/dodgeball.wmv" /> <param name="ShowControls\" value="1" /> <param name="AutoStart\" value="1" /> <param name="PlayCount\" value="1" />
19
19275
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make things a bit easier. What I need to do is create a playlist and play it using JavaScript. I keep on getting close but not close enough to play the dang files. Has anyone done this before and can shed some light on what worked for them?
13
4901
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives, suggestions or improvements? if( wmv file) document.write("<OBJECT id=Player classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354" width="479">
0
2036
by: Terry Olsen | last post by:
If I have an audio file playing using DirectX.AudioVideoPlayback.Audio and I click the stop button, using the following code: Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click Try Player.StopWhenReady() Catch End Try End Sub
4
1682
by: =?Utf-8?B?U2F0eWE=?= | last post by:
My PC crashed and I have installed windows XP SP2 again. Now audio is distored (it runs too fast) with all applications like Windows Media Player, Real Player, WIN DVD player, CD player. etc. What would solve this?
1
3218
by: itsthefocusman | last post by:
Hi, My name is Daniel, and im using flash 8. Im building a flash site and wanted to include my audio on a page. I wanted to use a flash player such as http://odeo.com/audio/7932783/players or http://www.1pixelout.net/code/audio-player-wordpress-plugin/ to upload my audio then embed it. Do you know how to adapt the player or any other way I could Embed it into my flash site?
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.