View Full Version : show/hide mpg
09-04-2002, 11:36 AM
Hi all, first post ... is it possible to use a page action Page.HideObject to hide a media player object for an external MPG1, and then use Page.ShowObject from a text action to show (and then play) the MPG?
When I try this I get "Could not play the specified media player object -- object not found on this page."
I am able to show/hide in this way with a text object, but not so far with a media player object.
09-04-2002, 12:29 PM
Can you elaborate a bit more? /ubbthreads/images/icons/smile.gif
What event are the actions being triggered by? When exactly does this happen (when you click on your text object, when the page loads, or...?)
09-04-2002, 01:09 PM
Thanks for your response, Lorne.
This is a test project with one page. The page has an On Initialize action; Page.HideObject("playa") that hides the media player.
The Media Player object on the page references an external file "intro.mpg" in the Distribution directory.
Some scrollable text is visible on the page in an object called TextBox1.
When the page loads, the text is visible, the media player is not - this is correct.
There are two other text objects on the page, one saying "Play", the other saying "Stop."
The "Play" text has three actions triggered by On Mouse Click:
When I preview the page, the page loads correctly, showing the text only. When I click the "Play" text, I get a message ...
"Could not play specified media player object. The object was not found on this page. 'playa' "
(The "stop" text will stop and hide the media player and show the text box.)
09-04-2002, 04:57 PM
Hi - This sounds like a hiccup I came across a few days ago. Try adding a 1 second Application.Sleep between Object.Show and Play
to see what happens. If it plays ok ... delete Application.Sleep and see if it runs OK from then on. Mine did (odd but true)!
09-05-2002, 10:50 AM
Derek; odd, but not quite true for me ... adding Application.Sleep between show and play DID fix the problem!
But then removing it again re-introduced the problem again in my case.
I'm going to try setting up a new project from scratch and re-testing -- thanks for your suggestion,
09-05-2002, 01:36 PM
I have found that adding a brief application.sleep does enable the MPG to play after being "shown" on a burned CD, but does not in preview mode on my system.
(My system is probably untypical - Mac OS X / Virtual PC for Windows XP.)
However, I still can't get a CD without any added sleep to play the MPG correctly on a W2K machine. The first frame of the movie shows as the error message displays. After clearing the error, the MPG will play if I click the "Play" text again.
Do you think I shoud go back to using AVIs, or "hide" the media player behind a piece of background art? Do you have any other work-arounds to suggest?
09-05-2002, 02:05 PM
I could have sworn that Mark coded this oddity out of existence...but the problem is essentially that the WMP control isn't ready to play yet by that point.
One thing you could try is to put the actual play action on the Media Player Object's "On Stream Open" event.
If you need to be able to only play it some of the time, then use a variable like %play_video% as a switch...setting the variable to "TRUE" when you want the video to play, and "FALSE" when you don't...and using an IF action in the "On Stream Open" event to only do the "Media Player Object - Play" if %play_video% is true.
09-06-2002, 07:46 AM
I just read the notes on Z-order control of MPOs, so my whole page design idea will need to be split into two pages, (one for the text "in front of" the video, and the next for the video), with buttons that jump between the two. This will then also take care of the problem with playing a previously hidden MPO, I hope!
Thanks for your help on this issue,
09-06-2002, 11:05 AM
Guys, there's an even better solution to this: just set the Media Player Object to begin playing the video automatically. Then it should start playing automatically when it's shown.
Thank Darryl for reminding me about this this morning. /ubbthreads/images/icons/smile.gif
Powered by vBulletin™ Version 4.0.6 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.