Valuedandloved - Trang Thông Tin Tổng Hợp Cập Nhật 24/24
  • Home
  • Du Lịch
  • Công Nghệ
  • Kinh Doanh
No Result
View All Result
  • Home
  • Du Lịch
  • Công Nghệ
  • Kinh Doanh
No Result
View All Result
Valuedandloved - Trang Thông Tin Tổng Hợp Cập Nhật 24/24
No Result
View All Result
Home Công Nghệ

How to Play a Sound File Using the MediaPlayer Class – Android Studio Tutorial

admin by admin
May 23, 2020
in Công Nghệ
50
How to Play a Sound File Using the MediaPlayer Class – Android Studio Tutorial



In this video we will take a look at a simple MediaPlayer example. We will play a local sound file from our raw folder and we will be able to pause, resume and stop the music. When we stop our MediaPlayer, we will immediately release it to free up system resources.

Check out the SoundPool video:

Source code:

____________________
❗ Subscribe to the channel:

⏯ Watch more tutorials:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:

Facebook:

Instagram:

Twitter:

Blog:

Nguồn: https://valuedandloved.com

Xem thêm bài viết khác: https://valuedandloved.com/cong-nghe/

Xem thêm Bài Viết:

  • Adobe Character Animator là gì? Top cấu hình máy tính chạy Character Animator
  • Tìm hiểu CRM bất động sản và những điều cần biết
  • Binary Option là gì? Giao dịch trên sàn Binary Option thực hiện như thế nào?
  • Top CPU Tốt Nhất 2020 Cho Người Build PC
  • Những lưu ý khi cài đặt và sử dụng phần mềm Microsoft Toolkit
Previous Post

Hướng dẫn cách tạo nhóm facebook trên điện thoại

Next Post

iOS 13.5 KHÔNG CẦN LÊN CŨNG ĐƯỢC

Next Post
iOS 13.5 KHÔNG CẦN LÊN CŨNG ĐƯỢC

iOS 13.5 KHÔNG CẦN LÊN CŨNG ĐƯỢC

Comments 50

  1. Angelo A. says:
    3 years ago

    Can I play a song that is on dropbox?

    Reply
  2. Yuval Farangi says:
    3 years ago

    thank you so much!!! helps me every time!!!

    Reply
  3. Abderrahim Elassaly says:
    3 years ago

    Hi, i need the video's link "keep music playing when we leave our app" PLZ
    Thanks

    Reply
  4. Fortunate Kidz says:
    3 years ago

    How do you put 2 or more songs there . When song 1 play , then I play song2 and song1 stop at that time. How to implement that ?

    Reply
  5. SHEIKH HARIS KHALID says:
    3 years ago

    How to do it using services??

    Reply
  6. Kevin Li says:
    3 years ago

    It freezes when I click "Play"

    Reply
  7. Ravi Sorathiya says:
    3 years ago

    Such a beautiful voice

    Reply
  8. Ravi Sorathiya says:
    3 years ago

    Hey bro you Are awesom
    Please make video on how you approaches your Android development skill from the starting and about tips to become a smart developer like you

    Reply
  9. tamer says:
    3 years ago

    Thank you, i stayed 2 days trying to figure out how to use the same instance of Media Player without creating a different instance of Media Player every time i click play or pause…even when i tried to save "Media Player " instance into firebase, i failed because of data Type..you solved it

    Reply
  10. Romit Gandhi says:
    3 years ago

    I want to stream audio data from one device to another device via bluetooth and play that received audio stream in android phone, can you tell me how can I do that?

    Reply
  11. Joshua Gunja says:
    3 years ago

    I want to create two raw directories is it possible?

    Reply
  12. Pranav Joshi says:
    3 years ago

    The nice thing about these videos, in particular, is that he explains what he's doing and why. This means that it's easier to build upon this knowledge later on and allows me to be more self-sufficient. If I use anyone else, I tend to have to come back to them and re-watch the whole thing if there is something I need to draw on. But with one of these, I can easily apply this knowledge elsewhere to further improve my projects without using valuable time re-watching videos I have already watched. Thank you so much for this content and keep up the good work!

    Reply
  13. Saida Parizi says:
    3 years ago

    the first relaxing coding lessons in the world

    Reply
  14. Viddesh K says:
    3 years ago

    If anyone have error in raw then take directory and named it raw

    Reply
  15. Garry Kraemer says:
    3 years ago

    Outstanding tutorial! I have been trying all day to get this working! You make it look easy! Thanks from a 71 yr old, ex FORTRAN, C, ADA real-time SW engineer (B-52 & F-15C/E/S!

    Reply
  16. Stephen says:
    3 years ago

    i record my my own music, i create regular sound files, mp3 and wav- is there no simple way to just copy the files to my phone(which I can do now) and play them with the "music" app that came with my phone ? – I cant believe how complicated this is. the "music" app does not see or scan media files I moved onto my phone. I dont want my media files uploaded to google or spotify I just want my phone to act like an mp3 player for local files. Help? I don't want to write code to do this either

    Reply
  17. นันทวัฒน์ says:
    3 years ago

    Thank you
    very much.

    Reply
  18. Anandh Nandu says:
    3 years ago

    Super Bro nice video
    And you can add the video coding Bro????

    Reply
  19. Handsome TV says:
    3 years ago

    hello, why do you change constraint to relative layout?

    Reply
  20. Avtem says:
    3 years ago

    Nothing happens when i click 'play' button, but 'stop' toast works fine

    Reply
  21. Siamak Aghili says:
    3 years ago

    You are the best teacher I have ever seen.

    Reply
  22. A R says:
    3 years ago

    @Coding in Flow Great tutorial! How can I use the speakers on the back of the smartphone?

    Reply
  23. Dean Yaukey says:
    3 years ago

    Your tutorial is great. Hoping you can help me get past one last hurdle. With this code I'm trying to play a 5 min song. It stops at almost exactly 1 min.

    Reply
  24. Samet Yılmaz says:
    3 years ago

    When i press the play button i got no sound! Please Help Me!

    Reply
  25. Ismail Ghedamsi says:
    3 years ago

    The channel is my main support for my android course in school

    Reply
  26. Ahmed Elsayed says:
    3 years ago

    Dam i love your WORK BRO
    You Great at this THINGS
    LOVE YOU

    Reply
  27. shaahid khan says:
    3 years ago

    hello
    bro my mp3 file has saved as text file can u help me to change the file pls !!!!

    Reply
  28. HH says:
    3 years ago

    Is there any problem if we use Stop method directly?

    Reply
  29. biene says:
    3 years ago

    cool ist nebenbei das man dem Button die Click-Funktion schon im xml-File zuweisen kann, dann braucht man nicht "umständlich" den ClickListener erstellen und zuweisen (also fast wie in C# und WPF)

    Reply
  30. biene says:
    3 years ago

    mega interessant, danke und thank you ;o)

    Reply
  31. Ertugrul says:
    3 years ago

    HI, I want to thank you for this insightful and good video. Thanks to you I just built my first App. I am an English teacher and I want to put tracks in an App. Can you also show (if you haven't done yet) switching between pages. EG

    Reply
  32. ema says:
    3 years ago

    could you please give me the link for the next lesson (the services)

    Reply
  33. Gustavo Valery says:
    3 years ago

    This is useless. You should teach people to load MediaFiles and do this actions in a Service Class.

    Reply
  34. Yhamin Polo says:
    3 years ago

    LOVE YOU BOY!

    Reply
  35. Justin says:
    3 years ago

    Thank you very much! Clear and simple, just what I needed

    Reply
  36. Tsuki Shiroi says:
    3 years ago

    Hi, thanks for your videos, can you please make a video about How to Play a Sound File list Using exoplayer? thanks

    Reply
  37. Mukhlisin GlobalTech says:
    3 years ago

    Eror:method stop in class mainactivity
    Required View
    Found no arguments
    Dll

    Reply
  38. Dve Ram says:
    3 years ago

    Can you do a tutorial for requesting and releasing AudioFocus?

    Reply
  39. Namer Hurr says:
    3 years ago

    Thanks for the video. It was very helpful!

    Reply
  40. Božidar Mitrovic says:
    3 years ago

    If we stop music player multiple times, isn't that going to cause NullPointerException, because MediaPlayer.create() method can return null? And if i am right, is there a way around this?

    Reply
  41. hocine GUEBBAS says:
    3 years ago

    you are the best. thank you man

    Reply
  42. Sandeep sahu says:
    3 years ago

    Sir after raw name i write music name but this is not show and get error

    Reply
  43. Calamity says:
    3 years ago

    Have you tried setting PlayBacKParams?

    Reply
  44. jayant kumar says:
    3 years ago

    Awesome video 🙂

    Reply
  45. hocine GUEBBAS says:
    3 years ago

    you are the best

    Reply
  46. Lhex B says:
    3 years ago

    When trying to play the sound, I get this E/MediaPlayer: Should have subtitle controller already set, Any help please

    Reply
  47. El que quiere dar su opinion says:
    3 years ago

    Ty man, this is awesome

    Reply
  48. Calamity says:
    3 years ago

    Can we integrate a file manager inside the app so the user with a press of a button opes up the file manager, browses and picks an audio file from the folders to be played by the MediaPlayer?

    Reply
  49. sks says:
    3 years ago

    how to do this with 20 different audio files in the same layout? using id on the button?

    Reply
  50. Calamity says:
    3 years ago

    Is there a way to set the mediaPlayer to replay the previous iteration?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Xem Thêm

Kawasaki Versys 300X, giá 169 triệu, Full Option | Motorrock

Kawasaki Versys 300X, giá 169 triệu, Full Option | Motorrock

August 14, 2020
Awkwafina May Join Jumanji Sequel

Awkwafina May Join Jumanji Sequel

November 10, 2020
Chùa Huyền Không Sơn Thượng – Huế

Chùa Huyền Không Sơn Thượng – Huế

March 27, 2020
[Review] Khách Sạn Hải Yên Mũi Né | Hotel Phan Thiết Bình Thuận – Dulich868.com

[Review] Khách Sạn Hải Yên Mũi Né | Hotel Phan Thiết Bình Thuận – Dulich868.com

March 27, 2020
Quất Lâm Biển Gọi – Chiêm Ngưỡng Vẻ Đẹp Toàn Cảnh Từ Flycam

Quất Lâm Biển Gọi – Chiêm Ngưỡng Vẻ Đẹp Toàn Cảnh Từ Flycam

March 27, 2020
SƯ BÀ TRỤ TRÌ CHÙA LÁ KHÁM CHỮA BỆNH MIỄN PHÍ CỨU NGƯỜI

SƯ BÀ TRỤ TRÌ CHÙA LÁ KHÁM CHỮA BỆNH MIỄN PHÍ CỨU NGƯỜI

March 27, 2020
  • Liên Hệ
  • Chính Sách Bảo Mật

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Du Lịch
  • Công Nghệ
  • Kinh Doanh

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.