In Android I can for example open mp4 files in user's apps from my own app (using Intents). In the next example - intent for playing a video:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(newVideoPath));
intent.setDataAndType(Uri.parse(newVideoPath), "video/mp4");
startActivity(intent);
Is there something similar for iOS? Can I open from my app for example url (of video) in Photos, VLC or another player (which are installed on iPhone/iPad)
if yes, any example in Swift
?
You should look at the documentation for Document interaction programming .
You can register file types that your app supports/can handle and then when a user selects a particular file from the files app or downloads from another app the system will offer a list of apps that can open this file, including yours.
UIActivityViewController might fit your needs.
For example,
let url = // URL to your .mp4 file
let activityVC = UIActivityViewController(activityItems: [url], applicationActivities: nil)
present(activityVC, animated: true, completion: nil)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.