Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play Local Audio #354

Closed
khun-ye opened this issue Jun 10, 2020 · 11 comments
Closed

Play Local Audio #354

khun-ye opened this issue Jun 10, 2020 · 11 comments
Assignees
Labels
1 backlog Awaiting response question Further information is requested

Comments

@khun-ye
Copy link

khun-ye commented Jun 10, 2020

How can we play local audio with this plugin?

@khun-ye khun-ye added 1 backlog question Further information is requested labels Jun 10, 2020
@ryanheise
Copy link
Owner

I think this is plausibly a "frequently asked question", although the answer is rather straightforward:

This plugin does not play audio.

This plugin only wraps around your existing audio code to allow it to work in the background, but it doesn't care how you actually play the audio. It's up to you to use other plugins to play the audio. This is what I have tried to explain in the README file, although hopefully a FAQ entry will help.

If you look at the example, you'll see it uses the just_audio plugin to play audio, so a starting point would be for you to consult the documentation of that plugin rather than this plugin (which doesn't play audio). You will find the answers there.

@khun-ye
Copy link
Author

khun-ye commented Jun 10, 2020

Sorry for my confusion question. I want to know that, if we want to play local or asset audio ,
how can we set the audio file url in id's of MediaItem insted of fetching the remote url.
MediaItem(
id: "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3",
album: "Science Friday",
title: "A Salute To Head-Scratching Science",
artist: "Science Friday and WNYC Studios",
duration: Duration(milliseconds: 5739820),
artUri:
"https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg",
)

@khun-ye khun-ye closed this as completed Jun 10, 2020
@khun-ye khun-ye reopened this Jun 10, 2020
@ryanheise
Copy link
Owner

The id is just a unique id for your media item. As per the documentation:

/// Metadata about an audio item that can be played, or a folder containing
/// audio items.
class MediaItem {
  /// A unique id.
  final String id;

It is not required to be a URL.

@khun-ye
Copy link
Author

khun-ye commented Jun 10, 2020

if i placed asset file url . or local url. it doen't read it.how do I solve that?

@ryanheise
Copy link
Owner

it doen't read it.

If I add this question to the FAQ, I need it to be a clear question. Can you clarify what each of your two "it" references refer to?

@khun-ye
Copy link
Author

khun-ye commented Jun 10, 2020

if I call Local assets audio file in MediaItem like this
id: "assets/audio/1591766340463.mp3"
it doen't know that url. any way to call the local assets.
How could I load Audio from Assets?
I hope you will know my question.
Thank you.

@ryanheise
Copy link
Owner

Can you rephrase your question without using the word "it"? That way I will hopefully know what you mean.

@lucasjbyoung
Copy link

You can use setAsset() instead of setUri(), like this: setAsset("assets/audio/1591766340463.mp3");

@Okladnoj
Copy link

image
why is the local file not loaded? the picture in the curtain does not appear.

@ryanheise
Copy link
Owner

I'm sorry this issue is closed. But I will improve the documentation if you submit a documentation request describing which part of the documentation i should improve. Please click on "New issue", and then click the appropriate link from that page.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog Awaiting response question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants