mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-05 03:30:03 +00:00
Merge pull request #428 from ecoskey/feat/media_ipc
Add media ipc target
This commit is contained in:
@@ -166,4 +166,45 @@ Item {
|
||||
Settings.data.wallpaper.randomEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "media"
|
||||
function playPause() {
|
||||
MediaService.playPause()
|
||||
}
|
||||
|
||||
function play() {
|
||||
MediaService.play()
|
||||
}
|
||||
|
||||
function pause() {
|
||||
MediaService.pause()
|
||||
}
|
||||
|
||||
function next() {
|
||||
MediaService.next()
|
||||
}
|
||||
|
||||
function previous() {
|
||||
MediaService.previous()
|
||||
}
|
||||
|
||||
function seekRelative(offset: string) {
|
||||
var offsetVal = parseFloat(position)
|
||||
if (Number.isNaN(offsetVal)) {
|
||||
Logger.warn("Media", "Argument to ipc call 'media seekRelative' must be a number")
|
||||
return
|
||||
}
|
||||
MediaService.seekRelative(offsetVal)
|
||||
}
|
||||
|
||||
function seekByRatio(position: string) {
|
||||
var positionVal = parseFloat(position)
|
||||
if (Number.isNaN(positionVal)) {
|
||||
Logger.warn("Media", "Argument to ipc call 'media seekByRatio' must be a number")
|
||||
return
|
||||
}
|
||||
MediaService.seekByRatio(positionVal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,14 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function seekRelative(offset) {
|
||||
if (currentPlayer && currentPlayer.canSeek) {
|
||||
var newPosition = currentPlayer.position + offset;
|
||||
currentPlayer.position = newPosition;
|
||||
currentPosition = newPosition;
|
||||
}
|
||||
}
|
||||
|
||||
// Seek to position based on ratio (0.0 to 1.0)
|
||||
function seekByRatio(ratio) {
|
||||
if (currentPlayer && currentPlayer.canSeek && currentPlayer.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user