Archived from groups: microsoft.public.pocketpc (
More info?)
When you say play once, you mean once per visit to the page (requring
no memory of previous visits) or you mean once, and never plays ever
again ?
BTW This should have been posted to pocketpc.multimeda newsgroup ;-)
Right lets try : PocketIE supports a plugin for windows media player
8/9 so I guess that makes it workable for WM2002/2003 machines.
There are a few problems with the plugin in WM2003 using Media Player
9 on that platform, but they can be worked around, we'll do that here.
You need to 'embed' a pocket WMP control into the HTML for your web
page. It should be 'hidden' (invisible or width 0 / height 0). The
code for that is below.
The player also needs to be told where to find the file (best use a
relative path for that) and to play it once, when the page is fully
loaded. This can all be done in javascript. The code below calculates
paths relative to the current directory you're in, if you plan to
install content in subdirectories it will need adjusting.
Place the following content in the HEAD of your PIE page, or in an
external script :
<script language="javascript">
function loadplayercontrols(filename) {
// Mung file location to current path
// Get current directory
filepath=location.href.substring(0,location.href.lastIndexOf("\\"));
// Remove protocol and escaped strings
filepath=unescape(filepath.replace("file://",""));
// Append supplied filename
filepath+="\\"+filename;
Player.AutoStart=true;
Player.FileName=filepath;
}
</script>
Now you need to put an onload() event into your body tag :
<body onload="loadplayercontrols('50by10.wma')">
Finally, place this in the web page, anywhere will do but usually near
the top is handy for maintenance :
<object id="Player" width="0" height="0"
classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
type="application/x-oleobject"></object>
OK With that set, you should be able to see you specify the filename
of a windows media audio file in the onload event of the web page.
You're not passing anything to the media player control until your
page has finished rendering, so the user gets to see something before
the audio kicks off.
OK A few things : My version of WMP didn't want to 'play' with the
MP3's I used. It might be that the embedded player doesn't play MP3
even though the full version does, there have been a few glitches with
the player.
For compatibilty with the player, and to save a little on the file
size, you could use the windows media encoder, with a voice audio
profile - use windows media audio 7 or 8 codecs to do this.
This will let you produce wma files which are smaller than the
corresponding MP3 files, although I prefer MP3 as the WMA voice codecs
sound too mushy and full of harmonics (dalek effect). It all depends
on the settings.
Encoding voice files takes seconds - lets say a 400mhz machine can do
a 30 second voice file in under 10 seconds, so you should get through
them pretty quick. Prerecord as 'wav' wave format files, and load them
one at a time into the encoder, after testing a compression setting
you're happy with (both on file size and quality onthe PPC).
Right then, try it out & let us know how you get on.
Cheers - Neil
On Wed, 4 Aug 2004 11:49:48 +0000 (UTC), "Dave Smithz"
<SPAM@FREEWORLD.com> wrote:
>Hello there,
>
>In summary: How do I make an Mp3 or other format sound file automatically
>play once when a user visits a web page in Pocket IE?
>
>Full details:
>
>Please help. I want to make some web pages for a Pocket PC running Pocket IE
>that play reads the text contained within the webpage.
>
>I have accepted that a text to speech reader is probably not feasible in the
>time scale of the project I am doing. I previously made a posting on this
>and did not get any responses saying I could.
>
>So instead, I want to prerecord the text files being read by a human, and
>when the user of our application visits the page the file is played.
>Although I am not sure how to do this.
>
>Please note that in the case the webpages are all stored on a local SD cards
>as there will be no internet connection, so there is no worry about
>downloading the files to be played.
>
>Thanks in advance and I would really appreciate some help on this ASAP.
>
>Kind regards
>
>Dave
>
>