private bool EnsureActiveEngineCanPlay (SafeUri uri)
{
if (uri == null) {
// No engine can play the null URI.
return false;
}
if (active_engine != FindSupportingEngine (uri)) {
if (active_engine.CurrentState == PlayerState.Playing) {
// If we're currently playing then we can't switch engines now.
// We can't ensure the active engine can play this URI.
return false;
} else {
// If we're not playing, we can switch the active engine to
// something that will play this URI.
SwitchToEngine (FindSupportingEngine (uri));
CheckPending ();
return true;
}
}
return true;
}