Skip to content

Commit

Permalink
✨ windows Media Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerluiz committed Aug 3, 2020
1 parent 409acdc commit 9f48dd0
Show file tree
Hide file tree
Showing 5 changed files with 1,146 additions and 10 deletions.
17 changes: 16 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const rainmeterNowPlaying = require('./src/providers/rainmeterNowPlaying')
const companionServer = require('./src/providers/companionServer')
const discordRPC = require('./src/providers/discordRpcProvider')
const mprisProvider = require('./src/providers/mprisProvider')
const windowsMediaProvider = require('./src/providers/windowsMediaProvider')

const { calcYTViewSize } = require('./src/utils/calcYTViewSize')
const { isWindows, isMac, isLinux } = require('./src/utils/systemInfo')
Expand Down Expand Up @@ -322,7 +323,12 @@ function createWindow() {
view.webContents.on('media-started-playing', function () {
if (!infoPlayerProvider.hasInitialized()) {
infoPlayerProvider.init(view)
mprisProvider.setRealPlayer(infoPlayerProvider) //this lets us keep track of the current time in playback.
if (isLinux()) {
mprisProvider.setRealPlayer(infoPlayerProvider) //this lets us keep track of the current time in playback.
}
if (isWindows()) {
windowsMediaProvider.init(view)
}
}

if (isMac()) {
Expand Down Expand Up @@ -386,6 +392,8 @@ function createWindow() {

activityIsPaused = playerInfo.isPaused
activityLikeStatus = playerInfo.likeStatus

windowsMediaProvider.setPlaybackStatus(playerInfo.isPaused)
}

mediaControl.setProgress(
Expand Down Expand Up @@ -447,6 +455,13 @@ function createWindow() {
) {
tray.balloon(title, author, cover, iconDefault)
}

windowsMediaProvider.setPlaybackData(
title,
author,
cover,
album
)
}

if (!isMac() && !settingsProvider.get('settings-shiny-tray')) {
Expand Down
Loading

0 comments on commit 9f48dd0

Please sign in to comment.