The current recommended way to play YouTube videos on any Android device

Hello, I have a video application, so all videos exist on Youtube . now Google says in its IO that there will soon be a Youtube API for android . it was 2.5 months ago. any, I have an Html5 player using javascript plus a flash player for Youtube , but Html5 does not work on all devices, and the flash player does not work on android 4.0 and higher. There is a way to play videos in the app and support all devices!

+4
source share
2 answers

You can run Intent to run the built-in Youtube application:

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:"+ YOUR_VIDEO_ID)); startActivity(intent); 
0
source

I tried the following when programming for browsers: Create an HTML5 video using this example: Video for everyone

If you look at this, at the end you will see that when all arent sources are supported, it will receive a flash file. If this also does not work, you can try to use the library as a backup option even after the flash in this example. I'm not sure (little programming experience for android), but if sources, flash and javascript / other libraries do not work ... I don't know. Excuse me:)

Perhaps you could use a clean javascript solution?

I hope you can get a little more of my answer, although it may already be known to you.

Be careful!

0
source

Source: https://habr.com/ru/post/1437369/


All Articles