This repository was archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use WebChannel to interact with WebEngineView
Close #172
- Loading branch information
1 parent
a5f856c
commit 22f7ff3
Showing
10 changed files
with
146 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var ready = false; | ||
var qWebChannel = null; | ||
var player = null; | ||
var refreshInterval = 100; | ||
|
||
function refresh() { | ||
if (ready && player.isRunning) | ||
player.updateResults = update(); | ||
} | ||
|
||
function initialize() { | ||
console.log("Connecting to MellowPlayer's WebChannel..."); | ||
try { | ||
qWebChannel = new QWebChannel(qt.webChannelTransport, function(channel) { | ||
console.log("Connected to MellowPlayer's WebChannel, ready to send/receive messages!"); | ||
player = channel.objects.player; | ||
|
||
// connect events to integration script functions | ||
player.play.connect(play); | ||
player.pause.connect(pause); | ||
player.next.connect(goNext); | ||
player.previous.connect(goPrevious); | ||
player.addToFavorites.connect(addToFavorites); | ||
player.removeFromFavorites.connect(removeFromFavorites); | ||
player.seekToPosition.connect(seekToPosition); | ||
player.changeVolume.connect(setVolume); | ||
|
||
ready = true; | ||
window.setInterval(refresh, refreshInterval); | ||
}); | ||
} | ||
catch (e) | ||
{ | ||
console.warn(e); | ||
} | ||
} | ||
|
||
initialize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.