<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Streaming Archives - Truiton</title>
	<atom:link href="https://www.truiton.com/tag/streaming/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Technology Reaching Us In Time - Online</description>
	<lastBuildDate>Thu, 21 Nov 2019 12:37:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/www.truiton.com/wp-content/uploads/2022/11/cropped-truiton_new_logo_half_white.png?fit=32%2C32&#038;ssl=1</url>
	<title>Streaming Archives - Truiton</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">54534495</site>	<item>
		<title>How To Stream RTMP live in Android</title>
		<link>https://www.truiton.com/2015/03/stream-rtmp-live-android/</link>
					<comments>https://www.truiton.com/2015/03/stream-rtmp-live-android/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Tue, 31 Mar 2015 09:29:51 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[HLS]]></category>
		<category><![CDATA[m3u8]]></category>
		<category><![CDATA[mms]]></category>
		<category><![CDATA[RTMP]]></category>
		<category><![CDATA[RTSP]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[VLC]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=1006</guid>

					<description><![CDATA[<p>Streaming live video/audio in android is one of the very few interesting parts we have. Whenever we talk of streaming, the possibility of using&#160;RTMP(Real Time Messaging Protocol) cannot be ruled out. As RTMP is one of the most basic protocols available for streaming live video/audio feed. But unfortunately Android&#8217;s standard VideoView does not support the&#8230;&#160;<a href="https://www.truiton.com/2015/03/stream-rtmp-live-android/" rel="bookmark">Read More &#187;<span class="screen-reader-text">How To Stream RTMP live in Android</span></a></p>
<p>The post <a href="https://www.truiton.com/2015/03/stream-rtmp-live-android/">How To Stream RTMP live in Android</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="738" height="460" data-attachment-id="1007" data-permalink="https://www.truiton.com/2015/03/stream-rtmp-live-android/android-rtmp-player/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?fit=738%2C460&amp;ssl=1" data-orig-size="738,460" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android RTMP Player" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?fit=300%2C187&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?fit=738%2C460&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?resize=738%2C460" alt="Android RTMP Player" class="wp-image-1007" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?w=738&amp;ssl=1 738w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?resize=300%2C187&amp;ssl=1 300w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Player.png?resize=370%2C230&amp;ssl=1 370w" sizes="(max-width: 738px) 100vw, 738px" /></figure></div>



<p></p>



<p>Streaming live video/audio in android is one of the very few interesting parts we have. Whenever we talk of streaming, the possibility of using&nbsp;RTMP(<a title="RTMP" href="http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol" target="_blank" rel="noopener noreferrer">Real Time Messaging Protocol</a>) cannot be ruled out. As RTMP is one of the most basic protocols available for streaming live video/audio feed. But unfortunately Android&#8217;s standard <a title="Android VideoView" href="http://developer.android.com/reference/android/widget/VideoView.html" target="_blank" rel="noopener noreferrer">VideoView</a> does not support the playback of RTMP streams. Therefore to natively play a live RTMP stream on Android, an external library is required which can provide us an Android RTMP player. As of now I have discovered two libraries which can serve this purpose.</p>



<p>First being the&nbsp;Android <a title="Android Vitamio Library" href="https://www.vitamio.org/en/" target="_blank" rel="noopener noreferrer">Vitamio</a> library, and second being the&nbsp;<a href="https://wiki.videolan.org/LibVLC/" target="_blank" rel="noopener noreferrer">LibVLC SDK</a> for Android. In my opinion the later one is the better one. As this comes in a form of a plug-in solution from the open source organisation that built the worlds greatest video player ever, that right:- <a href="https://wiki.videolan.org/Main_Page/" target="_blank" rel="noopener noreferrer">VLC</a>. Therefore in this tutorial to build an example of Android RTMP player we will discuss how we can use the LibVLC SDK for Android. But before doing so lets, also have an overview of its counterpart, Vitamio library as well.</p>



<p></p>



<h2 class="wp-block-heading">Android Vitamio Library</h2>



<p>Vitamio is an open source project for Android and iOS built up on <a title="FFmpeg" href="https://www.ffmpeg.org/" target="_blank" rel="noopener noreferrer">FFmpeg</a> code. Vitamio provides us a clean and simple API with full and real hardware accelerated decoder and render-er. Vitamio is a very powerful library which supports a wide variety of video/audio formats like FLV, TS/TP, WMV, DivX, Xvid and many other standard formats. What makes it different is that it also supports the playback of embedded and external subtitles like&nbsp;.mkv and .srt. But Vitamio comes with a license, hence please go through this <a title="Vitamio License" href="https://www.vitamio.org/en/License/" target="_blank" rel="noopener noreferrer">license page</a> before using it in your project. In this Android RTMP example, we will not only discuss the live streaming of RTMP stream in Android, but will also discuss how we can stream m3u8 playlists(HLS), RTSP streams and MMS (Microsoft Media Stream). But through the usage of VLCs SDK for Android.</p>



<p></p>



<h2 class="wp-block-heading">Android VLC SDK</h2>



<p><a href="http://www.videolan.org/" target="_blank" rel="noopener noreferrer">VLC Media Player</a> has been the most popular video file playback software available till date. The interesting part about it is that, it supports all major video/audio playback formats. Therefore when compared with other SDKs or libraries like Vitamio for RTMP streaming, it is considered to be far more superior by default. This gives us an obvious answer why we should use this <a href="https://wiki.videolan.org/LibVLC/" target="_blank" rel="noopener noreferrer">LibVLC SDK</a> for Android. Coincidentally, it is not very difficult to use this SDK in an Android app. Once done, you can play all the playback formats it supports, be it HLS, RTMP, RTSP, or even subtitles. Full SDK docs are <a href="http://www.videolan.org/developers/vlc/doc/doxygen/html/" target="_blank" rel="noopener noreferrer">available here</a>. Therefore, without waiting lets integrate it in our app.</p>



<h3 class="wp-block-heading">How to embed VLC Media Player in your Android App?</h3>



<p>To use Android VLC Media Player SDK in your app, you may need to include the compiled code for vlc media player in your app. To do so, two ways are available:</p>



<p><strong>Option 1:</strong> Manually compile SDK and use it through NDK as .so file:</p>



<ul class="wp-block-list"><li><a href="https://wiki.videolan.org/AndroidCompile/" target="_blank" rel="noopener noreferrer">Android VLC SDK Compilation Steps</a></li></ul>



<p><strong>Option 2:</strong> Use a Gradle dependency, compiled as an opensource project <a href="https://github.com/mrmaffen/vlc-android-sdk" target="_blank" rel="noopener noreferrer">vlc-android-sdk</a>&nbsp;by <a href="https://github.com/mrmaffen" target="_blank" rel="noopener noreferrer">mrmaffen</a> (May not be the latest version always).</p>



<p>So for this <a href="http://www.truiton.com/2015/03/stream-rtmp-live-android/">Android RTMP Streaming Example</a>, I will be using this option. To do so, all you need to do is in your build.gradle (app) file, add a dependency as shown:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">dependencies {
    compile "de.mrmaffen:vlc-android-sdk:2.0.6"
}</pre>



<h3 class="wp-block-heading">Streaming RTMP Stream Live in Android</h3>



<p>Before heading directly to the implementation part, first lets understand RTMP a little. Real Time Messaging Protocol (RTMP) is a protocol owned by Adobe Systems. This protocol was developed to stream audio and video content to company&#8217;s&nbsp;proprietary flash player. But later on as it evolved, a part of it was released for public use. More of it can be read <a title="RTMP" href="http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol" target="_blank" rel="noopener noreferrer">here</a>. Mostly this type of protocol is used for IPTV and live VoD streaming, but it can be used in many other areas as well.</p>



<p>To play an RTMP stream in Android, a normal VideoView cannot be used, as it does not support the RTMP playback. But a WebView can be used to play the RTMP stream without any external library. This solves the problem but in my personal opinion web apps don&#8217;t give a nice look and feel to an app. Hence in this Android RTMP example we will be using an external SDK &#8211; VLC Media Player for streaming a live RTMP stream. After including it in the project, please add a SurfaceView in your layout file:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    &lt;SurfaceView
        android:id="@+id/surface"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"/>
&lt;/FrameLayout></pre>



<p>Further to run this Android RTMP player, please code your activity something like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.rtmpplayer;

import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup.LayoutParams;
import android.widget.Toast;

import org.videolan.libvlc.IVLCVout;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;

import java.lang.ref.WeakReference;
import java.util.ArrayList;


public class MainActivity extends AppCompatActivity implements IVLCVout.Callback {
    public final static String TAG = "MainActivity";
    private String mFilePath;
    private SurfaceView mSurface;
    private SurfaceHolder holder;
    private LibVLC libvlc;
    private MediaPlayer mMediaPlayer = null;
    private int mVideoWidth;
    private int mVideoHeight;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mFilePath = "rtmp://rrbalancer.broadcast.tneg.de:1935/pw/ruk/ruk";

        Log.d(TAG, "Playing: " + mFilePath);
        mSurface = (SurfaceView) findViewById(R.id.surface);
        holder = mSurface.getHolder();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setSize(mVideoWidth, mVideoHeight);
    }

    @Override
    protected void onResume() {
        super.onResume();
        createPlayer(mFilePath);
    }

    @Override
    protected void onPause() {
        super.onPause();
        releasePlayer();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        releasePlayer();
    }


    /**
     * Used to set size for SurfaceView
     *
     * @param width
     * @param height
     */
    private void setSize(int width, int height) {
        mVideoWidth = width;
        mVideoHeight = height;
        if (mVideoWidth * mVideoHeight &lt;= 1)
            return;

        if (holder == null || mSurface == null)
            return;

        int w = getWindow().getDecorView().getWidth();
        int h = getWindow().getDecorView().getHeight();
        boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
        if (w &gt; h &amp;&amp; isPortrait || w &lt; h &amp;&amp; !isPortrait) {
            int i = w;
            w = h;
            h = i;
        }

        float videoAR = (float) mVideoWidth / (float) mVideoHeight;
        float screenAR = (float) w / (float) h;

        if (screenAR &lt; videoAR)
            h = (int) (w / videoAR);
        else
            w = (int) (h * videoAR);

        holder.setFixedSize(mVideoWidth, mVideoHeight);
        LayoutParams lp = mSurface.getLayoutParams();
        lp.width = w;
        lp.height = h;
        mSurface.setLayoutParams(lp);
        mSurface.invalidate();
    }

    /**
     * Creates MediaPlayer and plays video
     *
     * @param media
     */
    private void createPlayer(String media) {
        releasePlayer();
        try {
            if (media.length() &gt; 0) {
                Toast toast = Toast.makeText(this, media, Toast.LENGTH_LONG);
                toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                        0);
                toast.show();
            }

            // Create LibVLC
            // TODO: make this more robust, and sync with audio demo
            ArrayList&lt;String&gt; options = new ArrayList&lt;String&gt;();
            //options.add("--subsdec-encoding &lt;encoding&gt;");
            options.add("--aout=opensles");
            options.add("--audio-time-stretch"); // time stretching
            options.add("-vvv"); // verbosity
            libvlc = new LibVLC(this, options);
            holder.setKeepScreenOn(true);

            // Creating media player
            mMediaPlayer = new MediaPlayer(libvlc);
            mMediaPlayer.setEventListener(mPlayerListener);

            // Seting up video output
            final IVLCVout vout = mMediaPlayer.getVLCVout();
            vout.setVideoView(mSurface);
            //vout.setSubtitlesView(mSurfaceSubtitles);
            vout.addCallback(this);
            vout.attachViews();

            Media m = new Media(libvlc, Uri.parse(media));
            mMediaPlayer.setMedia(m);
            mMediaPlayer.play();
        } catch (Exception e) {
            Toast.makeText(this, "Error in creating player!", Toast
                    .LENGTH_LONG).show();
        }
    }

    private void releasePlayer() {
        if (libvlc == null)
            return;
        mMediaPlayer.stop();
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.removeCallback(this);
        vout.detachViews();
        holder = null;
        libvlc.release();
        libvlc = null;

        mVideoWidth = 0;
        mVideoHeight = 0;
    }

    /**
     * Registering callbacks
     */
    private MediaPlayer.EventListener mPlayerListener = new MyPlayerListener(this);

    @Override
    public void onNewLayout(IVLCVout vout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
        if (width * height == 0)
            return;

        // store video size
        mVideoWidth = width;
        mVideoHeight = height;
        setSize(mVideoWidth, mVideoHeight);
    }

    @Override
    public void onSurfacesCreated(IVLCVout vout) {

    }

    @Override
    public void onSurfacesDestroyed(IVLCVout vout) {

    }

    @Override
    public void onHardwareAccelerationError(IVLCVout vlcVout) {
        Log.e(TAG, "Error with hardware acceleration");
        this.releasePlayer();
        Toast.makeText(this, "Error with hardware acceleration", Toast.LENGTH_LONG).show();
    }

    private static class MyPlayerListener implements MediaPlayer.EventListener {
        private WeakReference&lt;MainActivity&gt; mOwner;

        public MyPlayerListener(MainActivity owner) {
            mOwner = new WeakReference&lt;MainActivity&gt;(owner);
        }

        @Override
        public void onEvent(MediaPlayer.Event event) {
            MainActivity player = mOwner.get();

            switch (event.type) {
                case MediaPlayer.Event.EndReached:
                    Log.d(TAG, "MediaPlayerEndReached");
                    player.releasePlayer();
                    break;
                case MediaPlayer.Event.Playing:
                case MediaPlayer.Event.Paused:
                case MediaPlayer.Event.Stopped:
                default:
                    break;
            }
        }
    }
}
</pre>



<p>Although the above code is self explanatory, but please dont forget to change the RTMP path to play your stream. At times to stream an RTMP stream in Android, you may have to pass the headers along with the path. Luckily you may have seen above that LibVLC supports that too. Hence all types of RTMP streams can be used with Android VLC SDK. The above example would look something like this:</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="600" height="320" data-attachment-id="1013" data-permalink="https://www.truiton.com/2015/03/stream-rtmp-live-android/android-rtmp-stream-live/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?fit=600%2C320&amp;ssl=1" data-orig-size="600,320" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android RTMP Stream Live" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?fit=300%2C160&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?fit=600%2C320&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?resize=600%2C320" alt="Android RTMP Stream Live" class="wp-image-1013" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?w=600&amp;ssl=1 600w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-RTMP-Stream-Live.png?resize=300%2C160&amp;ssl=1 300w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>



<p>But before moving on to other parts, please don&#8217;t forget to add <code>configChanges</code> flag in your AndroidManifest for this Activity, as shown:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">        &lt;activity
            android:name=".MainActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/app_name">
            &lt;intent-filter>
                &lt;action android:name="android.intent.action.MAIN"/>
                &lt;category android:name="android.intent.category.LAUNCHER"/>
            &lt;/intent-filter>
        &lt;/activity></pre>



<p>Full source code is also available here:</p>



<p style="text-align:center"><a class="fasc-button fasc-size-large fasc-type-flat fasc-rounded-medium ico-fa fasc-ico-before fa-github" style="background-color: #0364af; color: #ffffff;" target="_blank" rel="noopener noreferrer" href="https://github.com/Truiton/RTMPPlayer">Full Source Code</a></p>



<h3 class="wp-block-heading">Android RTSP Streaming</h3>



<p>Real Time Streaming Protocol (RTSP) is used for streaming content from media servers. Like YouTube uses RTSP streams to distribute content. The easy part about RTSP streaming is that, it can be done through the standard VideoView of Android. To read more about it please refer to my <a title="Android VideoView Example With Youtube Playback" href="http://www.truiton.com/2013/08/android-videoview-example-with-youtube-playback/" target="_blank" rel="noopener noreferrer">VideoView Example</a>.</p>



<p>But if you are implementing a solution by using the embedded VLC Media Player Lib, you might prefer using the same for RTSP streaming as well. As a matter of fact Android VLC SDK supports all video/audio formats, hence it also supports the playback of RTSP stream. Therefore If you are building a media playback app, you may use the same code shown in the section above to playback an RTSP stream. All you need to do is replace the URL.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mFilePath = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";</pre>



<h3 class="wp-block-heading">Android m3u8 Streaming</h3>



<p>How to play m3u8 video in Android? is one of the most common questions among the Android developers. The easiest way to do HTTP Live Streaming (HLS) in Android is through the usage of standard VideoView. But as you might have guessed, there are some limitations to it. Through standard Android VideoView you can stream m3u8 streams but only on the devices having Android 3.0 and above. This is because the HTTP/HTTPS live streaming and HTTP/HTTPS progressive streaming protocols were introduced in Android 3.0 and full support with HTTPS was given in 3.1.</p>



<p>If you wish to do HTTP Live Streaming (HLS) and support Android m3u8 streaming, for earlier versions of android. You should consider using the Android LibVLC, as this library adds the support for playback of m3u8 lists along with many other formats on android API 9 and above. To do so the process is same- as shown in the sections above, just replace the URL with m3u8, HTTP Live Streaming URL:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mFilePath = "http://93.184.221.133/00573D/236/236-0.m3u8";</pre>



<p>Playing m3u8 stream on Android with VLC SDK would look something like this:</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="600" height="320" data-attachment-id="1014" data-permalink="https://www.truiton.com/2015/03/stream-rtmp-live-android/android-m3u8-streaming/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?fit=600%2C320&amp;ssl=1" data-orig-size="600,320" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android m3u8 Streaming" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?fit=300%2C160&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?fit=600%2C320&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?resize=600%2C320" alt="Android m3u8 Streaming" class="wp-image-1014" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?w=600&amp;ssl=1 600w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-m3u8-Streaming.png?resize=300%2C160&amp;ssl=1 300w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>



<p></p>



<h3 class="wp-block-heading">Android MMS Stream</h3>



<p>Another uncommon format for streaming in Android is MMS. Since the Android LibVLC is a powerful library which supports very complex video playback formats, it also supports the playback of Microsoft Media Server (MMS) stream. Hence one should use this SDK to stream MMS as well. MMS is a network streaming protocol, mostly used for webcasts and live radio. Using embedded VLC media player library for the playback of an MMS stream in Android is not that different from using other protocols. All you have to do just replace the path variable to point to an MMS url:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mFilePath = "mms://beotelmedia.beotel.net/studiob";</pre>



<p></p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>As we discussed above, I would like to conclude by saying that <a href="https://wiki.videolan.org/LibVLC/" target="_blank" rel="noopener noreferrer">LibVLC SDK</a> is a very powerful multi-platform library, for iOS and Android both. By using Vitamio library one can stream limited types of video formats and protocols like RTMP, RTSP, HTTP Live, and HTTP progressive streaming protocol. But by using the Android VLC SDK, you can stream all the major video/audio formats available till date. Another great playback feature that comes along with LibVLC is that it supports the playback of subtitles and multiple audio tracks as well. Hope this helped. Connect with us through our Facebook, Google+ and Twitter profiles for more updates.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2015/03/stream-rtmp-live-android/">How To Stream RTMP live in Android</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2015/03/stream-rtmp-live-android/feed/</wfw:commentRss>
			<slash:comments>30</slash:comments>
		
		<enclosure url="http://93.184.221.133/00573D/236/236-0.m3u8" length="240" type="application/vnd.apple.pages" />

		<post-id xmlns="com-wordpress:feed-additions:1">1006</post-id>	</item>
		<item>
		<title>Android YouTube API Example For Channels</title>
		<link>https://www.truiton.com/2015/03/android-youtube-api-example-channels/</link>
					<comments>https://www.truiton.com/2015/03/android-youtube-api-example-channels/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Sun, 15 Mar 2015 08:06:36 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Channel]]></category>
		<category><![CDATA[HD Video]]></category>
		<category><![CDATA[Player]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[Youtube]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=932</guid>

					<description><![CDATA[<p>A lot of people have been asking me how to integrate YouTube channels into an Android app. The answer is, by usage of YouTube data API and YouTube Android player API. Since as of now YouTube Android player does not provide any mechanism to access channels, we need to use the YouTube Data API with&#8230;&#160;<a href="https://www.truiton.com/2015/03/android-youtube-api-example-channels/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Android YouTube API Example For Channels</span></a></p>
<p>The post <a href="https://www.truiton.com/2015/03/android-youtube-api-example-channels/">Android YouTube API Example For Channels</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><a href="https://www.flickr.com/photos/banky177/4157325380" target="_blank" rel="noopener noreferrer"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="427" data-attachment-id="934" data-permalink="https://www.truiton.com/2015/03/android-youtube-api-example-channels/android-youtube-api-channel-featured/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?fit=640%2C427&amp;ssl=1" data-orig-size="640,427" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android YouTube API Channel &amp;#8211; Featured" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?fit=300%2C200&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?fit=640%2C427&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?resize=640%2C427" alt="Photo Credit: M Anima - YouTube Android API Channels" class="wp-image-934" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Featured.jpg?resize=300%2C200&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></figure></div>



<p></p>



<p>A lot of people have been asking me how to integrate YouTube channels into an Android app. The answer is, by usage of <a title="YouTube Data API" href="https://developers.google.com/youtube/v3/" target="_blank" rel="noopener noreferrer">YouTube data API</a> and <a title="Android YouTube Player API" href="https://developers.google.com/youtube/android/player/" target="_blank" rel="noopener noreferrer">YouTube Android player API</a>. Since as of now YouTube Android player does not provide any mechanism to access channels, we need to use the YouTube Data API with it to access the list of channels. Many of us don&#8217;t know that, YouTube only provides a player API for Android. As such there is no support for channels in that API. Although YouTube channels functionality is implemented in their official app. Which makes me think, if they can do it, we can do it too.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>But first lets understand what YouTube channels are?</p></blockquote>



<p>Speaking of channels, they are always associated with YouTube users. Actually they are same, users are custom generated URLs, which YouTube channel owners can generate through their account. Reason being channels have a long system generated ID attached to them, which becomes a little difficult for them to distribute. In this YouTube Android API channels tutorial, I would show how videos can be shown from both URLs.</p>



<p>As of now there are two ways through which we can show a YouTube channel in an Android App. But first you may need to add a library for YouTube Android Player API:</p>



<ol class="wp-block-list"><li>Download the latest library bundle from this <a title="Android YouTube Player API Download" href="https://developers.google.com/youtube/android/player/downloads/" target="_blank" rel="noopener noreferrer">download page</a>.</li><li>Unzip the downloaded file.</li><li>Navigate for libs folder in the unzipped folder.</li><li>Copy the YouTubeAndroidPlayerApi.jar file in your project&#8217;s libs folder.</li><li>Now navigate to this folder in Android Studio.</li><li>Right click on the YouTubeAndroidPlayerApi.jar file and select the &#8220;Add as library&#8221;.</li></ol>



<p>And you&#8217;re all set, to play YouTube channels in your Android app. Now lets have a look at the two methods through which YouTube Android player API can show channels:</p>



<h2 class="wp-block-heading">1) Android YouTube Intents</h2>



<p>YouTube player API gives us a list of methods through which we can open specific screens of the official YouTube Android app. These methods can be accessed through the <a title="Android YouTube API" href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents" target="_blank" rel="noopener noreferrer">YouTubeIntents</a> class in the API. Android YouTube Player API gives us a specific method&nbsp;<span class="lang:default decode:true  crayon-inline ">createUserIntent</span>&nbsp; through which we can open user screen, in the official YouTube app. Code sample:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Intent intent = YouTubeIntents.createUserIntent(this, "PitbullVEVO");
startActivity(intent);</pre>



<p>This can quickly solve your problem of opening YouTube users, without getting into the complexities of channel ID parsing.</p>



<p>Other than this Android YouTube player API provides many more static methods which can be used to send various intents to the YouTube app. Some of the basic types are :</p>



<ol class="wp-block-list"><li><span class="notranslate"><span class="sympad"><a href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents#createPlayVideoIntent%28android.content.Context,%20java.lang.String%29">createPlayVideoIntent</a></span>(Context context, String videoId)</span> &#8211; This is used for playing a video in YouTube app.</li><li><span class="notranslate"><span class="sympad"><a href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents#createPlayPlaylistIntent%28android.content.Context,%20java.lang.String%29">createPlayPlaylistIntent</a></span>(Context context, String playlistId)</span>&nbsp;&#8211; This is used for playing a playlist in YouTube app.</li><li><span class="notranslate"><span class="sympad"><a href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents#createUploadIntent%28android.content.Context,%20android.net.Uri%29">createUploadIntent</a></span>(Context context, Uri videoUri)</span> &#8211; This is used to open the upload video screen of YouTube Android app.</li></ol>



<p>Recently in January 2015, an update to Android YouTube API was released, which made some additions in YouTubeIntents class. Now through <span class="notranslate"><span class="sympad"><a href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents#canResolvePlayVideoIntentWithOptions%28android.content.Context%29">canResolvePlayVideoIntentWithOptions</a></span> method, we can check whether the installed YouTube app supports the fullscreen mode or not. For more details please refer to the <a title="Android YouTube API" href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents" target="_blank" rel="noopener noreferrer">YouTubeIntents</a> class.</span></p>



<h2 class="wp-block-heading">2)&nbsp;Android YouTube API Channels</h2>



<p>With the help of above mentioned approach you can view YouTube users/channels in official app. But if you want to display channels in your own app, then you might have to a little more coding.&nbsp;As you might have understood by now, channel is not an inbuilt functionality of YouTube. Its a way, through which users can organize their videos. In short a channel/user is nothing but a collection of YouTube playlists.</p>



<p>To show playlists in your app from a username, you might have to make two YouTube Data API calls and then play the chosen playlist through <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/" target="_blank" rel="noopener noreferrer">Android YouTube Player API</a>, integrated in your app.</p>



<p><strong>1) YouTube channel list</strong> &#8211; In Android to get a YouTube channel ID, we have to make a YouTube Data API call for <a title="YouTube Data API Channel List" href="https://developers.google.com/youtube/v3/docs/channels/list" target="_blank" rel="noopener noreferrer">channel list</a>. This API can list down all the channel IDs associated with specified username. To read more about this you can visit the YouTube Data API&nbsp;<a title="YouTube Data API Channel List" href="https://developers.google.com/youtube/v3/docs/channels/list" target="_blank" rel="noopener noreferrer">channel list</a> page, or you can simply use the URL below to get a username&#8217;s channelId.</p>



<p><code>https://www.googleapis.com/youtube/v3/channels?part=snippet&amp;forUsername={USERNAME}&amp;key={YOUR_API_KEY}</code></p>



<p><span style="text-decoration: underline;"><em>Please Note:</em></span> To access the API please generate an API key form <a title="Google API Console" href="https://code.google.com/apis/console" target="_blank" rel="noopener noreferrer">Google API Console</a>, for steps please refer to <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/" target="_blank" rel="noopener noreferrer">Android YouTube player example</a>.</p>



<p>This API call would return a JSON object, you may have to parse it and extract the channel id from it, for further usage. See the image below:</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="232" data-attachment-id="938" data-permalink="https://www.truiton.com/2015/03/android-youtube-api-example-channels/android-youtube-api-channel-list/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?fit=640%2C232&amp;ssl=1" data-orig-size="640,232" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android YouTube API Channel List" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?fit=300%2C109&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?fit=640%2C232&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?resize=640%2C232" alt="Android YouTube API Channel List" class="wp-image-938" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-List.png?resize=300%2C109&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></div>



<p><strong>2) Android YouTube Data API Playlists</strong> &#8211; Now that we have a channelId, we are one step closer for displaying YouTube channels in Android app. Next we need to get a list of playlists for our channel ID. To get a list of playlists associated with a channel, we need to make a <a title="YouTube Data API Channel Playlist List" href="https://developers.google.com/youtube/v3/docs/playlists/list" target="_blank" rel="noopener noreferrer">Playlists list API</a> call. To read more about it please refer to the page <a title="YouTube Data API Channel Playlist List" href="https://developers.google.com/youtube/v3/docs/playlists/list" target="_blank" rel="noopener noreferrer">YouTube Playlists List</a>, or you can use the URL below to make the call.</p>



<p><code>https://www.googleapis.com/youtube/v3/playlists?part=snippet&amp;channelId={YOUR_CHANNEL_ID}&amp;key={YOUR_API_KEY}</code></p>



<p><span style="text-decoration: underline;"><em>Please Note:</em></span> To access the API please generate an API key form <a title="Google API Console" href="https://code.google.com/apis/console" target="_blank" rel="noopener noreferrer">Google API Console</a>, for steps please refer to <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/" target="_blank" rel="noopener noreferrer">Android YouTube player example</a>.</p>



<p>For e.g. use the&nbsp;channelId (highlighted in point 1 above) in this URL. It would return a JSON object containing a list of playlists. Here each playlist would have an object of its own with an ID associated with it. You may have to parse it for further usage. Please see the image below:</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" loading="lazy" decoding="async" width="504" height="155" data-attachment-id="939" data-permalink="https://www.truiton.com/2015/03/android-youtube-api-example-channels/android-youtube-api-channel-playlist-list/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?fit=504%2C155&amp;ssl=1" data-orig-size="504,155" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Android YouTube API Channel Playlist List" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?fit=300%2C92&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?fit=504%2C155&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?resize=504%2C155" alt="Android YouTube API Channel Playlist List" class="wp-image-939" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?w=504&amp;ssl=1 504w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2015/03/Android-YouTube-API-Channel-Playlist-List.png?resize=300%2C92&amp;ssl=1 300w" sizes="auto, (max-width: 504px) 100vw, 504px" /></figure></div>



<p><strong>3) Android YouTube API Playlists</strong> &#8211; Luckily YouTube Player API for Android supports the playlists. But to play a playlist, first we need to implement a YouTube Player in our app. To learn more about how to implement a YouTube player in your app please have a look at this <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/" target="_blank" rel="noopener noreferrer">Android YouTube API example</a>. To run playlists in the specified example just replace the&nbsp;<span class="lang:default decode:true  crayon-inline ">cueVideo</span>&nbsp; method line with:</p>



<p style="text-align:left"><code>YPlayer.cuePlaylist("PLRX442jA-zGKxR-wAfC_xUvpZX1Rh0usm");</code></p>



<p>Here the specified id is playlist id from the point 2.</p>



<p></p>



<p>This concludes the Android YouTube API Example For Channel, although who knows in future, maybe a new way is introduced to show YouTube channels on Android. As the Android YouTube API is in a very nascent stage. Hope this tutorial helped you. Stay connected with us through Facebook, Twitter and Google+.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2015/03/android-youtube-api-example-channels/">Android YouTube API Example For Channels</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2015/03/android-youtube-api-example-channels/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">932</post-id>	</item>
		<item>
		<title>Android YouTube API Tutorial</title>
		<link>https://www.truiton.com/2013/08/android-youtube-api-tutorial/</link>
					<comments>https://www.truiton.com/2013/08/android-youtube-api-tutorial/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Sat, 10 Aug 2013 19:04:03 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[HD Video]]></category>
		<category><![CDATA[Player]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[Youtube]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=518</guid>

					<description><![CDATA[<p>Well well its official, on 10th May 2013 Google has finally released YouTube API for android. You might be wondering what difference does it make, earlier too we were able to play YouTube videos on Android. The difference in this API is the way we are accessing it. Earlier to play a YouTube video on&#8230;&#160;<a href="https://www.truiton.com/2013/08/android-youtube-api-tutorial/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Android YouTube API Tutorial</span></a></p>
<p>The post <a href="https://www.truiton.com/2013/08/android-youtube-api-tutorial/">Android YouTube API Tutorial</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="360" data-attachment-id="521" data-permalink="https://www.truiton.com/2013/08/android-youtube-api-tutorial/android-youtube-api-2/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?fit=640%2C360&amp;ssl=1" data-orig-size="640,360" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Android YouTube API  2" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?fit=300%2C168&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?fit=640%2C360&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?resize=640%2C360" alt="Android YouTube API" class="wp-image-521" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-2.jpg?resize=300%2C168&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></div>



<p></p>



<p>Well well its official, on 10th May 2013 Google has finally released YouTube API for android. You might be wondering what difference does it make, earlier too we were able to play YouTube videos on Android. The difference in this API is the way we are accessing it. Earlier to play a YouTube video on an Android device in an app we had to fire an Intent. Further with this Intent the android&#8217;s YouTube player App was launched and the video was played over there. But now with this new Android YouTube API we would be able to play HD YouTube videos in our Android app, i.e. without an intent. Also we would have full control over the playback.</p>



<p>Earlier I wrote a tutorial to play YouTube videos on android, in which the only limitation was, that we could not stream HD YouTube videos. Hence I had to write this <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/">Android YouTube API Tutorial</a>. With this new API we can we can seamlessly stream high quality YouTube videos and also maintain their state while screen is rotated i.e. resuming video from where it stopped. Although if you would like to give a read to my tutorials on streaming YouTube video on Android please have a look at the following links:</p>



<ol class="wp-block-list"><li><a title="Android VideoView Example With Youtube Playback" href="http://www.truiton.com/2013/08/android-videoview-example-with-youtube-playback/" target="_blank" rel="noopener noreferrer">Android VideoView Example</a></li><li><a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/">Android YouTube Player API Tutorial</a></li></ol>



<p>To start off with Android YouTube Player API there are certain steps that are needed to be performed. But first let me introduce you to the concept through which this player works. Android YouTube Player can be used in any app by importing a library in to that app&#8217;s project, but by doing this it does not mean that you have every thing. Android YouTube Player API works along with the device&#8217;s native YouTube Player. Means even after importing a library we would require an android device which has YouTube app installed (min ver 4.2.16). In reality this API library which we imported in to our app project, will communicate with a service of Android YouTube app which is bundled with the OS. To begin the tutorial lets follow these steps:</p>



<p></p>



<h2 class="wp-block-heading">Step 1 : Include a jar file in your project</h2>



<p>Download Android YouTube Player API bundle from <a title="Android YouTube Player API Download" href="https://developers.google.com/youtube/android/player/downloads/" target="_blank" rel="noopener noreferrer">here</a>. Unzip this file and follow the steps below to include it in your app:</p>



<ol class="wp-block-list"><li>Copy the jar file from libs folder to the the libs folder of your project.</li><li>Right click on your project, Build Path -&gt; Configure Build Path -&gt; Libraries Tab</li><li>Add Jars -&gt; Select Your project&#8217;s libs folder -&gt; Select YouTubeAndroidPlayerAPI.jar -&gt;Ok</li><li>Order and Export Tab -&gt; Check YouTubeAndroidPlayerAPI.jar &#8211; Ok</li></ol>



<p></p>



<h2 class="wp-block-heading">Step 2 : Create an API Key for Android YouTube Player</h2>



<p>To access the Android YouTube Player API on device we need to create an API key from <a title="Google API Developer Console" href="https://code.google.com/apis/console/" target="_blank" rel="noopener noreferrer">Google API developer console</a>. The steps to do so are:</p>



<ol class="wp-block-list"><li>Login to API console</li><li>Create a Project -> Goto Services -> Turn on the switch for Google YouTube Data API v3</li><li>Goto API Access -> Create new Android Key-> In popup enter one SHA1 certificate fingerprint and package name (separated by a semicolon) per line.</li><li>To get SH1 certificate of your app open command prompt, navigate to your Java bin folder and enter this command:</li><li> <pre class="lang:default decode:true"><code>keytool.exe -V -list -alias androiddebugkey -keystore "C:\Users\Truiton\.android\debug.keystore" -storepass android -keypass android</code></pre> </li><li>In the above command just replace the keystore user path with your system&#8217;s user path, and this should work.</li><li>From here copy Sh1 certificate and also copy package name of your spp from eclipse.</li><li>Now enter these values in the API Console popup in the desired format, you key will be generated.</li></ol>



<p></p>



<h2 class="wp-block-heading">Step 3 : Write code for Android YouTube Player API</h2>



<p>Now that we have all the prerequisites in place lets start with the app manifest first:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.truiton.youtubeapi"
    android:versionCode="1"
    android:versionName="1.0" >

    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    &lt;uses-permission android:name="android.permission.INTERNET" />

    &lt;application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        &lt;activity
            android:name="com.truiton.youtubeapi.TruitonYouTubeAPIActivity"
            android:label="@string/app_name" >
            &lt;intent-filter>
                &lt;action android:name="android.intent.action.MAIN" />

                &lt;category android:name="android.intent.category.LAUNCHER" />
            &lt;/intent-filter>
        &lt;/activity>
    &lt;/application>

&lt;/manifest></pre>



<p>Lets define the layout which we are going to use for Android YouTube API:</p>



<pre class="wp-block-preformatted lang:xhtml decode:true">&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".TruitonYouTubeAPIActivity" &gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" /&gt;

    &lt;com.google.android.youtube.player.YouTubePlayerView
        android:id="@+id/youtube_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" /&gt;

&lt;/RelativeLayout&gt;</pre>



<p>Have a look at the above layout, here the <em><code>com.google.android.youtube.player.YouTubePlayerView</code></em> is being used to display the YouTube Video. Next lets have a look at the code through which Android YouTube Player API can be used:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.youtubeapi;

import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.google.android.youtube.player.YouTubePlayer.Provider;

import android.os.Bundle;
import android.content.Intent;
import android.view.Menu;
import android.widget.Toast;

public class TruitonYouTubeAPIActivity extends YouTubeBaseActivity implements
		YouTubePlayer.OnInitializedListener {

	private YouTubePlayer YPlayer;
	private static final String YoutubeDeveloperKey = "AIzaSyDhEeq_FYAdCzMMSigmMcRwF_nQEhUXS-0";
	private static final int RECOVERY_DIALOG_REQUEST = 1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_you_tube_api);

		YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
		youTubeView.initialize(YoutubeDeveloperKey, this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.you_tube_api, menu);
		return true;
	}

	@Override
	public void onInitializationFailure(YouTubePlayer.Provider provider,
			YouTubeInitializationResult errorReason) {
		if (errorReason.isUserRecoverableError()) {
			errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
		} else {
			String errorMessage = String.format(
					"There was an error initializing the YouTubePlayer",
					errorReason.toString());
			Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
		}
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == RECOVERY_DIALOG_REQUEST) {
			// Retry initialization if user performed a recovery action
			getYouTubePlayerProvider().initialize(YoutubeDeveloperKey, this);
		}
	}

	protected YouTubePlayer.Provider getYouTubePlayerProvider() {
		return (YouTubePlayerView) findViewById(R.id.youtube_view);
	}

	@Override
	public void onInitializationSuccess(Provider provider,
			YouTubePlayer player, boolean wasRestored) {
		YPlayer = player;
		/*
		 * Now that this variable YPlayer is global you can access it
		 * throughout the activity, and perform all the player actions like
		 * play, pause and seeking to a position by code.
		 */
		if (!wasRestored) {
			YPlayer.cueVideo("2zNSgSzhBfM");
		}
	}

}
</pre>



<p>To make the above Android YouTube API example work you need to specify your developer key. In above example first onCreate method is called, in this method YouTubePlayerView is initialized by <em>YouTubePlayerView.initialize()</em> method. Further if the initialization is successful, <em>onInitializationSuccess()</em> method is called. In this method one can specify the video that needs to be played. Also if you notice I have declared the <em>player</em> variable as a global variable by the name of <em>YPlayer</em>. With the help of this variable we would be able to access the Android YouTube Player API throughout the Activity, and perform play, pause, seek and various other functions.</p>



<ul data-carousel-extra='{&quot;blog_id&quot;:1,&quot;permalink&quot;:&quot;https://www.truiton.com/2013/08/android-youtube-api-tutorial/&quot;}'  class="wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><a href="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="360" data-attachment-id="520" data-permalink="https://www.truiton.com/2013/08/android-youtube-api-tutorial/android-youtube-api/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?fit=640%2C360&amp;ssl=1" data-orig-size="640,360" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Android YouTube API" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?fit=300%2C168&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?fit=640%2C360&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?resize=640%2C360&#038;ssl=1" alt="Android YouTube API" data-id="520" class="wp-image-520" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API.jpg?resize=300%2C168&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></figure></li><li class="blocks-gallery-item"><figure><a href="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="360" data-attachment-id="522" data-permalink="https://www.truiton.com/2013/08/android-youtube-api-tutorial/android-youtube-api-3/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?fit=640%2C360&amp;ssl=1" data-orig-size="640,360" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Android YouTube API 3" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?fit=300%2C168&amp;ssl=1" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?fit=640%2C360&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?resize=640%2C360&#038;ssl=1" alt="Android YouTube API" data-id="522" class="wp-image-522" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/08/Android-YouTube-API-3.jpg?resize=300%2C168&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></figure></li></ul>



<p></p>



<p>After performing all the above steps, your app would look something like the screenshots above. An interesting feature of using this Android YouTube Player API, is that we don&#8217;t have to do any sort of programming to make the video run in full screen mode. Also no effort is required to stream HD YouTube videos. Another interesting feature is that while playback if the screen is rotated, the video playback starts exactly from where it stopped,&nbsp;ain&#8217;t that great as no amount of coding is to be done for this feature too. Hope this <a title="Android YouTube API Tutorial" href="http://www.truiton.com/2013/08/android-youtube-api-tutorial/">Android YouTube API Tutorial</a> helped you in some way. If it did or you simply liked it, please like and share it with your friends on Google+ and Facebook.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2013/08/android-youtube-api-tutorial/">Android YouTube API Tutorial</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2013/08/android-youtube-api-tutorial/feed/</wfw:commentRss>
			<slash:comments>34</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">518</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.truiton.com @ 2026-04-22 19:19:03 by W3 Total Cache
-->