Android Question How do I open a YouTube video on a Kindle Fire?

mistermentality

Active Member
Licensed User
Longtime User
I am using the following code from a forum post to parse a youtube url and open it with the youtube app....

B4X:
youtubevideo = Regex.Split("=", url1)
i.Initialize(i.ACTION_VIEW, "vnd.youtube:" & youtubevideo(1))
StartActivity(i)

where url1 is the video url, and it works great on every Android device, but fails on every Amazon Android device.

Amazon will not let the app onto their app store until it also works on their tablets. The problem is that when this code is called on a Kindle tablet it does not open the youtube app as expected but instead produces the error message "An error has occured".

Is there a way to open a youtube url on a Kindle that will also work on non Amazon devices?

Thanks,

Dave
 

mistermentality

Active Member
Licensed User
Longtime User
Add this line and try:
B4X:
i.SetComponent("com.google.android.youtube/.WatchActivity")

I don't have Kindle, so, give it a shot.

Thanks for this, I don't have a Kindle either so only thing I can do is add this, check it works fine on the devices I do have and resubmit it as Amazon will test on Kindles.

Dave
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
Unfortunately the code did not work, it now errors out (but again, only on Kindle tablets) with the message "An error has occurred... android.content.ActivityNotFoundException: Unable to find explicit activity..." yet works fine on non Amazon devices.

Any one know what's going on with the Kindles that makes them not want to play youtube videos, please?

Dave
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Try this:
B4X:
org.mozilla.gecko.YouTubePlayer
Instead of Google's YouTube app, you will have to find a way to identify a Kindle device.

Note that the above line is just a guess, so is not guaranteed to work.
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
That link did help educate me. I didn't realise that Kindles don't have YouTube installed on them, I will have to try and figure out how to identify the Kindles and use the suggestion from NJDude. Thanks for the replies, I shall leave it a day or so and try again once can identify the Kindles.

Dave
 
Upvote 0

eps

Expert
Licensed User
Longtime User
It's the same for Google Maps for instance.. Although they can install that on Kindles, but they don't have it out-of-the-box as it were.

I think on my Apps which have Google Maps / Nav integrated into them I just indicate this in the Testing Notes in Amazon, otherwise they fail.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…