473,382 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

dynamic audio loading

hi,
I'm trying to load audio files dynamicly but i got some errors.

my code :
Expand|Select|Wrap|Line Numbers
  1. File.prototype.OpenAudioFile = function(dPath)
  2. {
  3.     aSound= document.createElement("embed");
  4.     aSound.src = dPath;
  5.     aSound.name = "ses";
  6.     this.data = aSound;
  7.     aSound.onload = this.FileDownloaded();
  8. }
it doesnt work and i tried :
Expand|Select|Wrap|Line Numbers
  1. document.write("<embed src=" + dPath + " name=" + dPath + " autostart=false onload=this.FileDownloaded()></embed>");
and
Expand|Select|Wrap|Line Numbers
  1. document.write("<bgsound src=" + dPath + " name=" + dPath + " autostart=false onload=this.FileDownloaded()></embed>");
first code didnt work and other two work but when they load i can see just single color, no image, no text nth else. When i use embed tag staticly it works great.waiting for answers...
Aug 24 '09 #1
3 2400
Dormilich
8,658 Expert Mod 8TB
in Firefox you may run into problems because of the built-in File object (which has nothing to do with <embed>)

other than that:
- line 3: the created object is not attached to the document tree anywhere
- line 7: what does this method do?
- how do you know that <embed> and <bgsound> are members of the File object/interface?

note: you should quote all HTML attribute values (this becomes necessary in XHTML)
Aug 24 '09 #2
as i see in some file loader code "onload" function was used as a callback to check if element loading is completed. after geting message from onload i do something else and i call
document.body.appendChild(this.audio);
in a different class. i can see all properties of aSound and this.data from this.audio.
and i dont understand with file object but i just tested. i wasnt sure which one will work. i had some base knowledge and i just tested :)
Aug 24 '09 #3
Expand|Select|Wrap|Line Numbers
  1. File.prototype.OpenAudioFile = function(dPath)
  2. {
  3.     var rem = document.createElement("div")
  4.     rem.name = "divv";
  5.     rem.id = "divId";
  6.  
  7.     rem.innerHTML = '<embed src="' + dPath + '" autostart="false" name="' + dPath + '"></embed>';
  8.  
  9.     document.body.appendChild(rem);
  10. }
  11.  
my sound problem is solved using the way above but when i attach div object to document sound plays automaticly.is there any solution for it?

by the way, im not working on internet browsers, it's a part of a framework for tv. it supports js 1.2.
Aug 26 '09 #4

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

Similar topics

4
by: Robert Oschler | last post by:
Hello, I have a web site that has an audio file on it that I make available for download. Right now I'm using the "right-click/save-as" approach. This is because left-clicking the link to the...
5
by: Andrew Poulos | last post by:
Is there a standards compliant way to preload non-streaming audio (in HTML 4 Strict)? I did a search and all that I could find was to use the EMBED tag which is inappropriate. Andrew Poulos
7
by: JavaScriptRocks | last post by:
I've been trying to imitate / reverse engineer the add attachment feature in gmail composer. I managed to do it to say about 80% but its giving me trouble in IE on WinXP-Sp2. I am using PHP to do...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
2
by: Gidi Morris via .NET 247 | last post by:
Hi, Is there a way to play audio using MCI (I preffer MCI, but if you know of any others I'll be greatful) from a Filestream? I mean, I have a filestream to an audio file, can I play the audio?...
8
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
1
by: Robert McLay | last post by:
I have been trying to build python on Cray X1. As far as I can tell it does not support dynamic loading. So the question is: How to build 2.4 without dynamic loading? That is: can I build...
2
TLL
by: TLL | last post by:
Hi to all the progrogramming professionals, I've had a query regarding about how to load audio/video files from memory using C#.net. Cause currently, Im working on a digital rights management...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.