By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,843 Members | 2,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,843 IT Pros & Developers. It's quick & easy.

embedded WMP, button to play in full screen

P: n/a
i want to make a button that will start an embedded windows media
player playing AND in full screen. i can do it with TWO buttons:

<input
onclick="MediaPlayer.controls.play();"
type="button"
size="22"
value="Play">

<INPUT type = "button"
value = "Full Screen"
name = BUTTON
onclick = "if (MediaPlayer.playState == 3)
MediaPlayer.fullScreen = 'true';">

but i would like to be able to combine this into ONE button. seems
simple enough but after a week of experimenting, i just can't figure
it out.

thanks,
craig
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
craig wrote on 14 Dec 2003 at Sun, 14 Dec 2003 00:59:17 GMT:
i want to make a button that will start an embedded windows
media player playing AND in full screen. i can do it with TWO
buttons:

<input
onclick="MediaPlayer.controls.play();"
type="button"
size="22"
value="Play">

<INPUT type = "button"
value = "Full Screen"
name = BUTTON
onclick = "if (MediaPlayer.playState == 3)
MediaPlayer.fullScreen = 'true';">

but i would like to be able to combine this into ONE button.
In the document HEAD, add this:

<SCRIPT type="text/javascript">
function playFullscreen() {
if (3 == MediaPlayer.playState) {
MediaPlayer.fullscreen = 'true';
}
MediaPlayer.controls.play();
}
</SCRIPT>

...and this BUTTON to your document:

<BUTTON type="button" onclick="playFullscreen()"Play fullscreen</BUTTON>


I can't test this, but there should be no reason why it won't work.

What is 3 as a value of MediaPlayer.playState? Does it impact whether
the video should be played, or only if it can or can't be changed to
fullscreen. Does the video need to be playing before it's changed to
fullscreen, or should the fullscreen happen first? You'll have to
decide, based on the answers to those questions, whether the play()
call should be inside the if statement, before it, or after it.

Hope that helps,

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #2

P: n/a
thanks for the reply michael. i am contacting you directly via email.
your solution apparently only works if the button is pressed twice,
which does get me closer than before but it also makes me think the
real solution is simple and close. if anyone else has any ideas
please post them here. as soon as i get a solution i will post it
here and hopefully it will help someone else in the future.

craig
Jul 20 '05 #3

P: n/a
thanks to mike, I GOT IT. the following code in the header:

<SCRIPT type="text/javascript">
var stateTimer = null;

function playFullscreen() {
// Check if the video is playing. If it is, change
// to fullscreen. If not, start checking to see when
// it is.
if (3 == MediaPlayer.playState) {
MediaPlayer.fullscreen = 'true';
} else {
MediaPlayer.controls.play();
if (!stateTimer) stateTimer =
window.setInterval( checkState, 500 );
}
}

function checkState() {
// Check periodically to see if the video has
// started. If so, destroy the timer and change to
// fullscreen
if (3 == MediaPlayer.playState) {
window.clearInterval( stateTimer );
stateTimer = null;
MediaPlayer.fullscreen = 'true';
}
}
</SCRIPT>

and the following in the body:

<BUTTON type="button" onclick="playFullscreen()"
Play fullscreen</BUTTON>


did the trick! thanks mike, you're a true guru.

craig
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.