68 lines
1.6 KiB
QML
68 lines
1.6 KiB
QML
import QtQuick 2.0
|
|
import QtMultimedia 5.6
|
|
import Amber.Mpris 1.0
|
|
|
|
MprisPlayer {
|
|
id: mprisPlayer
|
|
property string song: ""
|
|
property string artist: "AllRadio"
|
|
|
|
serviceName: "harbour-allradio"
|
|
|
|
identity: "AllRadio2"
|
|
supportedUriSchemes: ["file"]
|
|
supportedMimeTypes: ["audio/x-wav", "audio/x-vorbis+ogg", "audio/mpeg", "audio/mp4a-latm", "audio/x-aiff"]
|
|
|
|
canControl: true
|
|
|
|
canGoNext: false //appstate.playlistIndex < appstate.playlist.count
|
|
canGoPrevious: false // appstate.playlistIndex > 0
|
|
canPause: radioPlayer.isPlaying ? true : false
|
|
canPlay: radioPlayer.isPaused ? true : false
|
|
|
|
canSeek: false// playback.seekable
|
|
hasTrackList: false
|
|
|
|
|
|
loopStatus: Mpris.LoopNone
|
|
shuffle: false
|
|
volume: 1
|
|
|
|
playbackStatus: {
|
|
if (radioPlayer.isPlaying) Mpris.Playing;
|
|
else if (radioPlayer.isPaused) Mpris.Paused;
|
|
else Mpris.Stopped;
|
|
/* switch (radioPlayer.playbackState) {
|
|
case Audio.PlayingState:
|
|
return Mpris.Playing
|
|
case Audio.PausedState:
|
|
return Mpris.Paused
|
|
default:
|
|
return Mpris.Stopped
|
|
}*/
|
|
}
|
|
|
|
|
|
metaData {
|
|
url: radioPlayer.source
|
|
contributingArtist: radioPlayer.metaInfo
|
|
title: radioPlayer._name
|
|
}
|
|
|
|
onPauseRequested:{
|
|
radioPlayer.pauseStream();
|
|
}
|
|
|
|
onPlayRequested: {
|
|
radioPlayer.resumeStream();
|
|
}
|
|
onPlayPauseRequested: {
|
|
radioPlayer.pauseStream();
|
|
}
|
|
onStopRequested: {
|
|
radioPlayer.pauseStream();
|
|
}
|
|
|
|
onOpenUriRequested: message.lastMessage = "Requested to open uri \"" + url + "\""
|
|
}
|