<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Farman on Medium]]></title>
        <description><![CDATA[Stories by Farman on Medium]]></description>
        <link>https://medium.com/@khanfarman27?source=rss-275e86501fc7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IM_VAVuf4R4mgy1cMATp0A.jpeg</url>
            <title>Stories by Farman on Medium</title>
            <link>https://medium.com/@khanfarman27?source=rss-275e86501fc7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:47:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khanfarman27/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Python Wrapper For Web API]]></title>
            <link>https://khanfarman27.medium.com/python-wrapper-for-web-api-99fcec1c8040?source=rss-275e86501fc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/99fcec1c8040</guid>
            <category><![CDATA[wikipedia]]></category>
            <category><![CDATA[python-web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[webapi]]></category>
            <category><![CDATA[tweet]]></category>
            <dc:creator><![CDATA[Farman]]></dc:creator>
            <pubDate>Sun, 04 Apr 2021 06:55:26 GMT</pubDate>
            <atom:updated>2021-04-04T06:55:26.174Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many websites providing API (Application Programming Interface) to explore and use website data. Some companies release API wrappers, while others just publish an API and independent developer group will wrap their API in common programming language (e.g. 🐍 Python), which can be used by large community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aYUmp5lyJt1v8dsC" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>An organisation creates a public-facing API with the intent that others can use. APIs may be well documented by the company if not, there could be API wrappers created by smart developers for us 🙂. So, a startup or creative developer community can build something better for users, third parties clients (mobile or web apps) with improved UI.</p><p>Although, there are many Python API wrappers but in this article, we will see few of them like <a href="https://docs.tweepy.org/en/latest/getting_started.html">Tweepy</a>, <a href="https://pypi.org/project/wikipedia/">Wikipedia</a>, <a href="https://pypi.org/project/google-api-python-client/">Google API Python Client</a></p><p><a href="https://docs.tweepy.org/en/latest/getting_started.html"><strong>TWEEPY</strong></a><strong> : </strong>Tweepy is a python API wrapper for Twitter API. We can use Tweepy and explore <a href="https://developer.twitter.com/en/docs">Twitter API</a> easily, which can be helpful in creating <a href="https://beebom.com/best-twitter-apps-ios-android/">third party clients</a> for twitter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_ZUEU38AUc3PfWk-" /><figcaption>Photo by <a href="https://unsplash.com/@ravinepz?utm_source=medium&amp;utm_medium=referral">Ravi Sharma</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Example:</strong></p><ol><li><em>Install the Tweepy using pip (</em><strong>pip install tweepy</strong>)</li><li><em>Import tweepy and set up your keys and secrets</em></li><li>Create authentication handler and set access tokens</li><li>Create Twitter API object and fetch tweets via the <strong><em>user_timeline</em></strong> method</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%2FLnZbfpFVOirctnVZtDoL%3F&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2FLnZbfpFVOirctnVZtDoL&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/70802e1aef6f93bc425fe8a6bd8e420e/href">https://medium.com/media/70802e1aef6f93bc425fe8a6bd8e420e/href</a></iframe><p>Actually you can do almost all actions for our tweets which we can do in a browser on Twitter. Please check out more on their API doc.</p><p><a href="https://en.wikipedia.org/wiki/Wikipedia:About"><strong>WIKIPEDIA</strong></a> : As we know <a href="https://en.wikipedia.org/wiki/Wikipedia">Wikipedia</a> is an online free-content encyclopedia project helping to create a world in which everyone can freely share in the sum of all knowledge. It is constantly updated and has millions of articles. Wikipedia also has a simple API that’s been wrapped for Python in the <a href="https://pypi.org/project/wikipedia/"><strong>wikipedia</strong></a> package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HvjpcwmtA1Xu7xLh" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Example:</strong></p><ol><li><em>Install the </em>wikipedia<em> package using pip (</em><strong>pip install wikipedia</strong>)</li><li><em>Import </em>wikipedia<em> and search or view summary of a page.</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fHR3aAzHxYbRAjUGfjO-ug.png" /></figure><p>If we just search for the word “Python” on Wikipedia, it is going to return a list of items containing word “Python”. So we need to be more specific. In next line, we are trying to get summary of the “Python (programming language)” item, and it prints few summary items as well.</p><p>Let’s see more info using <strong><em>page</em></strong> method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rexp2t-SG5BRz8R5jmmhvQ.png" /></figure><p>Now, we can access and parse data from Wikipedia. And we can do many operations like <strong><em>search Wikipedia, get article summaries, get data like links and images from a page, and more</em></strong>.</p><p>This article was only about to highlight Python API wrappers available for many websites and few <strong>simple</strong> examples . Hope this will encourage us to explore more available Python API wrappers libraries. We can create our own client apps for these popular websites. It would be fun to add some kind of user interface to these client apps.</p><p>Please refer below link to have a quick look of Python API wrappers:</p><p><a href="https://github.com/realpython/list-of-python-api-wrappers">https://github.com/realpython/list-of-python-api-wrappers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99fcec1c8040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adaptive Video Streaming in Android]]></title>
            <link>https://khanfarman27.medium.com/adaptive-video-streaming-in-android-1be47cf93ef6?source=rss-275e86501fc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/1be47cf93ef6</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[exoplayer]]></category>
            <category><![CDATA[adaptive-streaming]]></category>
            <dc:creator><![CDATA[Farman]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 15:26:47 GMT</pubDate>
            <atom:updated>2021-02-07T15:26:47.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*LR3kd200QCvZm8_S" /></figure><p>First, let’s understand what is Progressive Streaming?</p><p><strong>Progressive<em> Video Streaming</em></strong>: A single video file is streamed over internet and served to user. This type of video file is often <strong><em>.mp4</em></strong>, but it can be other formats as well. Here the same video file is served to different devices (likes Mobile, Desktop), hence the video quality can vary on devices having different screen size. And again the same file can take different buffering time for different internet bandwidth available on the devices.</p><p>Adaptive Video Streaming solves these two problems:</p><p><em>(</em><strong><em>a</em></strong><em>)</em><strong><em> </em></strong><em>Video quality issue on different devices,</em></p><p><em>(</em><strong><em>b</em></strong><em>) Buffering time issue on varying internet connection.</em></p><p><strong><em>Adaptive Video Streaming</em>: </strong>Adaptive video file contains set of segments of a video. Each segment is often 4 seconds long (can be longer as well). And each segment contains a video chunk of different quality, so video player can switch to a video chunk (segment) if necessary. Hence the same adaptive video file will be steamed with good quality irrespective of screen size of the device and user will not see buffering even when internet quality is low, video is adapted accordingly.</p><h4><strong>Adaptive Video Streaming Using ExoPlayer</strong></h4><p>Let’s jump to our main topic here. Google provides <strong>ExoPlayer</strong>, an application level media player, alternative to Android MediaPlayer API. ExoPlayer is easy to customise and extend. It supports many features which are not supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*RgZWgux9cduVOq0_" /></figure><p>We can follow below steps to setup basic ExoPlayer in our app and start streaming video in the app.</p><p><strong>Step-1</strong>: Make sure you have the Google and JCenter repositories included in the build.gradle file in the root of your project.</p><pre>repositories {<br>    google()<br>    jcenter()<br>}</pre><p><strong>Step-2: </strong>Add ExoPlayer modules in the build.gradle file of your app module.</p><pre>implementation &#39;com.google.android.exoplayer:exoplayer:2.13.0&#39;</pre><p>The above line adds the full library. alternatively, we can add only library modules what we need. Let’s add dependencies on the Core, DASH and UI library modules as of now.</p><pre>implementation &#39;com.google.android.exoplayer:exoplayer-core:2.13.0&#39;<br>implementation &#39;com.google.android.exoplayer:exoplayer-ui:2.13.0&#39;<br>implementation &#39;com.google.android.exoplayer:exoplayer-dash:2.13.0&#39;<br>implementation &#39;com.google.android.exoplayer:exoplayer-hls:2.13.0&#39;</pre><ul><li>exoplayer-core: Core functionality (required).</li><li>exoplayer-dash: Support for DASH content.</li><li>exoplayer-hls: Support for HLS content.</li><li>exoplayer-ui: UI components and resources for use with ExoPlayer.</li></ul><p>Here we are adding two Adaptive streaming support- 1) Dash and 2) HLS.</p><p><strong>Step-3: </strong>Make sure Java 8 support is enabled in build.gradle</p><pre>compileOptions {<br>  targetCompatibility JavaVersion.VERSION_1_8<br>}</pre><p><strong>Step-4: </strong>Adding PlayerView in your layout file</p><pre>&lt;com.google.android.exoplayer2.ui.PlayerView<br>    android:id=&quot;@+id/player_view&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;400dp&quot;/&gt;</pre><p><strong>Step-5: </strong>Reference the PlayerView in your activity, declared in layout file</p><pre>private lateinit var <em>playerView</em>: PlayerView<br><br>class MainActivity : AppCompatActivity() {<br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        setContentView(R.layout.<em>activity_main</em>)<br>       <br>        <em>playerView </em>= findViewById(R.id.<em>player_view</em>)<br>    }<br>}<br></pre><p><strong>Step-6: </strong>Initialise the Player</p><pre>private fun initPlayer(context: Context) {<br>    player = SimpleExoPlayer.Builder(context)<br>        .setBandwidthMeter(DefaultBandwidthMeter.Builder(context).build())<br>        .setTrackSelector(DefaultTrackSelector(context,   AdaptiveTrackSelection.Factory()))<br>        .build()<br>}</pre><p><strong>Step-7: </strong>Prepare MediaSource for the player</p><pre>private fun getMediaSource(uri: Uri): MediaSource {<br>    val lastPathSegment = uri.getLastPathSegment() ?: &quot;&quot;<br>    val httpDataSource = DefaultHttpDataSourceFactory(Constants.USER_AGENT,<br>        DefaultHttpDataSource.<em>DEFAULT_CONNECT_TIMEOUT_MILLIS</em>,<br>        DefaultHttpDataSource.<em>DEFAULT_READ_TIMEOUT_MILLIS</em>, true)<br>    val mediaItem = MediaItem.Builder().setUri(uri).build()<br><br>    if (lastPathSegment.<em>contains</em>(Constants.MEDIA_TYPE_MP3) || lastPathSegment.<em>contains</em>(Constants.MEDIA_TYPE_MP4)) {<br>        return ProgressiveMediaSource.Factory(httpDataSource).createMediaSource(mediaItem)<br>    } else if (lastPathSegment.<em>contains</em>(Constants.MEDIA_TYPE_HLS)) {<br>        return HlsMediaSource.Factory(httpDataSource).createMediaSource(mediaItem)<br>    } else {<br>        val dashChunkSourceFactory = DefaultDashChunkSource.Factory(httpDataSource)<br>        val manifestDataSourceFactory = httpDataSource<br>        return DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)<br>            .createMediaSource(mediaItem)<br>    }<br>}</pre><p><strong>Step-8: </strong>Prepare Player to play the video after setting media source.</p><pre>private fun preparePlayer(uri: Uri) {<br>    player.setMediaSource(getMediaSource(uri))<br>    player.prepare()<br>    player.<em>playWhenReady </em>= true<br>}</pre><p>Here we are are done with initial setup of ExoPlayer. And it should play the video url passed to preparePlayer() method above.</p><p>Let’s cover more in the next part where we will see states of player and handling Track Selection of Adaptive video stream.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1be47cf93ef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Augmented Reality with ARCore SDK Android]]></title>
            <link>https://khanfarman27.medium.com/augmented-reality-with-arcore-sdk-android-2dcc2a23a8ea?source=rss-275e86501fc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dcc2a23a8ea</guid>
            <category><![CDATA[arcore]]></category>
            <category><![CDATA[ar-app-development]]></category>
            <category><![CDATA[ar-and-vr]]></category>
            <category><![CDATA[android-ar]]></category>
            <category><![CDATA[augmented-reality]]></category>
            <dc:creator><![CDATA[Farman]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 19:43:28 GMT</pubDate>
            <atom:updated>2021-01-27T09:57:25.657Z</atom:updated>
            <content:encoded><![CDATA[<p>The blend of virtual and real world has brought our imagination to reality. As Virtual reality generates realistic images, sounds, and other sensations that put spectacular imaginary world around you, on the other hand, Augmented Reality adds virtual stuff to your real world environment.</p><p><strong>Virtual Reality: </strong>VR is fully immersive, which drags your senses into a virtual world apart from the real one. It is a computer-generated world of imagery and sounds in which you can manipulate objects and move around using haptic controllers while tethered to a console or PC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nPYXMb_Rd1BJPYbs" /><figcaption>Photo by <a href="https://unsplash.com/@thepaintedsquare?utm_source=medium&amp;utm_medium=referral">Jessica Lewis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Augmented Reality: </strong>AR overlays digital information on real-world elements. Augmented reality keeps the real world central but enhances it with other digital details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tYFhjxm1nKOu0iv3" /><figcaption>Photo by <a href="https://unsplash.com/@uniboa?utm_source=medium&amp;utm_medium=referral">UNIBOA</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>NOTE</strong>: We have also <strong>Mixed Reality (MR)</strong> and <strong>Extended Reality (XR). </strong>MR combines both VR and AR, whereas XR includes VR, AR and MR technologies that enhance our senses and may give totally unreal, simulated worlds for us to experience.</p><p><strong>Augmented Reality in Android Application:</strong></p><p>Google provides ARCore SDK for building augmented reality experiences. ARCore is leveraged with many apis which enables mobile to receive and interact with the information of surrounding world. AR experience is achieved using mainly three key capabilities of ARCore, to blend virtual content with the real world.</p><ul><li><strong>Motion tracking</strong> allows the phone to understand and track its position relative to the world.</li><li><strong>Environmental understanding</strong> allows the phone to detect the size and location of all type of surfaces.</li><li><strong>Light estimation</strong> allows the phone to estimate the environment’s current lighting conditions.</li></ul><p>ARCore’s understanding of the real world lets you place objects, annotations, or other information in a way that integrates seamlessly with the real world.</p><p>This will be very basic Augmented Reality experience using ARCore SDK in android App, so let’s create new android project with Empty Activity and Kotlin as language (choose as Java if you prefer) in Android Studio.</p><ul><li>Modify build.gradle to include following entries of ARcore and sceneform SDK.</li></ul><pre>plugins {<br>     ...</pre><pre>    id &#39;com.google.ar.sceneform.plugin&#39;<br><strong>}<br><br></strong>android <strong>{<br>     ...</strong></pre><pre><strong>    </strong>compileOptions <strong>{<br>        </strong>sourceCompatibility JavaVersion.<em>VERSION_1_8<br>        </em>targetCompatibility JavaVersion.<em>VERSION_1_8<br>    </em><strong>}<br>    </strong>kotlinOptions <strong>{<br>        </strong>jvmTarget = &#39;1.8&#39;<br>    <strong>}<br>}</strong></pre><pre>dependencies <strong>{<br>     </strong>...</pre><pre>implementation &#39;com.google.ar:core:1.22.0&#39;<br>implementation &#39;com.google.ar.sceneform.ux:sceneform-ux:1.17.1&#39;<br>implementation &#39;com.google.ar.sceneform:core:1.17.1&#39;<br>implementation &quot;com.google.ar.sceneform:animation:1.17.1&quot;</pre><pre>}</pre><ul><li>Add classpath for sceneform in project level build.gradle file</li></ul><pre>dependencies <strong>{<br>     ...</strong></pre><pre><em>    </em>classpath &#39;com.google.ar.sceneform:plugin:1.17.1&#39;<br><strong>}</strong></pre><ul><li>Modify your AndroidManifest.xml to include the following entries for Camera, OpenGL ES and google play service for AR.</li></ul><pre>&lt;uses-permission <em>android:name=&quot;android.permission.CAMERA</em>&quot; /&gt;</pre><pre>&lt;uses-feature <em>android:name=&quot;android.hardware.camera.ar</em>&quot; /&gt;</pre><pre>&lt;uses-feature android:glEsVersion=&quot;0x00030000&quot;  <br>              android:required=&quot;true&quot;/&gt;</pre><pre>&lt;application ... &gt;<br>      ...</pre><pre>    &lt;meta-data <em>android:name=&quot;com.google.ar.core</em>&quot;<br>               <em>android:value=&quot;required</em>&quot;/&gt;<br>&lt;/application&gt;</pre><ul><li>Adding AR fragment in layout activity_main.xml</li></ul><pre><em>&lt;?</em>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;<em>?&gt;<br></em>&lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;<br>    tools:context=&quot;.MainActivity&quot;&gt;   <br>   <br>    &lt;fragment<br>        android:name=&quot;com.google.ar.sceneform.ux.ArFragment&quot;<br>        android:id=&quot;@+id/fragment&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot; /&gt;</pre><pre>&lt;/FrameLayout&gt;</pre><p>And no changes for MainActivity now and we are good to go.</p><pre>class MainActivity : AppCompatActivity() {</pre><pre> override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        setContentView(R.layout.<em>activity_main</em>)<br>    }</pre><pre>}</pre><p>After running the application on the device, It will launch the camera with a hand overlay (if all setup is good🙂).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dcc2a23a8ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>