-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from miru-project/feat/external-video-player
Feat external player
- Loading branch information
Showing
9 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:android_intent_plus/android_intent.dart'; | ||
import 'package:url_launcher/url_launcher_string.dart'; | ||
|
||
Future<void> launchMobileExternalPlayer(String playUrl, String player) async { | ||
switch (player) { | ||
case "vlc": | ||
await _launchExternalPlayer("vlc://$playUrl"); | ||
break; | ||
case "other": | ||
await AndroidIntent( | ||
action: 'action_view', | ||
data: playUrl, | ||
type: 'video/*', | ||
).launch(); | ||
break; | ||
} | ||
} | ||
|
||
// desktop | ||
Future<void> launchDesktopExternalPlayer(String playUrl, String player) async { | ||
switch (player) { | ||
case "vlc": | ||
const vlc = 'C:\\Program Files\\VideoLAN\\VLC\\vlc.exe'; | ||
await Process.run(vlc, [playUrl]); | ||
break; | ||
case "potplayer": | ||
await _launchExternalPlayer("potplayer://$playUrl"); | ||
break; | ||
} | ||
} | ||
|
||
_launchExternalPlayer(String url) async { | ||
if (!await launchUrlString(url, mode: LaunchMode.externalApplication)) { | ||
throw Exception("Failed to launch $url"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters