LoginSignup
2
2

More than 5 years have passed since last update.

2つの動画を2画面で同時ループ再生するAppleScript

Posted at

TL;DR

画質の違いをチェックしたり、サイネージ的にループ再生したい場面にて。

property _delaySecondsForLaunch : 10
property _leftMovieFilePath : "/Users/test/Downloads/bbb_sunflower_2160p_60fps_normal.mp4"
property _rightMovieFilePath : "/Users/test/Downloads/bbb_sunflower_1080p_60fps_normal.mp4"

set msg to "Launching Players ... "
display dialog msg giving up after _delaySecondsForLaunch

(* check screen size *)
tell application "Finder"
    set {x0, y0, screenWidth, screenHeight} to get bounds of window of desktop
end tell
-- display dialog "screen width: " & screenWidth & " / screen height: " & screenHeight with title "Screen Size"

(* open movies *)
tell application "QuickTime Player"
    activate

    open _leftMovieFilePath
    delay 1

    open _rightMovieFilePath
    delay 1
    tell every document
        set looping to true -- set loop
    end tell
end tell

(* Move right QuickTime Player to right display *)
tell application "System Events" to tell process "QuickTime Player"
    tell window 1
        set position to {screenWidth / 2, 0}
        delay 3
    end tell
end tell

(* play movies *)
tell application "QuickTime Player"
    present every document -- set fullscreen
    play every document -- play!
end tell

Memo

テスト環境はQuickTime Player 10.4 on MacOS 10.12.5(Sierra)。
簡単にできると思ったら、どうやらMacOS 10.10(Mavericks)以降からQuikcTime APIの内部仕様が変わったらしく、 set bounds が効かなくてハマった。
同じ要領で3画面以上もできそうだけど同一ファイルでの再生に対応してないので、そのうち調べる。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2