-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements #78
Improvements #78
Conversation
uiryuu
commented
Jan 7, 2017
•
edited
edited
- Handle error code when adding unsupported subtitles and audios.
- Enable dragging subtitles in VideoView.
- Change the original behavior in PlaylistDragDestView when dragging. It will not add non-video files into playlist now.
Prevent fatal error when subtitles and audios are not supported.
Prevent fatal error when subtitles and audios are not supported.
Prevent fatal error when subtitles and audios are not supported.
Prevent fatal error when subtitles and audios are not supported.
|
||
override func performDragOperation(_ sender: NSDraggingInfo) -> Bool { | ||
let board = sender.draggingPasteboard() | ||
let fileURL: NSURL? = NSURL(from: board) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution only supports single file.
Please refer to PlaylistDragDestView.swift
.
override func performDragOperation(_ sender: NSDraggingInfo) -> Bool { | ||
let board = sender.draggingPasteboard() | ||
let fileURL: NSURL? = NSURL(from: board) | ||
playerCore.loadExternalSubFile(fileURL as! URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe need to check whether it's a subtitle file, if not, load the dragged file (as video).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a list of the support format of subtitles, audio tracks and videos? I think it helps to handle.
func loadExternalAudioFile(_ url: URL) { | ||
mpvController.command(.audioAdd, args: [url.path]) | ||
mpvController.command(.audioAdd, args: [url.path], checkError: false, returnValueCallback: failedLoadExternalAudioFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using a block here. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Revise later.
func loadExternalSubFile(_ url: URL) { | ||
mpvController.command(.subAdd, args: [url.path]) | ||
mpvController.command(.subAdd, args: [url.path], checkError: false, returnValueCallback: failedLoadExternalSubFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Change the original behavior in PlaylistDragDestView when dragging. It will not add non-video files into playlist now.
VideoView and playlist now accept every file except subtitles.