What is the difference between GoToPlaylistItem and GoToPlaylistItemOnNextTick

It is impossible to understand the difference between bettwen GoToPlaylistItemand GoToPlaylistItemOnNextTickalthough I GoToPlaylistItemOnNextTickclicked on the scripts where it GoToPlaylistItemdoes not work.

If you are wondering if there are any differences, look at the Message to solve the problem with GoToPlaylistItemOnNextTick, while he threw a null exception withGoToPlaylistItem

While I switched to protection, I received the following data. Can someone explain?

[ScriptableMember]
public virtual void GoToPlaylistItem(int playlistItemIndex);
public void GoToPlaylistItemOnNextTick(int playlistItemIndex);
+3
source share
1 answer

MediaPlayeruses Timerinternally. This timer is created in a protected method CreatePositionTimer:

protected void CreatePositionTimer(TimeSpan interval)
{
    if (m_timer == null)
    {
        m_timer = new DispatcherTimer();
        m_timer.Interval = interval; // 6 NTSC frames
        m_timer.Tick += new EventHandler(OnTimerTick);
    }
}

GoToPlaylistItemOnNextTick :

public void GoToPlaylistItemOnNextTick(int playlistItemIndex)
{
    if (!m_goToItemOnNextTick) // don't set it if already set
    {
        m_goToItemOnNextTick = true;
        m_goToItemOnNextTickIndex = playlistItemIndex;
    }
}

, , OnTimerTick, , GoToPlaylistItem:

void OnTimerTick(object sender, EventArgs e)
{
    [...]

    if (m_goToItemOnNextTick)
    {
        m_goToItemOnNextTick = false;
        GoToPlaylistItem(m_goToItemOnNextTickIndex);
    }

    [...]
}

, , GoToPlaylistItem , GoToPlaylistItemOnNextTick . , , - System.Windows.Threading.DispatcherTimer. , GoToPlaylistItem , .

, , MediaPlayer, StateChanged. GoToPlaylistItem, GoToPlaylistItem. GoToPlaylistItemOnNextTick, , , .

+1

Source: https://habr.com/ru/post/1764650/


All Articles