protected override async Task <bool> PrepareContent() { loaded = false; startTime = TimeSpan.Zero; if (sound != null) { instance.Stop(); instance.Dispose(); UnloadAsset(sound); } await base.PrepareContent(); sound = LoadAsset <Sound>(AssetItem.Location); if (sound == null) { return(false); } instance = sound.CreateInstance(null, true); instance.SetRange(new PlayRange(TimeSpan.Zero, TimeSpan.Zero)); loaded = true; return(true); }
public void SetCurrentTime(TimeSpan value) { var wasPlaying = instance?.PlayState == PlayState.Playing; instance?.Stop(); startTime = value; instance?.SetRange(new PlayRange(value, sound.TotalLength)); if (wasPlaying) { instance?.Play(); } }