Open() public method

public Open ( SafeUri uri ) : void
uri Hyena.SafeUri
return void
Ejemplo n.º 1
0
        private void OpenCheck(object o, bool play)
        {
            if (CurrentState == PlayerState.NotReady)
            {
                pending_playback_for_not_ready      = o;
                pending_playback_for_not_ready_play = play;
                return;
            }

            SafeUri   uri   = null;
            TrackInfo track = null;

            if (o is SafeUri)
            {
                uri = (SafeUri)o;
            }
            else if (o is TrackInfo)
            {
                track = (TrackInfo)o;
                uri   = track.Uri;
            }
            else
            {
                return;
            }

            if (track != null && (track.MediaAttributes & TrackMediaAttributes.ExternalResource) != 0)
            {
                RaiseEvent(new PlayerEventArgs(PlayerEvent.EndOfStream));
                return;
            }

            PlayerEngine supportingEngine = FindSupportingEngine(uri);

            SwitchToEngine(supportingEngine);
            CheckPending();

            if (track != null)
            {
                active_engine.Open(track);
            }
            else if (uri != null)
            {
                active_engine.Open(uri);
            }

            if (play)
            {
                active_engine.Play();
            }
        }
Ejemplo n.º 2
0
        private void OpenCheck(object o, bool play)
        {
            if (CurrentState == PlayerState.NotReady)
            {
                pending_playback_for_not_ready      = o;
                pending_playback_for_not_ready_play = play;
                return;
            }

            SafeUri   uri   = null;
            TrackInfo track = null;

            if (o is SafeUri)
            {
                uri = (SafeUri)o;
            }
            else if (o is TrackInfo)
            {
                track = (TrackInfo)o;
                uri   = track.Uri;
            }
            else
            {
                return;
            }

            IncrementLastPlayed();

            FindSupportingEngine(uri);
            CheckPending();

            if (track != null)
            {
                active_engine.Open(track);
                incremented_last_played = false;
            }
            else if (uri != null)
            {
                active_engine.Open(uri);
                incremented_last_played = false;
            }

            if (play)
            {
                active_engine.Play();
            }
        }