Hello,
I am trying to display images like a movie. I am loading the images from a container called "_ImManger" that returns a MemoryStream to a bindable ImageSoure.
this runs in a closed loop with a delay.
It works fine displaying the images BUT, every couple of seconds or so it gets stuck. (e.g. the ui freezes for a moment...)
I think this is a memory issue...
Any ideas?...
CODE:
Loop:
TimeSpan freq = TimeSpan.FromMilliseconds(1000.0 / 60.0); // freq = 1/fps (frames per sec)
while (_Play) {
try {
DateTime currentTime = DateTime.Now;
PlayerImageSource = ImageSource.FromStream(()=> {return _ImManger.GetImage();});
await Task.Delay((int)freq.TotalMilliseconds);
_LastTime = currentTime;
}
catch (Exception ex)
{
//TODO
}
}
Bindable element:
public ImageSource PlayerImageSource {
set { SetProperty (ref _ImageSource, value); }
get { return _ImageSource; }
}
Thanks!