RandomCoder Well-Known Member Licensed User Longtime User Jul 28, 2014 #1 I was intending to use a VideoView in my app but I've found that the supported CODEC's on some devices is very poor and so I'm now using an intent to ask the user to select a pre-installed video player to use. But I was just wondering what would happen if no player was installed? Do I get an error that could be detected and then attempt to load the VideoView instead? I'm thinking that because it's starting a new activity, there will be no error and so no point using Try, Catch and load VideoView? Does anyone have any experience of this or a device with no player installed and willing to try this code... Code: Copy Try Dim i As Intent i.Initialize(i.ACTION_VIEW, "this would be a valid path") i.SetType("video/*") StartActivity(i) Catch MsgBox("No player selected", "ERROR") End Try I've tried it in the emulator and it doesn't show the message box but rather another message box saying unable to play video. Thanks, RandomCoder
I was intending to use a VideoView in my app but I've found that the supported CODEC's on some devices is very poor and so I'm now using an intent to ask the user to select a pre-installed video player to use. But I was just wondering what would happen if no player was installed? Do I get an error that could be detected and then attempt to load the VideoView instead? I'm thinking that because it's starting a new activity, there will be no error and so no point using Try, Catch and load VideoView? Does anyone have any experience of this or a device with no player installed and willing to try this code... Code: Copy Try Dim i As Intent i.Initialize(i.ACTION_VIEW, "this would be a valid path") i.SetType("video/*") StartActivity(i) Catch MsgBox("No player selected", "ERROR") End Try I've tried it in the emulator and it doesn't show the message box but rather another message box saying unable to play video. Thanks, RandomCoder
thedesolatesoul Expert Licensed User Longtime User Jul 28, 2014 #2 It will say something like: No app found to handle this format. You cant catch it. You can however use the packagemanager to find out if any app exists to handle it, and show a message to download a suitable video player. Upvote 0
It will say something like: No app found to handle this format. You cant catch it. You can however use the packagemanager to find out if any app exists to handle it, and show a message to download a suitable video player.
thedesolatesoul Expert Licensed User Longtime User Jul 28, 2014 #3 Like this: http://www.b4x.com/android/help/phone.html#packagemanager_queryintentactivities Upvote 0
RandomCoder Well-Known Member Licensed User Longtime User Jul 29, 2014 #4 I'd not thought of doing it like that. Thanks for the advice. It's often good to look at a problem from another perspective. Nothing's impossible with at little applied creativity Cheers, RandomCoder Upvote 0
I'd not thought of doing it like that. Thanks for the advice. It's often good to look at a problem from another perspective. Nothing's impossible with at little applied creativity Cheers, RandomCoder