Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
00795441
Commit
00795441
authored
Oct 20, 2014
by
Ulrich Trampe
Committed by
Felix Paul Kühne
Oct 20, 2014
Browse files
VLC for iOS improved x-callback-url implementation
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
af363eca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Sources/VLCAppDelegate.m
View file @
00795441
...
...
@@ -142,6 +142,7 @@
NSString
*
action
=
[
url
.
path
stringByReplacingOccurrencesOfString
:
@"/"
withString
:
@""
];
NSURL
*
movieURL
=
nil
;
NSURL
*
successCallback
=
nil
;
NSString
*
fileName
=
nil
;
for
(
NSString
*
entry
in
[
url
.
query
componentsSeparatedByString
:
@"&"
])
{
NSArray
*
keyvalue
=
[
entry
componentsSeparatedByString
:
@"="
];
if
(
keyvalue
.
count
<
2
)
continue
;
...
...
@@ -150,6 +151,9 @@
if
([
key
isEqualToString
:
@"url"
])
{
movieURL
=
[
NSURL
URLWithString
:
value
];
}
else
if
([
key
isEqualToString
:
@"filename"
])
{
fileName
=
value
;
}
else
if
([
key
isEqualToString
:
@"x-success"
])
{
successCallback
=
[
NSURL
URLWithString
:
value
];
}
...
...
@@ -157,6 +161,9 @@
if
([
action
isEqualToString
:
@"stream"
]
&&
movieURL
)
{
[
self
openMovieFromURL
:
movieURL
successCallback
:
successCallback
];
}
else
if
([
action
isEqualToString
:
@"download"
]
&&
movieURL
)
{
[
self
downloadMovieFromURL
:
movieURL
fileNameOfMedia
:
fileName
];
}
}
else
{
NSString
*
receivedUrl
=
[
url
absoluteString
];
if
([
receivedUrl
length
]
>
6
)
{
...
...
@@ -184,7 +191,7 @@
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"OPEN_STREAM_OR_DOWNLOAD"
,
nil
)
message
:
url
.
absoluteString
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
)
otherButtonTitles
:
@[
NSLocalizedString
(
@"BUTTON_PLAY"
,
nil
)]];
alert
.
completion
=
^
(
BOOL
cancelled
,
NSInteger
buttonIndex
)
{
if
(
cancelled
)
[
[
self
download
ViewController
]
addURLToDownloadList
:
url
fileNameOfMedia
:
nil
];
[
self
download
MovieFromURL
:
url
fileNameOfMedia
:
nil
];
else
[
self
openMovieFromURL
:
url
];
};
...
...
@@ -411,6 +418,17 @@
[
UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
NO
;
}
#pragma mark - download handling
-
(
void
)
downloadMovieFromURL
:(
NSURL
*
)
url
fileNameOfMedia
:(
NSString
*
)
fileName
{
[
self
.
downloadViewController
addURLToDownloadList
:
url
fileNameOfMedia
:
fileName
];
// select Downloads menu item and reveal corresponding viewcontroller
[
self
.
menuViewController
selectRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
2
inSection
:
1
]
animated
:
NO
scrollPosition
:
UITableViewScrollPositionNone
];
}
#pragma mark - playback view handling
-
(
void
)
openMediaFromManagedObject
:(
NSManagedObject
*
)
mediaObject
...
...
Sources/VLCMovieViewController.m
View file @
00795441
...
...
@@ -905,12 +905,12 @@
-
(
IBAction
)
closePlayback
:(
id
)
sender
{
[
self
setControlsHidden
:
NO
animated
:
NO
];
[
self
.
navigationController
dismissViewControllerAnimated
:
YES
completion
:
nil
];
// switch back to the caller when user presses "Done"
if
(
self
.
successCallback
&&
[
sender
isKindOfClass
:[
UIBarButtonItem
class
]])
{
[[
UIApplication
sharedApplication
]
openURL
:
self
.
successCallback
];
}
[
self
.
navigationController
dismissViewControllerAnimated
:
YES
completion
:
^
{
// switch back to the caller when user presses "Done"
if
(
self
.
successCallback
&&
[
sender
isKindOfClass
:[
UIBarButtonItem
class
]])
{
[[
UIApplication
sharedApplication
]
openURL
:
self
.
successCallback
];
}
}
];
}
-
(
IBAction
)
positionSliderAction
:(
UISlider
*
)
sender
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment