Spotify peut-il être mis en pause lors d’un appel Skype, comme le fait iTunes?

3

Lorsque j'écoute de la musique sur iTunes, la musique est automatiquement mise en pause lorsqu'un appel Skype est passé. Je suis récemment passé à Spotify pour ma ressource musicale. Puis-je avoir la même fonctionnalité de pause avec Spotify qu'avec iTunes?

Andra
la source
Quelles recherches avez-vous faites jusqu'à présent?
Buscar웃

Réponses:

0

Si vous utilisez Mac OS (OS X), essayez ce script AppleScript que je me suis fait rapidement reprocher (veuillez noter que je ne suis pas vraiment un développeur OS X et que ma connaissance d'AppleScript est, pour le moins, "intermédiaire")

https://github.com/jhuseinovic/skype-spotify-ctrl

(*
This script was developed by John Huseinovic ([email protected])
The purpose of the script is to pause any playing track in Spotify when there is a active/incoming call in skype and resume playing after the call is finished.
The script will only monitor if the both Skype and Spotify are running!
*)
set spotify_status to null
set notificationTitle to "Skype-Spotify Controller"
set call_started to false
set music_was_playing to false
repeat
    if application "Skype" is running and application "Spotify" is running then
        tell application "Skype"
            set calls to «event sendskap» given «class cmnd»:"SEARCH ACTIVECALLS", «class scrp»:"AnsweringScript"
            set callID to last word of calls
            if callID is not "CALLS" then

                using terms from application "Spotify"
                    set spotify_status to the player state of application "Spotify" as string
                end using terms from

                set status to «event sendskap» given «class cmnd»:"GET CALL " & callID & " STATUS", «class scrp»:"AnsweringScript"
                set caller to «event sendskap» given «class cmnd»:"GET CALL " & callID & " PARTNER_HANDLE", «class scrp»:"AnsweringScript"
                set call_started to true
                #log "set call_started to " & call_started
                if spotify_status = "playing" then
                    set music_was_playing to true
                    display notification "Active call with " & last word of caller & "! Spotify was " & spotify_status & ", going to pause it." with title notificationTitle
                    tell application "Spotify" to pause
                end if
            else
                #log "call_started is " & call_started
                if call_started is true and music_was_playing is true then
                    display notification "Detected terminated Skype call, resuming Spotify! Enjoy =)" with title notificationTitle
                    tell application "Spotify" to play
                end if
                set call_started to false
            end if
        end tell
        delay 1
    else
        delay 10
    end if

end repeat
jnovic
la source