I included an audio greeting in a website I'm making, and want audio to only start when a user click play. I set it up so that autoplay="false, and autostart="false"
here is my code so far
<section>
<h1>Welcome to Morlans Famous Shop!</h1>
<object>
<param name="greetings" value="audio/EN_sta60_black_market_00083397_M.wav" />
<param name="autostart" value="false" />
<param name="autoplay" value="false"/>
<param name="controller" value="true" />
<embed src="audio/EN_sta60_black_market_00083397_M.wav" controller="true" autoplay="false" autostart="false" type="audio/wav" pluginspage="http://www.apple.com/quicktime/download/" />
</object>
<p>Hello there. Welcome to Morlans famous shop. You want many good supplies, yes? </p>
<p>My shop carries all sorts of supplies need to survive the tough environments that the galaxy has to offer. From medigel, to armor, Morlans famous shop carries it all.</p>
<p>Oh, you will be pleased I think. Very good things I have, you will see.</p>
</section>
is there anything that I am missing?, any help would be appreciated
<script language="javascript" type="text/javascript">
function playSound(soundfile) {
document.getElementById("dummy").innerHTML= "<embed src=\""
+soundfile+"\" hidden=\"true\" autostart=\"true\"
loop=\"false\" />";
}
</script>
Have a look at that. Taken from this site.
http://webdesign.about.com/od/sound/a/play_sound_oncl.htm
That requires javascript though.
Still having some issues? Look here to get an understanding of the use of audio http://www.w3schools.com/html/html_sounds.asp
Related
This is from the Pandora One Source Code Lines 2918-2924
(view-source:http://www.pandora.com/) on Google Chrome
<script id="audioQualityUpsaleTmpl" type="text/x-jquery-tmpl">
<div class="upsale_container clearfix">
<h2>Enjoy Higher Quality Audio</h2>
<p>When Listening on the web, experience music at 192K bits per second. <br/>More bits means
better sounding Audio.
</p>
<div id="audioSample">
<object width="236" height="35">
<param value="high" name="quality">
<param value="transparent" name="wmode">
<param value="always" name="allowScriptAccess">
<param value="/static/pandora_one/flash/pandoraone_sampler.swf" name="movie">
<embed width="236" height="35" allowscriptaccess="always" wmode="transparent"
src="/static/pandora_one/flash/pandoraone_sampler.swf">
</object>
</div>
{{tmpl "#upgradeForUpsaleTmpl"}}
</div>
</script>
Can someone please explain to me what this section of code is designed to do?
Thank you
It appears to be a template for a javascript templating engine (it seems to be jquery based, however I'm not familar with it). You can tell this from the type="text/x-jquery-tmpl" tag.
Templates are often defined within script tags like this (with a type tag that is not javascript declared) because they are not rendered by the browser on page load, however are not executed as javascript. This allows the text to be selected client side, via something like $('#my-template'), and used as a template.
I have the following code for a video on my website. I have the AutoPlay turned off in order to prevent playback as soon as I open the website. The problem is that the video still loads automatically and this hurts the bandwidth of some visitors. What can I do to prevent the video from loading until the user decides to play it?
<object width="530" height="405" scale="to fit" hspace="10" border="5">
<param name="VideoTitle" value="/urlpath/movie.m4v" />
<param name="AutoStart" value="False" />
<param name="ShowControls" value="True" />
<param name="ShowStatusBar" value="True" />
<param name="ShowDiplay" value="True" />
<param name="AutoRewind" value="True" />
<embed width="530" height="405" scale="tofit" hspace="0" filename= "/urlpath/movie.m4v"
autostart="False" showcontrols="True" showstatusbar="True" showdiplay="True"
autorewind="True" border="1" src="/urlpath/movie.m4v"></embed>
</object>
Thanks in advance.
Don't include the code in your page. Inject it into the page once the user clicks a fake PLAY button.
As Diodeus said, have it load "on-demand" by creating a javascript function.
Alternatively, I think you could use HTML5's video tag and leave preload off.
-- The Javascript solution is more friendly for older browsers, as not all support HTML5.
i ran into some IE8 issue and I am not yet familiar with the problem.
The video does not play using I8 and versions below. My target is only IE8. But I don't know how to implement it and am not also familiar in adobe flash.
Question: Can I solve this issue using action scripts? If so, how can I apply the scripts exactly into my codes
The site I'm working with is : http://210.48.94.218/~printabl/about-us/our-culture/
My code is shown below:
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="172" height="250" id="FlashID" title="printableIntro">
<param name="movie" value="printableIntro.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" /><!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
<param name="autoplay" value="false"/>
<param name="play" value="false"/>
<param name="flashvars" value="autoplay=false" />
<param name="expressinstall" value="Scripts/expressInstall.swf" /><!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]-->
</object>
<object type="application/x-shockwave-flash" data="printableIntro.swf" width="172" height="250">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<param name="autoplay" value="false"/>
<param name="play" value="false"/>
<param name="flashvars" value="autoplay=false" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></p>
</div>
<!--[if !IE]-->
</object>
<!--<![endif]-->
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
Use SWFObject
https://code.google.com/p/swfobject/
Here is how you use it
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent"> This text is replaced by the Flash movie. </div>
<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
so.write("flashcontent");
</script>
Here is what each parameter means
var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);
Create a new SWFObject and pass in the required arguments:
swf – The file path and name to your swf file.
id – The ID of your object or embed tag. The embed tag will also have this value set as it’s name attribute for files that take advantage of swliveconnect.
width – The width of your Flash movie.
height – The height of your Flash movie.
version – The required player version for your Flash content. This can be a string in the format of ‘majorVersion.minorVersion.revision’. An example would be: "6.0.65". Or you can just require the major version, such as "6".
background-color – This is the hex value of the background color of your Flash movie.
Optional arguments are:
quality – The quality you wish your Flash movie to play at. If no quality is specified, the default is "high".
xiRedirectUrl – If you would like to redirect users who complete the ExpressInstall upgrade, you can specify an alternate URL here
redirectUrl – If you wish to redirect users who don’t have the correct plug-in version, use this parameter and they will be redirected.
detectKey – This is the url variable name the SWFObject script will look for when bypassing the detection. Default is ‘detectflash’. Example: To bypass the Flash detection and simply write the Flash movie to the page, you could add ?detectflash=false to the url of the document containing the Flash movie.
so.write("flashcontent");
Tell the SWFObject script to write the Flash content to the page (if the correct version of the plug-in is installed on the user’s system) by replacing the content inside the specified HTML element.
I use the below code within for my JQuery lightbox without include js file AC_RunActiveContent.js or swfobject-1.5.js in the html file. It works fine for IE and Firefox. Just wanna know if there is any problem for not include AC_RunActiveContent.js or swfobject-1.5.js. Is it a must to have AC_RunActiveContent.js or swfobject-1.5.js for display a flash properly in different browsers version?
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="789" height="617" id="Loader" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="en_MAIN.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="en_MAIN.swf" quality="high" bgcolor="#ffffff" width="789" height="617" name="Loader" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
No, that's the Adobe-style standard markup. It works across all current browsers.
It's ugly, doesn't validate and has to state each parameter twice, which is what the Flash embedding scripts you mention are attempting to address (plus sometimes also there's an IE ‘object activation’ workaround that is no longer necessary). If you don't care about that, you're fine as you are. If you do, this question has some discussion on alternatives.
I don't think your code is connected to Lightbox: AC_RunActiveContent.js and swfobject-1.5.js are javascript workarounds for getting Flash to work in IE. Since Lightbox uses JQuery, not Flash, you shouldn't need them.
Look closely at the lightbox instructions for more information.
<object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/>
<param value="high" name="quality"/>
<param value="#FFFFFF" name="bgcolor"/>
<param value="opaque" name="wmode"/>
<embed height="25" width="75" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#FFFFFF" quality="high" src="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK"/>
</object>
I am having to insert this legacy markup into a new site that I'm building. Problem is its using an <embed> tag.
Would I just do away with the <embed> and put some content in as an alternative, for those that do not have flash? Basically I'm just trying to bring this piece of html into the 21st century.
You can nest object elements to display alternatives. The W3C explains it here. I copied a snippet below:
One significant consequence of the OBJECT element's design is that it offers a mechanism for specifying alternate object renderings; each embedded OBJECT declaration may specify alternate content types. If a user agent cannot render the outermost OBJECT, it tries to render the contents, which may be another OBJECT element, etc.
In the following example, we embed several OBJECT declarations to illustrate how alternate renderings work. A user agent will attempt to render the first OBJECT element it can, in the following order: (1) an Earth applet written in the Python language, (2) an MPEG animation of the Earth, (3) a GIF image of the Earth, (4) alternate text.
<P> <!-- First, try the Python applet -->
<OBJECT title="The Earth as seen from space"
classid="http://www.observer.mars/TheEarth.py">
<!-- Else, try the MPEG video -->
<OBJECT data="TheEarth.mpeg" type="application/mpeg">
<!-- Else, try the GIF image -->
<OBJECT data="TheEarth.gif" type="image/gif">
<!-- Else render the text -->
The <STRONG>Earth</STRONG> as seen from space.
</OBJECT>
</OBJECT>
</OBJECT>
I recommend that you use swfobject which is a cross platform, open source library to display flash on your pages.
http://code.google.com/p/swfobject/
There are a variety of ways to load the flash and the alternative (non-flash) content. For example the following code could replace your code:
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK",
"myContent", "25", "75", "9.0.0");
</script>
<div id="myContent">
<p>Alternative content</p>
</div>
Basically, you should keep embed, because it is a fallback for some old browsers. It might hurt validation of page, but as long as you know why it is there, it is OK.
At least that's the way Adobe officially recommends: Macromedia Flash OBJECT and EMBED tag syntax
You are right to want to do code for XXIth century, but we have to deal with browser from previous millennium... :-)
I use function AC_FL_RunContent for embedding flash objects - it's good because it supports all browsers and is recommended by Adobe.
More is here:
They also suggest using <object> tag instead of <embed>
I found this code on the web (from a usability site) which caters for IE and others, and I use it on my flash pages (I've changed it to your code):
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" width="75" height="25">
<!-- <![endif]-->
<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="75" height="25">
<param name="movie" value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" />
<!--><!--dgx-->
<param name="loop" value="false">
<param name="menu" value="false">
<param name="quality" value="high">
</object>
<!-- <![endif]-->