PDA

View Full Version : PROBLEM: Invalid State Error with the Media Player Object



Desmond
10-31-2003, 12:16 PM
<HTML> <HEAD> <TITLE>PROBLEM: Invalid State Error with the Media Player Object</TITLE> </HEAD> <BODY> <h3>PROBLEM: Invalid State Error with the Media Player Object</h3> <b>Document ID: IR04049</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 4.0</li> </ul> <hr> <h3>SUMMARY</h3> <p> This article explains the problem where your application will generate invalid state errors when you use a MediaPlayerObject.Load action followed by a MediaPlayerObject.Play action on a Media Player Object. </p> <h3>DISCUSSION</h3> <p> If you have a Media Player Object which is set to Automatically Start Playing Media, and you proceed to perform a MediaPlayerObject.Load action followed by a MediaPlayerObject.Play action on it, AutoPlay Media Studio 4.0 will generate an invalid state error (see the following code): </p> <p> MediaPlayerObject[MediaPlayer1].Load("%SrcDir%\movie.mpg")<br> MediaPlayerObject[MediaPlayer1].Play </p> <p> The above actions will produce the following error:<br> "The Media Player's state was incompatible with the action." </p> <p> Basically, when you load a file into a Media Player Object which is set to Automatically Start Playing Media, your video will automatically play. There is no need for the MediaPlayerObject.Play action. </p> <p> There are two solutions to this problem. Either: </p> <ol> <li>Remove the MediaPlayerObject.Play action.<br> <br> OR<br> </li><br> <li>Keep the MediaPlayerObject.Play action, and ensure that your Media Player Object is not set to Automatically Start Playing Media.</li> </ol> <p> KEYWORDS: AutoPlay Media Studio 4.0, Bug, Invalid, State, Play, Load, Media, Player, Object </p> <hr> <FONT SIZE=1> Last reviewed: October 31, 2003<br> Copyright 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>