Hi guys!
I need app to continue playing when user turns screen off.
Can we do it somehow in Gideros?
(Currently when user turns screen off, Event.APPLICATION_SUSPEND triggers
and Event.APPLICATION_RESUME after turning screen on)
Can we ignore that Event.APPLICATION_SUSPEND and make app run there normally like nothing happened?
Many thanks!
Comments
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
(but I guess I'll skip learning freaking Android Studio for now, I already have enough adventures in my life)
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
I've found description of my intentions: https://stackoverflow.com/questions/39080815/continue-playing-the-music-when-screen-goes-off
(actually I need just mp3 to continue playing)
People on stackoverflow say that event ".onPause" triggers.
Does Gideros also react to that ".onPause" event? Can it be ignored somehow?
p.s. I'm looking at audio-related files https://github.com/gideros/gideros/blob/master/libgid/src/gaudio.cpp
and https://github.com/gideros/gideros/blob/master/libgid/src/android/gaudio-background-mediaplayer.cpp
but still have no idea what could possibly be done
Many thanks!
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Long answer: from the github source code it seems that the sound (music) is paused when your app is paused (screen off, put in background, ...)
It seems to be this code for android:
https://github.com/gideros/gideros/blob/master/android/GiderosAndroidPlayer/app/src/main/java/com/giderosmobile/android/player/GGMediaPlayerManager.java
Unfortunately you cannot modify this file yourself because it is precompiled inside gideros.aar file in the template (see: http://forum.giderosmobile.com/discussion/7802/media-plugin)
PS: I am watching the video to see the best way to use media in android (from your so question you posted above). done!
PS2: there seems to be much more to this (putting controls on the home screen, ...) https://github.com/android/uamp
Likes: Apollo14
So after commenting out this piece of code in GGMediaPlayerManager.java and recompiling gideros.aar, audio will continue playing after screen is turned off?
How to recompile gideros.aar? In can be done in QT?
@hgy29 would you be so kind to recompile this file? (if it's all set on your machine, I've never worked with QT, not sure how it's all done there)
MANY THANKS guys!
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: talis
It works like a charm now! Audio is playing when screen is off.
@MoKaLux @hgy29 Thanks a lot guys!!
Likes: MoKaLux, talis, antix
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)