public void LoadMedia(StreamType type, string file, float startPosition, float stopPosition) { this.startPosition = startPosition; this.stopPosition = stopPosition; aspectRationSet = false; if (type == StreamType.LocalFileStream) { streamMediaInput?.Dispose(); currStream?.Dispose(); currStream = localFileStreamClient.OpenStream(file); streamMediaInput = new StreamMediaInput(currStream); using var media = new Media(library, streamMediaInput); mediaPlayer.Media = media; } else { using var media = new Media(library, file); mediaPlayer.Media = media; } PlayUntillBuffered(); mediaPlayer.Position = startPosition; }