View Issue Details

IDProjectCategoryView StatusLast Update
0002174NoesisGUIC# SDKpublic2021-12-10 14:59
ReporterDavidYawCSpeed Assigned Tohcpizzi  
PrioritynormalSeveritymajor 
Status resolvedResolutionfixed 
Product Version3.1.1 
Target Version3.1.3Fixed in Version3.1.2 
Summary0002174: MediaPlayer: Errors when calling methods rapid-fire
Description

I'm getting various errors when I call various methods on MediaElement rapid-fire.

I haven't tried every combination, but I have found this:

  • Pause() followed by setting Position: This causes playback to stop working, and the last displayed frame stays on the screen. Loading a different video seems to reset things.
  • Multiple sets of Position: MediaFailed event gets raised, with a null e.ErrorException. The majority of the time, a later call to Play() succeeds, but sometimes it does cause playback to stop working.

I could implement a wrapper around MediaElement to check for these timing requirements, and wait until the required time is elapsed, but I would need to know which combinations of methods cannot be called rapid-fire, and I'd need some way to know when it's good to call the method again. I could just implement a hard 3 second delay between each call, but the actual time required is probably different for different video files, so a real solution would probably involve interacting with the 'mp' utility to know when it's safe to call again.

Steps To Reproduce

My testing code: Start a video playing, and then run this method:


public async void OddballTest()
{
logger.Trace("OddballTest(): About to Pause");
MediaElement.Pause();
DELAY_OF_SOME_SORT_1

TimeSpan startingPosition = MediaElement.Position;

for (int i = 1; i <= 5; i++)
{
    logger.Trace("OddballTest(): About to Position +=");
    MediaElement.Position = startingPosition + i * TimeSpan.FromSeconds(10);
    DELAY_OF_SOME_SORT_2
}
logger.Trace("OddballTest(): About to Play");
MediaElement.Play();
logger.Trace("OddballTest(): Done");

}

  • DELAY_OF_SOME_SORT_1 = nothing, DELAY_OF_SOME_SORT_2 = nothing: Playback freezes up, always. Usually there's MediaFailed events, sometimes not. e.ErrorException is always null.
  • DELAY_OF_SOME_SORT_1 = await Task.Delay(10000), DELAY_OF_SOME_SORT_2 = nothing: Usually MediaFailed events, sometimes not. Sometimes the call to Play() succeeds and resumes video playback, sometimes it takes a couple calls to Play/Pause/Play/Pause/Play.
  • DELAY_OF_SOME_SORT_1 = await Task.Delay(3000), DELAY_OF_SOME_SORT_2 = await Task.Delay(3000): Works perfectly. Able to see the intermediate frames as it steps forward in the video 5 times, and playback resumes properly.
  • I tried a very short delay: ThreadSwitcher ResumeBackground followed immediately by ResumeForeground, which should be a single iteration of the main Render loop. Same behavior as no delay at all.
  • I tried a slightly longer delay: await Task.Delay(20), slightly longer than 1 frame. Results were the same as no delay.
PlatformLinux

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-10-29 04:37 DavidYawCSpeed New Issue
2021-10-29 10:33 sfernandez Assigned To => hcpizzi
2021-10-29 10:33 sfernandez Status new => assigned
2021-10-29 10:33 sfernandez Target Version => 3.1.3
2021-12-10 14:59 hcpizzi Status assigned => resolved
2021-12-10 14:59 hcpizzi Resolution open => fixed
2021-12-10 14:59 hcpizzi Fixed in Version => 3.1.2