ablake / kotlin-news-for-android

A simple Android app for browsing Kotlin news, meant to demonstrate architectural principles and implement core functionality applicable to most apps.
Apache License 2.0
0 stars 0 forks source link

Handle YouTube video links #7

Open ablake opened 4 years ago

ablake commented 4 years ago

Many reddit posts are video links. Most of these are links to YouTube videos, so we'll add support for them first. Videos should load in the news item view and it should be possible to expand them to fullscreen mode.

First we need to investigate the best player to use. The simplest option is the MediaPlayer API, but it may not support YouTube links out of the box. There's an official YouTube Android Player API, but it hasn't been maintained for years and open-source alternatives such as may be better. It should also be possible to use ExoPlayer to play YouTube videos, which will also support many other types of video links, but that solution might be more complex than necessary for a) the most common use case and b) keeping this app relatively simple for the purpose of being a learning tool.

Let's start by trying to load a YouTube video using MediaPlayer. If that doesn't work, we'll use android-youtube-player to support YouTube links. Implementing other video types using ExoPlayer is a lower priority and can be done as a separate issue.