diff options
-rw-r--r-- | TOOLS/osxbundle/mpv.app/Contents/Info.plist | 10 | ||||
-rw-r--r-- | osdep/macosx_application.m | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Info.plist b/TOOLS/osxbundle/mpv.app/Contents/Info.plist index 4c9340d808..152e118416 100644 --- a/TOOLS/osxbundle/mpv.app/Contents/Info.plist +++ b/TOOLS/osxbundle/mpv.app/Contents/Info.plist @@ -190,6 +190,16 @@ <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleURLName</key> + <string>mpv Custom Protocol</string> + <key>CFBundleURLSchemes</key> + <array> + <string>mpv</string> + </array> + </dict> + <dict> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>CFBundleURLName</key> <string>Streaming Protocol</string> <key>CFBundleURLSchemes</key> <array> diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 7c5990d912..a522ad77fa 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -26,6 +26,8 @@ #include "osdep/macosx_application_objc.h" #include "osdep/macosx_compat.h" +#define MPV_PROTOCOL @"mpv://" + static pthread_t playback_thread_id; @interface Application (PrivateMethods) @@ -241,6 +243,11 @@ static NSString *escape_loadfile_name(NSString *input) NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + url = [url stringByReplacingOccurrencesOfString:MPV_PROTOCOL + withString:@"" + options:NSAnchoredSearch + range:NSMakeRange(0, [MPV_PROTOCOL length])]; + self.files = @[url]; if (self.willStopOnOpenEvent) { |