Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Music tag

Status
Not open for further replies.

EZEason

Programmer
Dec 11, 2000
213
0
0
US
How can a play music on a web page, the music will only play when a certain object is visible on screen? (like a link, or image)

Jim

What doesn't kill you makes you stronger.
 
Apologies if I've not picked you up correctly with this question but you can just embed it.

Code:
<embed src="mytune.wav" autostart=true hidden=true name="sound1" mastersound>

Cheers

Nick
 
If I embed the music will it start when the page loads?

I do not want it to start on page load. The music should play only when a section of the page is visible.
(Clients specs not mine.)

Jim

What doesn't kill you makes you stronger.
 
when a section of the page is visible
I would think that when the page loads, it is considered visible as far as the browser is concerned. Is there something way down at the bottom of the page that the user must scroll to and THEN you want the music to start playing?

A little more clarification on what you're trying to do will help.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
it's this bit which decided that

autostart=true

simply make it autostart="false"

:)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Make

autostart=false

to disable startup on load.

Then when you make a certain section visible, call a Javascript function to play the music.

Assuming you understand what I'm saying, the command to play
I believe is as simple as

Code:
sound1.play()

[monkey][snake] <.
 
ECAR,
You are correct. The music should start after the reader scrolls down the page to a certain point. The client want everything on one page.(EBook, one page per chapter)So he only wants the music to play while the reader is reading a section of the chapter.

Jim

What doesn't kill you makes you stronger.
 
But how can you tell where a person is actually reading? Last time I checked, computers aren't jacked into our brains yet.

You'll probably want to rethink the design of the chapters before tackling this any further. You can accomplish what your client wants by doing some layering of the sections of the chapter so only some of the text appears at any given time, breaking the chapter up into pages, or even providing links so the user make the decision on if/when the music starts.

I'd personally go for the latter as tons of text on one page generally deters a user from staying too long. Granted, this is a very large generalization as I don't know the audience you're trying to attract, but it's something to consider.

- George
 
hey George long time no see , how are you!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
But how can you tell where a person is actually reading?

You can check the scrollTop value and see if it is equal to the value in which the item you want in the screen is actually in the screen.

This is javascript though.


[monkey][snake] <.
 
very good point monk, but i'm stating to think that maybe creating an interactive PDF might be better for this project.

that way you can do all that, play music relative to a page being viewed etc and it would be highly accessible, all you'd need is Acrobat Reader!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top