maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   jolla headset button start jolla-mediaplayer and play random music in background (https://talk.maemo.org/showthread.php?t=100479)

smatkovi 2018-09-24 10:12

jolla headset button start jolla-mediaplayer and play random music in background
 
like the title says i would like to have the function the n900 had back then to press the headsetbutton and then it would start the mediaplayer and play random music. i tried it for myself and as far as i got i also reported here https://together.jolla.com/question/...s-play-button/ i could get the mediaplayer to start playing music automatically, but it only would do this when the app gets into foreground and scanning of the library finished but not in the background, because i put the function or whatever in onFinished section of one qml and it waited for the gui to finish. now the question is how to get this scanning to be triggered in the background and then playing music is trivial^^. i managed to do this if i put the function or whatever outside the onFinished section, but it then strangely would only play one song. thanks in advance for any suggestions

smatkovi 2018-09-24 10:14

Re: jolla headset button start jolla-mediaplayer and play random music in background
 
putting AudioPlayer.shuffleAndPlay(allSongModel, allSongModel.count) in onFinished in /usr/share/jolla-mediaplayer/mediaplayer.qml lets the mediaplayer automatically play random music, but unfortunately not when the device is locked

smatkovi 2018-09-27 19:36

Re: jolla headset button start jolla-mediaplayer and play random music in background
 
i investigated a little and found out that the signal from the headset comes to the mpris section in the AudioPlayer.qml where also the function shuffleAndPlayAllAudio is located. the thing is ,it takes 2 arguments, model and some size, which both are only available in mediaplayer.qml, but how can i tell mediaplayer.qml from Audioplayer.qml to call the function shuffleAndPlayAllAudio? my idea was to send a signal from Audioplayer.qml, so i put in mpris section, which has the id mprisPlayer, signal mys and in onPlayRequested i put mprisPlayer.mys(). in mediaplayer.qml i changed onFinished to onMys and put the function to shuffle and play all audio there. but when i run jolla-mediaplayer it tells me cannot assign to non-existent property onMys


All times are GMT. The time now is 17:07.

vBulletin® Version 3.8.8