We can see parcel of android applications playing videos inside the application. Putting videos inside the application will increase the application size and make it heavy. So considering all these things in our mind, we can transfer the video to Youtube and stream it in the application to reduction the application size.
Here is the code for the same:
Watch youtube video by using youtube Video Id. public static void watchYoutubeVideo(String id, Context con) { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id)); con.startActivity(intent); } catch (ActivityNotFoundException ex) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + id)); con.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } } //Use this method to watch youtube video.
Here is the code for the same:
Watch youtube video by using youtube Video Id. public static void watchYoutubeVideo(String id, Context con) { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id)); con.startActivity(intent); } catch (ActivityNotFoundException ex) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + id)); con.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } } //Use this method to watch youtube video.
0 comments:
Post a Comment