MB.MediaAudioPlay is stopped when screen orientation change

stefanoa

Active Member
Licensed User
Longtime User
B4X:
Dim MB As MediaBrowser
...
MB.Initialize("MB")
...
MB.MediaAudioPlay(True, ID)
...

why when screen orientation change, the play is stopped?

(i've no mb.mediastop or mb.mediapause in activity_pause or activity_resume)

I need the playing continues without interruptions..

thanks
:sign0085:
 

stefanoa

Active Member
Licensed User
Longtime User
i do:
B4X:
Dim MB As MediaBrowser
...
'--- start play as service
playService.MB = MB
playService.ID_AudioFile = playButton.Tag
StartService(playService)

PlayService:
B4X:
Sub Process_Globals
Dim MB As MediaBrowser 
Dim ID_AudioFile As Int
End Sub

Sub Service_Start (StartingIntent As Intent)
        '--- play file
        MB.MediaAudioPlay(True, ID_AudioFile)
End Sub

Sub Service_Destroy
   MB.MediaStop
End Sub

But when i rotate screen now the music continues to play, but if user click on other song, STARTS 2 SERVICES and the 2 songs overlap...!
can i control if service is active and kill it before start new service? (should play only the last selected song)

thanks
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User

Put "Dim MB As MediaBrowser" in Process_Globals. You don't need a service.

See this post
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…