76 lines
2.0 KiB
QML
76 lines
2.0 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
|
|
/*
|
|
function playNext() {
|
|
if (playlistIndex < playlistCount && playlistIndex < playlist.count) playlistIndex = playlistIndex + 1
|
|
loadPlaylistSelected()
|
|
}
|
|
|
|
function playPrev() {
|
|
if (playlistIndex <= playlistCount && playlistIndex > 0) playlistIndex = playlistIndex - 1 //: playlistIndex = 0
|
|
loadPlaylistSelected()
|
|
}
|
|
*/
|
|
|
|
|
|
canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 && radioPlayer._favorite
|
|
//true //appstate.playlistIndex < appstate.playlist.count
|
|
canGoPrevious: radioPlayer.playlistIndex > 0 && radioPlayer._favorite// 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;
|
|
}
|
|
|
|
metaData {
|
|
url: radioPlayer.source
|
|
contributingArtist: radioPlayer.metaData.title
|
|
title: radioPlayer._name
|
|
}
|
|
|
|
onNextRequested: radioPlayer.playNext()
|
|
|
|
onPreviousRequested: radioPlayer.playPrev()
|
|
|
|
onPauseRequested:{
|
|
radioPlayer.pauseStream();
|
|
}
|
|
|
|
onPlayRequested: {
|
|
radioPlayer.resumeStream();
|
|
}
|
|
onPlayPauseRequested: {
|
|
radioPlayer.isPaused ? radioPlayer.playStream() : radioPlayer.pauseStream();
|
|
}
|
|
onStopRequested: {
|
|
radioPlayer.pauseStream();
|
|
}
|
|
|
|
onOpenUriRequested: message.lastMessage = "Requested to open uri \"" + url + "\""
|
|
}
|