question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Play() methods plays from the beginning and doesn't work after play and SeekTo issue

See original GitHub issue

I have this code:

private async void Play(fileUri) {
     // e.g., fileUri = "http://somesite.com/someaudio.mp3";
     await CrossMediaManager.Current.Play(fileUri);
}

And always I play the audio, it loads the audio through HTTP all again and plays from beginning. What’s the right way to handle the player?

Also, I have this:

private async void Pause(object obj) {
     await CrossMediaManager.Current.Pause();
}

If I play a sound, pause it and play it again, it plays like a second and stops, I don’t know the reason.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jmartine2commented, Mar 2, 2017

I’m honestly not sure. As I said, my only experience is with seeking while the media is already playing. Maybe someone else knows.

1reaction
jmartine2commented, Mar 2, 2017

Here’s what I do:

When starting a song for the first time:

IMediaFile mediaFile = new MediaFile { Type = MediaFileType.Audio, Url = mediaSource };
await CrossMediaManager.Current.Play(mediaFile);

Pause:

CrossMediaManager.Current.Pause();

Resume:

await CrossMediaManager.Current.PlaybackController.Play();

Read more comments on GitHub >

github_iconTop Results From Across the Web

Play() methods plays from the beginning and doesn't work ...
@jmartine2 I found the SeekTo method, but it only works after the player is already set. For example, in the if block below,...
Read more >
android - MediaPlayer seekTo doesn't work
I've just experienced the same issue. The solution was to use MediaPlayer.OnSeekCompleteListener . However in my case there weren't any problems ...
Read more >
MediaPlayer
Quickly bring your app to life with less code, using a modern declarative approach to UI, and the simplicity of Kotlin. ... Start...
Read more >
YouTube Player API Reference for iframe Embeds
Embed a YouTube player in your application. ... then call the playVideoAt() function, the player will start playing at the beginning of the...
Read more >
YouTube Embedded Players and Player Parameters
Overview. This document explains how to embed a YouTube player in your application and also defines the parameters that are available in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found