[FREE]πŸ”Š MKMusicPLayer Extension with remarkable features

Hello Koders ! today Iam introducing MKMusicPlayer Extension

The MKMusicPlayer extension is a non-visible component that provides audio playback functionality for your MIT App Inventor project. You can play audio files from local storage or a URL, control playback (play, pause, resume, stop), set the playback speed, control volume, and set looping.

The extension requires READ_EXTERNAL_STORAGE and INTERNET permissions.


Blocks



component_event (3)

AudioLoaded event
The AudioLoaded event is triggered when the audio is loaded and prepared for playback. It has one parameter, success , which is a boolean value indicating whether the audio was successfully loaded (true) or not (false).




component_event (2)

AudioEnded event
The AudioEnded event is triggered when the audio playback has finished. It does not have any parameters and does not return any value.







component_event

FadeInCompleted
Description: Event triggered when the fade-in effect has completed.




component_event (1)

component_event

FadeOutCompleted
Description: Event triggered when the fade-out effect has completed.






component_method

PlayAudio

  • (String filePath): Play an audio file from the given local storage path or assets file name.
    It releases any existing MediaPlayer instance, creates a new one, and starts playing the audio.


component_method (1)

PlayAudioFromURL

  • (String url):Play an audio file from the given URL. It releases any existing MediaPlayer instance, creates a new one, and starts playing the audio after preparing it asynchronously.


component_method (2)
PauseAudio`:

  • Pause the currently playing audio.




component_method (3)

ResumeAudio:

  • Resume the paused audio.


component_method (4)

StopAudio

  • Stop and release the MediaPlayer instance.


component_method (5)

SetSeekPosition

  • (int position): Set the seek position of the audio file in milliseconds.


component_method (8)

SetVolumeLevel
(

  • int volumeLevel) Control the volume level of the audio in the range of 0 to 100.



component_method (7)

SetPlaybackSpeed

  • (float speed) Set the playback speed of the audio file. This function is supported on Android devices running API level 23 (Marshmallow) and above.
    this take float speed like these values (0.25 , 0.5 , 1 , 1.5 ,2 ,2.5 , 3 )


component_method (6)

SetLooping

  • (boolean looping)`: Enable or disable looping of the audio.




component_method

GetVolumeLevel

  • This function retrieves the current volume level of the audio being played by the media player. The volume level is represented as a value ranging from 0 to 100.


component_method (11)

GetDuration

  • Get the total duration of the audio file in milliseconds.


component_method (12)

HasAudioEnded

  • Check if the audio file has ended.



component_method (13)

GetCurrentPosition

  • Get the current seek position of the audio file in milliseconds.


component_method (10)

IsLooping

  • Check if the audio is set to loop.


component_method (9)

IsPlaying

  • Check if the audio is currently playing.



blocks (3)

FadeIn

  • Description: This function applies a fade-in effect to a media player, gradually increasing the volume from 0 to the final volume level over a specified duration.
    By using this function, you can achieve a fade-in effect by gradually increasing the volume of a mediaPlayer from 0 to a specified level over a given duration.

  • Parameters:

    • duration: An integer representing the fade-in duration in milliseconds.
    • finalVolume: An integer representing the desired volume level at the end of the fade-in.


blocks (2)

FadeOut

  • Description: This function applies a fade-out effect to a media player, gradually decreasing the volume from the initial volume level to 0 over a specified duration.
    By using this function, you can achieve a fade-out effect by gradually decreasing the volume of a mediaPlayer from the initial volume level to 0 over a given duration. The mediaPlayer will be paused after the fade-out is completed.

  • Parameters:

    • duration: The duration of the fade-out effect in milliseconds.
    • initialVolume: An integer representing the starting volume level.



component_event

RestartWithFadeIn

  • Description: Restarts the audio playback with a fade-in effect at the beginning.

  • Parameters:

    • duration: The duration of the fade-out effect in milliseconds.
    • initialVolume: An integer representing the starting volume level.

This MKMusicPlayer will solve these issues




Video


AIX file

You can download it from here :

V1
:arrow_down: MKMusicPlayer.aix (19.1 KB)



V2
:arrow_down: MKMusicPlayer.aix (19.3 KB)




AIA file

You can download it from here :

MKplayer.aia (21.2 KB)


Β© Mr_koder. All rights reserved.

Thanks

Our Telegram Channel

Mr_Koder

Donate :

6 Likes

Nice Extension

1 Like

@ayan1 thanks

new blocks with features added

1 Like

Playback speed 1.2 - 1.75 … (Quarter) needs to be available too

it’s available just try it,
this extension has a range from 0.05 to 5 playback speed
However, I’m skeptical if it will have any significant impact.

How can I try it?

simply buy it and try it and if you have any problems you can contact me to solve it

The extension now is FREE

Enjoy

New Blocks Added and some bugs fixed

1 Like

Extension updated now you play audio files from assets , local paths and URLs

1 Like

how to write the path that works oofline to play from asd and local ones?

Check V2 please I have updated the topic

1 Like

Now the extension works great >> thanks dear

1 Like