Integrating youtube to fragment

First extend your Activity as normal class YourActivity extends Activity… in Layout file put the below lines <fragment android:name=”com.google.android.youtube.player.YouTubePlayerSupportFragment” android:id=”@+id/youtube_fragment” android:layout_width=”match_parent” android:layout_height=”wrap_content”/> Then in your Activity you can create its instance using below line in your onCreareView method of your Fragment. YouTubePlayerSupportFragment youTubePlayerFragment = (YouTubePlayerSupportFragment) getActivity().getSupportFragmentManager() .findFragmentById(R.id.youtube_fragment); or you can declare a FrameLayout in your … Read more

YouTube URL in Video Tag

MediaElement YouTube API example Wraps the YouTube API in an HTML5 Media API wrapper, so that it can be programmed against as if it was true HTML5 <video>. <script src=”jquery.js”></script> <script src=”mediaelement-and-player.min.js”></script> <link rel=”stylesheet” href=”mediaelementplayer.css” /> <video width=”640″ height=”360″ id=”player1″ preload=”none”> <source type=”video/youtube” src=”http://www.youtube.com/watch?v=nOEw9iiopwI” /> </video> <script> var player = new MediaElementPlayer(‘#player1’); </script>

start/play embedded (iframe) youtube-video on click of an image

The quick and dirty way is to simply swap out the iframe with one that has autoplay=1 set using jQuery. THE HTML Placeholder: <div id=”videoContainer”> <iframe width=”450″ height=”283″ src=”https://www.youtube.com/embed/VIDEO_ID_HERE?wmode=transparent” frameborder=”0″ allowfullscreen wmode=”Opaque”></iframe> </div> Autoplay link: <a class=”introVid” href=”#video”>Watch the video</a></p> THE JQUERY The onClick catcher that calls the function jQuery(‘a.introVid’).click(function(){ autoPlayVideo(‘VIDEO_ID_HERE’,’450′,’283′); }); The function /*——————————– … Read more

Google API to get impressions of youtube videos?

As always YouTube APIs doesn’t provide access to a basic feature but here is a workaround: The following answer is similar to the one I wrote about retrieving Unique viewers from the Audience tab. Go on your Video analytics interface in YouTube Studio. Open the Web Developer Tools Network tab of your web-browser (by using … Read more

how to map youtube handles to channel IDs

One more time YouTube Data API v3 doesn’t provide a basic feature. I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?handle=@HANDLE you will get the YouTube channel id you are looking for in item[“id”]. For instance with the YouTube channel handle @WHO, you would get: { “kind”: “youtube#channelListResponse”, “etag”: … Read more