Samsung / Tizen.CircularUI

Tizen Wearable CircularUI project is to develop an open source software motivate software developer to creating Tizen Wearable Xamarin Forms app more easily and efficiently.
Other
80 stars 32 forks source link

MediaPlayer Seek does not work properly during playback #358

Closed Luk164 closed 3 years ago

Luk164 commented 3 years ago

Describe the bug When a video is being played seeking is not working properly. It works as expected while paused.

I have the following code for seeking forward and rewinding a video:

RotaryEventManager.Rotated += (sender, args) =>
{
    if (args.IsClockwise)
    {
        //Forward video
        Device.BeginInvokeOnMainThread(() => {
            Player.Seek(Player.Position + 2000);
        });
    }
    else
    {
        //Reverse video
        Device.BeginInvokeOnMainThread(() => {
            Player.Seek(Player.Position - 2000);
        });
    }
};

Here is the xaml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="MyAppTTS.Views.MediaViewPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:c="clr-namespace:Tizen.Wearable.CircularUI.Forms;assembly=Tizen.Wearable.CircularUI.Forms"
    xmlns:viewModels="clr-namespace:MyAppTTS.ViewModels">
    <ContentPage.BindingContext>
        <viewModels:MediaViewViewModel/>
    </ContentPage.BindingContext>

    <ContentPage.Content>
        <c:MediaView>
            <c:MediaPlayer
                x:Name="Player"
                AutoPlay="False"
                Source="sample-mp4-file.mp4"
                UsesEmbeddingControls="true"
                BufferingStarted="OnBufferingStarted"
                BufferingCompleted="OnBufferingCompleted"
                PlaybackStarted="OnPlaybackStarted"
                PlaybackPaused="OnPlaybackPaused"
                PlaybackStopped="OnPlaybackStopped"
                PlaybackCompleted="OnPlaybackCompleted" />
        </c:MediaView>
    </ContentPage.Content>
</ContentPage>

To Reproduce Steps to reproduce the behavior:

  1. Use the provided code to make a view
  2. Start playing video
  3. Rotate bezel
  4. Pause video
  5. Rotate bezel

Expected behavior Seeking works the same if the video is playing or paused.

Environment (please complete the following information):

myroot commented 3 years ago

Hi, I identify this issue It seems limitation of platform media player. it is working well if seeking enough long different time (for example Seek(Player.Position + 5000)),

We can only seek on key frame, So, if there is no keyframe between current position and seeking position, it will be seeked on current position

Luk164 commented 3 years ago

@myroot I also noticed these two functions that do not seem to be documented:

If executed like this: Player.FastForwardCommand.Execute(null); They seem to seek +/- 5s.