<?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 Mayur Solanki on Medium]]></title>
        <description><![CDATA[Stories by Mayur Solanki on Medium]]></description>
        <link>https://medium.com/@mayur-solanki?source=rss-524c98b964b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hftPSfNfn7o_qH-ufoDssg.png</url>
            <title>Stories by Mayur Solanki on Medium</title>
            <link>https://medium.com/@mayur-solanki?source=rss-524c98b964b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mayur-solanki/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[Magento Integration Using OAuth-based Authentication: Part 2]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-2-6f9c85b63fe9?source=rss-524c98b964b2------2"><img src="https://cdn-images-1.medium.com/max/2600/1*elJPll7TJxU4oIudWG9dZA.png" width="2880"></a></p><p class="medium-feed-snippet">Magento Integration is the process/steps by which third-party systems/Services can take access to the Magento resources using Magento API.</p><p class="medium-feed-link"><a href="https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-2-6f9c85b63fe9?source=rss-524c98b964b2------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-2-6f9c85b63fe9?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f9c85b63fe9</guid>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[magento-integration]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 12:59:07 GMT</pubDate>
            <atom:updated>2024-09-05T13:41:16.426Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Magento Integration Using OAuth-based Authentication: Part 1]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-1-4e7bdc8d7b3c?source=rss-524c98b964b2------2"><img src="https://cdn-images-1.medium.com/max/1504/1*-6Jp0yTBUoWoMfdZUnXjTQ.png" width="1504"></a></p><p class="medium-feed-snippet">Magento Integration is the process/steps by which third-party systems/Services can take access to the Magento resources using Magento API</p><p class="medium-feed-link"><a href="https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-1-4e7bdc8d7b3c?source=rss-524c98b964b2------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://mayur-solanki.medium.com/magento-oauth-based-authentication-create-an-integration-part-1-4e7bdc8d7b3c?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7bdc8d7b3c</guid>
            <category><![CDATA[magento-integration]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 12:59:01 GMT</pubDate>
            <atom:updated>2024-09-05T13:40:40.344Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Mastering Communication in NestJS Microservices: Monorepo, API Gateway & Client App(BFF) — Part 2]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-2-30b03c82ab85?source=rss-524c98b964b2------2"><img src="https://cdn-images-1.medium.com/max/1130/1*auR-30YBeCgT2_mwnoaBng.png" width="1130"></a></p><p class="medium-feed-snippet">Sample NestJS Microservices to showcase Point-to-Point Communication using Message Patterns and Event-Based Communication using Redis&#x2026;</p><p class="medium-feed-link"><a href="https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-2-30b03c82ab85?source=rss-524c98b964b2------2">Continue reading on DevOps.dev »</a></p></div>]]></description>
            <link>https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-2-30b03c82ab85?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/30b03c82ab85</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[protobuffer]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Wed, 14 Aug 2024 12:45:41 GMT</pubDate>
            <atom:updated>2024-09-01T06:17:39.043Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Mastering Communication in NestJS Microservices: Monorepo, API Gateway & Client App (BFF) — Part 1]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-1-dc5a00250293?source=rss-524c98b964b2------2"><img src="https://cdn-images-1.medium.com/max/1400/0*IPmW3AnupAFmFM_-.png" width="1400"></a></p><p class="medium-feed-snippet">Sample NestJS Microservices to showcase Point-to-Point Communication using Message Patterns and Event-Based Communication using Redis&#x2026;</p><p class="medium-feed-link"><a href="https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-1-dc5a00250293?source=rss-524c98b964b2------2">Continue reading on DevOps.dev »</a></p></div>]]></description>
            <link>https://blog.devops.dev/mastering-communication-in-nestjs-microservices-monorepo-api-gateway-client-app-bff-part-1-dc5a00250293?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc5a00250293</guid>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 10:11:54 GMT</pubDate>
            <atom:updated>2024-09-09T10:31:47.466Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[runBlocking vs CoroutineScope]]></title>
            <link>https://mayur-solanki.medium.com/runblocking-vs-coroutinescope-c7504ad2e501?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7504ad2e501</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[coroutinescope]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Sun, 14 Mar 2021 09:19:12 GMT</pubDate>
            <atom:updated>2023-12-11T12:12:19.581Z</atom:updated>
            <content:encoded><![CDATA[<p>Threading is most required thing in android application development. As in android application development process, developer needs to free UI thread as quick as possible to prevent UI freezing.</p><p>After launching coroutine in kotlin, all developers start using coroutine with appropriate use of Dispatcher. In simple way we can say that coroutine is the launching of virtual thread apart from the main thread i.e UI thread. All the virtual threads are defined with specific usage using Dispatchers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*XvH6iHmnZ7ze-JX853k-Aw.jpeg" /></figure><p>runBlocking is also a one type of coroutine (virtual thread) which can be called from suspend function or coroutine scope. Lets understand How it is different from the coroutine. will understand this using code.</p><pre>class PracticeRunBlocking : AppCompatActivity() {<br><br>    var job :Job?  = null<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        setContentView(R.layout.activity_practice_runblocking)<br><br>        job =   CoroutineScope(Dispatchers.Main.immediate).launch <strong>{<br>            </strong>println(&quot;PracticeRunBlocking: start ${getTimeInFormat(System.currentTimeMillis())}&quot;)<br>            var delayedInsecound =  toDelaySomething()<br>            println(&quot;PracticeRunBlocking: delayedInsecound ${getTimeInFormat(delayedInsecound)}&quot;)<br>        <strong>}<br><br>        </strong>println(&quot;PracticeRunBlocking: finished ${getTimeInFormat(System.currentTimeMillis())}&quot;)<br>        <br><br>    }<br><br>   suspend  fun toDelaySomething() : Long{<br>//       runBlocking {<br>//           delay(3000)<br>//       }<br>       withContext(Dispatchers.Default)<strong>{<br>           </strong>delay(3000)<br>       <strong>}<br>     </strong>return System.currentTimeMillis()<br>   }<br><br><br>    fun getTimeInFormat( millis:Long) : String{<br>        val sdf = SimpleDateFormat(&quot;ss&quot;)<br><br>        val calendar = Calendar.getInstance()<br>        calendar.timeInMillis = millis<br><br>        return sdf.format(calendar.time)<br>    }<br>    <br>}</pre><p>Output of the above code when running normally is below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AL1RGvyqWk0F0H0x-RAVzA.png" /><figcaption>output without runblocking</figcaption></figure><p>so when we launch coroutine on main thread i.e UI thread, we called one method named toDelaySomething() which delay code execution for 3 seconds. so our job will not wait to finish the toDelaySomething() of 3 seconds. job executed finish immediately and once delay of 3 seconds complete , it printed out in log.</p><p>so we can say that by this way our Main thread (UI) will remain free until the toDelaySomething()computes something till 3 seconds on another virtual thread. This is the best way to use of thread and prevent app UI freezing.</p><p>Now run the code with slight modification in method toDelaySomething().</p><pre>suspend  fun toDelaySomething() : Long{<br>       <em>runBlocking </em><strong>{<br>           </strong>delay(3000)<br>       <strong>}<br></strong>//       withContext(Dispatchers.Default){<br>//           delay(3000)<br>//       }<br>     return System.currentTimeMillis()<br>   }</pre><p>after modification our code in method toDelaySomething() looks like above snippet. so on running the entire code of PracticeRunBlocking class, out will be like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0YhCPE_VYUOveeLGqSazow.png" /><figcaption>output with runBlocking</figcaption></figure><p>explanation of above output is our main thread will freeze for 3 seconds until toDelaySomething() finish some computation. so output with runBlocking image have seconds 18, 21, 21. it means when u start at 18th seconds, then after 3 seconds it returns and thread finish.</p><p>so will get better clarity once the code in Android Studio runs.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FG-NVmVjjLlk&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DG-NVmVjjLlk&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FG-NVmVjjLlk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/45c077214e448d09cd0d07d5ea487621/href">https://medium.com/media/45c077214e448d09cd0d07d5ea487621/href</a></iframe><blockquote><a href="https://yveskalume.dev/kotlin-coroutines-suspending-vs-blocking">https://yveskalume.dev/kotlin-coroutines-suspending-vs-blocking</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7504ad2e501" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adaptive/Smooth streaming and downloading with Exoplayer (HLS/DASH/Smooth Streaming)]]></title>
            <link>https://mayur-solanki.medium.com/adaptive-streaming-and-downloading-with-exoplayer-hls-dash-smooth-streaming-9ac298e8d934?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ac298e8d934</guid>
            <category><![CDATA[downloadingvideo]]></category>
            <category><![CDATA[smoothstreaming]]></category>
            <category><![CDATA[exoplayer2]]></category>
            <category><![CDATA[adaptivedownloading]]></category>
            <category><![CDATA[v3exo]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Thu, 16 Jul 2020 18:03:28 GMT</pubDate>
            <atom:updated>2024-07-16T10:43:22.850Z</atom:updated>
            <content:encoded><![CDATA[<h3>Adaptive Streaming and Downloading with Android ExoPlayer: HLS, DASH, and Smooth Streaming</h3><p>Download video/data from the adaptive link (.m3u8/.mpd) using background service in Exoplayer with play, pause, resume and remove and Add-in Queue features. Also, Play the same downloaded video in Exoplayer offline.</p><p>In my previous story about Exoplayer, I wrote about how to play the m3u8/mpd link in Exoplayer. So By playing such a kind of link instead of an MP4 link, You are making adaptive streaming on Exoplayer which gives options to the user to select the resolution to play.</p><p>In Progressive download, we use a static link like an mp4/mp3. In Adaptive Download, we use .mpd/.m3u8 links to download data. so In short, an adaptive user has complete control over watching and downloading the content.</p><p>To get detailed info about progressive and adaptive, <a href="https://www.internetvideoarchive.com/documentation/video-api/progressive-download-vs-adaptive-bitrate/">check here</a>. and <a href="https://bitmovin.com/adaptive-streaming/">Here</a></p><p>So after playing the video adaptively in Exoplayer, Now it&#39;s time to download the video according to the user&#39;s selected resolution in the background i.e. adaptive download.</p><p>The coronavirus pandemic completely changed the lives of a human being. Now every industry wants their online identity. One of the major industries I can point out is Education/eLearning. We have too many Android applications across the globe which entertain/educate users by video. For example, I can list down some of the applications like Hotstar, Netflix, Prime Video etc. All applications Use Exoplayer with adaptive streaming and adaptive downloading functionality. Perhaps one of the best examples I can point out is YouTube.</p><p>Have You ever checked the Hotstar or YouTube downloaded files in your phone file manager? wait... Let me show you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XB6ufl_T_k4Gtfmf1RoKHw.png" /></figure><p>Have you ever wondered why these file extensions are not mp4/flv/mkv? <strong>why v3.exo?</strong></p><p>So let&#39;s resolve that mystery by implementing adaptive streaming/downloading using Exoplayer and implementing the functionality same as a well-known application like YouTube and Hotstar.</p><p>Any ideal downloader must have functionality like play, pause, stop, resume, cancel, parallel download as well download queue. same as Exoplayer also provides such a kind of functionality. You can pause/resume/restart/remove the download using the video URL.</p><blockquote><strong>Here is the list of state-provided by the exoplayer while downloading the video.</strong></blockquote><pre>public static final int STATE_QUEUED = 0;<br>/** The download is stopped for a specified {@link #stopReason}. */<br>public static final int STATE_STOPPED = 1;<br>/** The download is currently started. */<br>public static final int STATE_DOWNLOADING = 2;<br>/** The download completed. */<br>public static final int STATE_COMPLETED = 3;<br>/** The download failed. */<br>public static final int STATE_FAILED = 4;<br>/** The download is being removed. */<br>public static final int STATE_REMOVING = 5;<br>/** The download will restart after all downloaded data is removed. */<br>public static final int STATE_RESTARTING = 7;</pre><p>Any downloader needs any specific unique ID to track any download, in the case of Explorer, it takes the URL for that.</p><p><strong>To Start Download</strong>, You have to create a Download request object</p><pre>DownloadRequest downloadRequest = new DownloadRequest(<br>        statusId,<br>        DownloadRequest.TYPE_PROGRESSIVE,<br>        videoUrl,<br>        /* streamKeys= */ Collections.emptyList(),<br>        /* customCacheKey= */ null,<br>        null);<br>downloadManager.addDownload(myDownloadRequest);</pre><p><strong>To Pause Download</strong></p><pre>DownloadService.sendSetStopReason(<br>        OnlinePlayerActivity.this,<br>        DemoDownloadService.class,<br>        Video_url,<br>        Download.STATE_STOPPED,<br>        /* foreground= */ false);<br>downloadManager.addDownload(myDownloadRequest);</pre><p>Here You can also get your download video URL to pause and resume the download from the Download Tracker class</p><pre>downloadTracker.getDownloadRequest(Uri.parse(videoDownloadLink)).id</pre><p><strong>To Resume Download</strong></p><pre>DownloadService.sendSetStopReason(<br>        OnlinePlayerActivity.this,<br>        DemoDownloadService.class,<br>    downloadTracker.getDownloadRequest(Uri.parse(videoDownloadLink)).id,<br>        Download.STOP_REASON_NONE,<br>        /* foreground= */ false);</pre><p><strong>To Remove the download</strong></p><pre>AdaptiveExoplayer.getInstance().getDownloadManager().removeDownload(download.request.id);</pre><p>You can continuously track current downloads and show their progress in activity class</p><pre>AdaptiveExoplayer.<em>getInstance</em>().getDownloadManager().getCurrentDownloads()</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FOarp36ygIEw6c%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FOarp36ygIEw6c%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FOarp36ygIEw6c%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="242" frameborder="0" scrolling="no"><a href="https://medium.com/media/4785c0ce051f1d71ee9afe609d0c9051/href">https://medium.com/media/4785c0ce051f1d71ee9afe609d0c9051/href</a></iframe><blockquote>Wait !! mission is not accomplished yet. Above things will work only for the progressive link.</blockquote><p>To play and download video from the adaptive link (.m3u8) or HLS or Dash link we have to follow a different strategy.</p><p>To fetch the download format/video resolution available on the server to download/Stream we have to prepare one TrackKey ArrayList and we have to filter sampleMimeType “video/av”. we have to filter to distinguish audio and video mimeType from the TrackKey list.</p><pre>downloadHelper.prepare(new DownloadHelper.Callback() {<br>    @Override<br>    public void onPrepared(DownloadHelper helper) {<br>        // Preparation completes. Now other DownloadHelper methods can be called.<br>        myDownloadHelper = helper;<br>        for (int i = 0; i &lt; helper.getPeriodCount(); i++) {<br>            TrackGroupArray trackGroups = helper.getTrackGroups(i);<br>            for (int j = 0; j &lt; trackGroups.length; j++) {<br>                TrackGroup trackGroup = trackGroups.get(j);<br>                for (int k = 0; k &lt; trackGroup.length; k++) {<br>                    Format track = trackGroup.getFormat(k);<br>                    if (shouldDownload(track)) {<br>                        trackKeys.add(new TrackKey(trackGroups, trackGroup, track));<br>                    }<br>                }<br>            }<br>        }<br><br>private boolean shouldDownload(Format track) {<br>   return track.height != 240 &amp;&amp; track.sampleMimeType.equalsIgnoreCase(&quot;video/avc&quot;);<br>}</pre><p>To show the download size option to the user we have to get bitrate and video duration and multiply them to get the total size of the video in MB/GB for a specific resolution. The different video resolution has a different bitrate according to their resolution.</p><pre>for (int i = 0; i &lt; trackKeyss.size(); i++) {<br>    TrackKey trackKey = trackKeyss.get(i);<br>    long bitrate = trackKey.getTrackFormat().bitrate;<br>    long getInBytes =  (bitrate * videoDurationInSeconds)/8;<br>     String getInMb = AppUtil.formatFileSize(getInBytes);<br>     String videoResoultionDashSize =  &quot; &quot;+trackKey.getTrackFormat().height +&quot;      (&quot;+getInMb+&quot;)&quot;;<br>}</pre><p>On selecting Specific video resolution we prepare our download request for that download video URL. So For all the download resolution formats, our download request ID will remain the same i.e. our video URL. we prepare a unique download request for that same video URL which is according to video resolution.</p><p>To prepare a unique download request according to video resolution for the same video URL, we have to prepare parameters by passing video resolution and video bitrate.</p><pre>DefaultTrackSelector.Parameters qualityParams = ((DefaultTrackSelector) trackSelector).getParameters().buildUpon()<br>        .setMaxVideoSize(trackKey.getTrackFormat().width, trackKey.getTrackFormat().height)<br>        .setMaxVideoBitrate(trackKey.getTrackFormat().bitrate)<br>        .build();<br>for (int periodIndex = 0; periodIndex &lt; helper.getPeriodCount(); periodIndex++) {<br>                    MappingTrackSelector.MappedTrackInfo mappedTrackInfo = helper.getMappedTrackInfo(/* periodIndex= */ periodIndex);<br>                    helper.clearTrackSelections(periodIndex);<br>                    for (int i = 0; i &lt; mappedTrackInfo.getRendererCount(); i++) {<br>//                        TrackGroupArray rendererTrackGroups = mappedTrackInfo.getTrackGroups(i);<br>                        helper.addTrackSelection(<br>                                periodIndex,<br>                                qualityParams);<br>                    }<br><br>                }<br><br>                DownloadRequest downloadRequest = helper.getDownloadRequest(Util.getUtf8Bytes(videoUrl));<br>                if (downloadRequest.streamKeys.isEmpty()) {<br>                    // All tracks were deselected in the dialog. Don&#39;t start the download.<br>                    return;<br>                }<br></pre><p>so once you set up this download request, now</p><p><strong>To Start Download</strong></p><pre>downloadManager.addDownload(myDownloadRequest);</pre><p><strong>To pause the download</strong></p><pre>downloadManager.addDownload(downloadTracker.getDownloadRequest(Uri.parse(videoUrl)), Download.STATE_STOPPED);</pre><p><strong>To resume the download</strong></p><pre>downloadManager.addDownload(downloadTracker.getDownloadRequest(Uri.parse(videoUrl)), Download.STOP_REASON_NONE);</pre><p><strong>To delete/Remove the Download</strong></p><pre>AdaptiveExoplayer.getInstance().getDownloadManager().removeDownload(download.request.id);</pre><blockquote><strong><em>once everything went well, then you will be able to see your download at file directory, At external storage, Android&gt;Data&gt;com.adaptive.exoplayer.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxyf5i2HZQJAMChfibZhoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKbZQaWG4rDJjeWTLB2WxA.jpeg" /></figure><p>Here you can see the video data has been downloaded in parts with extension <strong>.v3.exo.</strong></p><p>this is the video extension Exoplayer used, so only application-specific Exoplayer can understand the video parts, assemble them and play it. so any application which has concern like only my application can play my video, no other third party player or application can play it, this issue can be resolved using this. <strong>so your application only can play it.</strong> video data will remain safe in the application. So the video data parts are inside the random folders and only the player algorithm knows which parts have to play after others, so it&#39;s also one kind of video encryption can be achieved using an exoplayer.</p><p>I am attaching screenshots of one of the famous OTT applications downloaded video data screenshots which use the same strategy which I have explained above. Here it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9PZLcAEbcJ70ZwyZLXOGA.png" /></figure><p>So in this article, I have covered all the technical information required for the progressive as well as smooth streaming/Downloading.</p><h4><strong>Note:</strong> once you check out my GitHub repo, HLS link I have used in it might be not working because of the CDN link expiration strategy. so use your own .m3u8/HLS/Dash link.</h4><p>working video of the above article YouTube link:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkgquZ0n8pnI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkgquZ0n8pnI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FkgquZ0n8pnI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/23629faf6c802ff8ed55eb8c814a5376/href">https://medium.com/media/23629faf6c802ff8ed55eb8c814a5376/href</a></iframe><p>Github source repo link:</p><p><a href="https://github.com/MayurSolanki/AdaptiveStreamingExoplayer">MayurSolanki/AdaptiveStreamingExoplayer</a></p><figure><a href="https://www.buymeacoffee.com/w1ftmpuan"><img alt="" src="https://cdn-images-1.medium.com/max/170/1*WfbwTpxi0c0k2Vwzp3s5yg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ac298e8d934" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Application with Flutter (Flutter web)]]></title>
            <link>https://mayur-solanki.medium.com/flutter-web-formerly-hummingbird-ba52f5135fb0?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba52f5135fb0</guid>
            <category><![CDATA[webapplicationdevelopment]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[webapplicationwithflutter]]></category>
            <category><![CDATA[flutter-web]]></category>
            <category><![CDATA[localstorage]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Sat, 21 Sep 2019 11:06:40 GMT</pubDate>
            <atom:updated>2019-09-21T17:12:18.630Z</atom:updated>
            <content:encoded><![CDATA[<p>Flutter is the trending technology for mobile application development and many developers start learning it. The best reason to love flutter is the, you can develop a mobile application (Android,iPhone), desktop application (mac, windows, Linux) and web application too. This article will help mobile developers to develop web application in Flutter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*WgVHeGh6yS4BMGNJ" /></figure><p>Yes, you heard right, you can develop a Web application with flutter.</p><p>Formerly, Google has introduced the Flutter web as hummingbird but later google changed it to flutter web and recently merged flutter web to flutter on the release of <a href="https://github.com/flutter/flutter/wiki/Release-Notes-Flutter-1.9.1"><strong>flutter 1.9.1</strong></a></p><p>So let’s start to learn flutter web. It’s the right time start to learn flutter web because you can access local storage, session storage and cookies of the web browser in flutter web and YES API calls too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Orf3HsZSF2GBKAe0GHUY9g.png" /></figure><p>here is some information about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HJ5JCwXzDUFA-wOC.png" /><figcaption><a href="https://www.youtube.com/watch?v=AwicscsvGLg">Link for video</a></figcaption></figure><p>storing value is the required thing in any application development, whether it is a mobile app, desktop app or web app. So for web application development, there are session storage, local storage, indexed DB and web SQL to store value in a purely application-specific browser. You learned about them in the previous section.</p><p>I am sharing the screenshot with code of flutter web application and will also host on GitHub.</p><pre>html.window.localStorage[&#39;local_value&#39;] = localStorage;</pre><pre>html.window.sessionStorage[&#39;session_value&#39;] = sessionStorage;</pre><pre>html.window.document.cookie= &quot;username=${cookies}; expires=Thu, 18 Dec 2020 12:00:00 UTC&quot;;</pre><p>don’t forget to move your flutter channel in beta or master and import <br> ‘dart:html’ as html;</p><pre>import &#39;dart:html&#39; as html;</pre><p>You can get/retrieve those saved value like this way</p><pre>html.window.localStorage[&#39;key&#39;]</pre><pre>html.window.sessionStorage[&#39;key&#39;]</pre><pre>html.window.document.cookie</pre><p>Here I am sharing full code</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:http/http.dart&#39;;<br>import &#39;package:web_example/app_util.dart&#39;;<br>import &#39;package:web_example/home_screen.dart&#39;;<br>import &#39;package:web_example/register_screen.dart&#39;;<br>import &#39;package:web_example/user.dart&#39;;<br>import &#39;dart:html&#39; as html;<br>import &#39;package:http/http.dart&#39; as http;</pre><pre>class LoginScreen extends StatefulWidget {<br>  @override<br>  _LoginScreenState createState() =&gt; _LoginScreenState();<br>}</pre><pre>class _LoginScreenState extends State&lt;LoginScreen&gt; {<br>  final GlobalKey&lt;ScaffoldState&gt; _scaffoldKey = new GlobalKey&lt;ScaffoldState&gt;();</pre><pre>String localStorage=&quot;&quot;;<br>  String sessionStorage=&quot;&quot;;<br>  String cookies=&quot;&quot;;</pre><pre>@override<br>  Widget build(BuildContext context) {</pre><pre>Widget enterLocalStorageValue() {<br>      return Container(<br>        width: 400.0,<br>        child: TextField(</pre><pre>decoration:  InputDecoration(<br>              labelText: &quot;Enter local storage value&quot;,<br>              labelStyle: TextStyle(color: Colors.<em>green</em>),<br>              hintText: &quot;Enter local storage value&quot;,<br>              alignLabelWithHint: true,<br>              prefixIcon: new Icon(Icons.<em>text_fields</em>)<br>          ),<br>            obscureText: false,<br>            onChanged: (value) {<br>              localStorage = value.trim();<br>          },<br>        ),<br>      );<br>    }</pre><pre>Widget enterSessionStorageValue() {<br>      return Container(<br>        width: 400.0,<br>        child: TextField(<br>          decoration:  InputDecoration(<br>              labelText: &quot;Enter session storage value&quot;,<br>              labelStyle: TextStyle(color: Colors.<em>green</em>),<br>              hintText: &quot;Enter session storage value&quot;,<br>              alignLabelWithHint: true,<br>              prefixIcon: new Icon(Icons.<em>text_fields</em>)<br>          ),<br>          obscureText: false,<br>          onChanged: (value) {<br>            sessionStorage = value.trim();<br>          },<br>        ),<br>      );<br>    }</pre><pre>Widget enterCookieValue() {<br>      return Container(<br>        width: 400.0,</pre><pre>child: TextField(<br>          decoration:  InputDecoration(<br>              labelText: &quot;Enter cookies  value&quot;,<br>              labelStyle: TextStyle(color: Colors.<em>green</em>),<br>              hintText: &quot;Enter cookies  value&quot;,<br>              alignLabelWithHint: true,<br>              prefixIcon: new Icon(Icons.<em>text_fields</em>)<br>          ),<br>          obscureText: false,<br>          onChanged: (value) {<br>            cookies = value.trim();<br>          },<br>        ),<br>      );<br>    }</pre><pre>final localStoreBtn = new Container(<br>      width: 400.0,<br>        height: 40.0,<br>        child: new RaisedButton(<br>          child: new Text(<br>            &#39;Local storage&#39;,<br>            style: new TextStyle(color: Colors.<em>white</em>),<br>          ),<br>          onPressed : () =&gt; _localStorage(),<br>          color: Colors.<em>blue</em>,<br>        ),<br>        margin: new EdgeInsets.only(top: 25.0)<br>    );</pre><pre>final sessionStoreBtn = new Container(<br>        width: 400.0,</pre><pre>height: 40.0,<br>        child: new RaisedButton(<br>          child: new Text(<br>            &#39;Session storage&#39;,<br>            style: new TextStyle(color: Colors.<em>white</em>),<br>          ),<br>          onPressed : () =&gt; _sessionStore(),<br>          color: Colors.<em>blue</em>,<br>        ),<br>        margin: new EdgeInsets.only(top: 25.0)<br>    );</pre><pre>final cookieStoreBtn = new Container(<br>        width: 400.0,</pre><pre>height: 40.0,<br>        child: new RaisedButton(<br>          child: new Text(<br>            &#39;Cookies&#39;,<br>            style: new TextStyle(color: Colors.<em>white</em>),<br>          ),<br>          onPressed : () =&gt; _cookieStorage(),<br>          color: Colors.<em>blue</em>,<br>        ),<br>        margin: new EdgeInsets.only(top: 25.0)<br>    );</pre><pre>final apiCallBtn = new Container(<br>        width: 400.0,<br>        height: 40.0,<br>        child: new RaisedButton(</pre><pre>child: new Text(</pre><pre>&#39;Tap to call api&#39;,<br>            style: new TextStyle(color: Colors.<em>white</em>),<br>          ),<br>          onPressed : () =&gt; getData(),<br>          color: Colors.<em>blue</em>,</pre><pre>),<br>        margin: new EdgeInsets.only(top: 25.0)<br>    );</pre><pre>return Scaffold(<br>      key: _scaffoldKey,<br>      appBar: AppBar(<br>        centerTitle: true,<br>        title: Text(&#39;Flutter web sample&#39;,style: TextStyle(fontSize: 18),),<br>      ),<br>      body:  Container(<br>        width: double.<em>infinity</em>,<br>        height: double.<em>infinity</em>,<br>        child: ListView(</pre><pre>children: &lt;Widget&gt;[</pre><pre>Row(<br>                       crossAxisAlignment: CrossAxisAlignment.center,<br>                     mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>                       children: &lt;Widget&gt;[<br>                         enterLocalStorageValue(),<br>                         localStoreBtn,<br>                       ],<br>                     ),</pre><pre>Padding(<br>                     padding: const EdgeInsets.all(8.0),<br>                   ),</pre><pre>Row(<br>                     mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>                     children: &lt;Widget&gt;[<br>                       enterSessionStorageValue(),<br>                       sessionStoreBtn,<br>                     ],<br>                   ),</pre><pre>Padding(<br>                     padding: const EdgeInsets.all(8.0),<br>                   ),</pre><pre>Row(<br>                     mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>                     children: &lt;Widget&gt;[<br>                       enterCookieValue(),<br>                       cookieStoreBtn,<br>                     ],<br>                   ),</pre><pre>Row(<br>                      mainAxisAlignment: MainAxisAlignment.center,<br>                      children: &lt;Widget&gt;[<br>                        apiCallBtn,<br>                      ],<br>                    ),</pre><pre>],<br>           ),<br>      )<br>    );</pre><pre>}</pre><pre>_localStorage() {<br>     html.window.localStorage[&#39;local_value&#39;] = localStorage;<br>  }</pre><pre>_sessionStore() {<br>    html.window.sessionStorage[&#39;session_value&#39;] = sessionStorage;<br>  }</pre><pre>_cookieStorage() {<br>    html.window.document.cookie= &quot;username=${cookies}; expires=Thu, 18 Dec 2020 12:00:00 UTC&quot;;<br>  }</pre><pre>getData() async {<br>    try {<br>      final response = await http.get(&#39;https://jsonplaceholder.typicode.com/posts&#39;);<br>      print(response.body);</pre><pre>} catch (e) {<br>      print(e);<br>    }<br>  }</pre><pre>}</pre><p><a href="https://youtu.be/YLWnkXXkbEM">Video</a> Link which shows the <a href="https://youtu.be/YLWnkXXkbEM">working of code</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYprx_-NunJKzCsRb5sB9w.png" /></figure><p>Github source code link:</p><p><a href="https://github.com/MayurSolanki/flutter_web">MayurSolanki/flutter_web</a></p><p>You can check the working demo available online on this link:</p><p><a href="http://flutter_web_sample.surge.sh/#/">http://flutter_web_sample.surge.sh/#/</a></p><figure><a href="http://buymeacoff.ee/W1FTmPuaN"><img alt="" src="https://cdn-images-1.medium.com/max/170/1*bk_C8Um34KavCkO2yzMCZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba52f5135fb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adaptive streaming with Exoplayer]]></title>
            <link>https://mayur-solanki.medium.com/adaptive-streaming-with-exoplayer-c77b0032acdd?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c77b0032acdd</guid>
            <category><![CDATA[trackselection]]></category>
            <category><![CDATA[videorevolution]]></category>
            <category><![CDATA[adaptive-streaming]]></category>
            <category><![CDATA[exoplayer2]]></category>
            <category><![CDATA[ffmpeg]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Fri, 22 Feb 2019 11:27:40 GMT</pubDate>
            <atom:updated>2020-07-17T17:15:02.515Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s create one Adaptive exoplayer with playback speed, fast forward, backward options and track selection which shows video resolution option to play the video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kK1JljXOiLos-NWW2gFYwA.png" /></figure><p>For adaptive streaming with exoplayer we need to create video with file format like .mpd or m3u8. To know more about m3u8 file <a href="https://en.wikipedia.org/wiki/M3U">click here</a></p><p>If you want to create your own video file with streaming options.<br>Follow below link.</p><p><a href="https://medium.com/@mayur_solanki/how-to-create-mpd-or-m3u8-video-file-from-server-using-ffmpeg-97e9e1fbf6a3">How to create .mpd or .m3u8 video file from server</a> using <a href="https://www.ffmpeg.org/"><strong>FFMPEG</strong></a>.</p><p>Exoplayer does not support mp4 file format for adaptive streaming but you can choose mp4 like format for auto streaming.Auto streaming is something which is completely depends on speed and connectivity of the internet.</p><p><a href="https://github.com/google/ExoPlayer">GitHub - google/ExoPlayer: An extensible media player for Android</a></p><p>Checkout the latest version of exoplayer from below link <br><a href="https://github.com/google/ExoPlayer/releases">https://github.com/google/ExoPlayer/releases</a></p><p><strong>Track selection</strong></p><pre>MappingTrackSelector.MappedTrackInfo mappedTrackInfo = <strong>trackSelector</strong>.getCurrentMappedTrackInfo();<br>            <strong>if </strong>(mappedTrackInfo != <strong>null</strong>) {</pre><pre><em>MappingTrackSelector.MappedTrackInfo.RENDERER_SUPPORT_NO_TRACKS);<br>                </em>Pair&lt;AlertDialog, TrackSelectionView&gt; dialogPair =<br>                        TrackSelectionView.<em>getDialog</em>(<strong>this</strong>, <strong>&quot;Select Video Resolution&quot;</strong>, <strong>trackSelector</strong>, 0);<br>                dialogPair.<strong>second</strong>.setShowDisableOption(<strong>false</strong>);<br>                dialogPair.<strong>second</strong>.setAllowAdaptiveSelections(<strong>false</strong>);<br>                dialogPair.<strong>first</strong>.show();</pre><p><strong>Player initialisation</strong></p><pre><br><br>        TrackSelection.Factory trackSelectionFactory;<br>        trackSelectionFactory = <strong>new </strong>AdaptiveTrackSelection.Factory();<br><br><br>        @DefaultRenderersFactory.ExtensionRendererMode <strong>int </strong>extensionRendererMode =<br>                ((App) getApplication()).useExtensionRenderers()<br>                        ? (<strong>true </strong>? DefaultRenderersFactory.<strong><em>EXTENSION_RENDERER_MODE_PREFER<br>                        </em></strong>: DefaultRenderersFactory.<strong><em>EXTENSION_RENDERER_MODE_ON</em></strong>)<br>                        : DefaultRenderersFactory.<strong><em>EXTENSION_RENDERER_MODE_OFF</em></strong>;<br><br>        DefaultRenderersFactory renderersFactory = <strong>new </strong>DefaultRenderersFactory(<strong>this</strong>, <strong>null</strong>,<br>                DefaultRenderersFactory.<strong><em>EXTENSION_RENDERER_MODE_PREFER</em></strong>);<br><br>        <strong>trackSelector </strong>= <strong>new </strong>DefaultTrackSelector(trackSelectionFactory);<br>        <strong>trackSelector</strong>.setParameters(<strong>trackSelectorParameters</strong>);<br>        <strong>lastSeenTrackGroupArray </strong>= <strong>null</strong>;<br><br><br>        DefaultAllocator defaultAllocator = <strong>new </strong>DefaultAllocator(<strong>true</strong>, C.<strong><em>DEFAULT_VIDEO_BUFFER_SIZE</em></strong>);<br>        DefaultLoadControl defaultLoadControl = <strong>new </strong>DefaultLoadControl(defaultAllocator,<br>                DefaultLoadControl.<strong><em>DEFAULT_MIN_BUFFER_MS</em></strong>,<br>                DefaultLoadControl.<strong><em>DEFAULT_MAX_BUFFER_MS</em></strong>,<br>                DefaultLoadControl.<strong><em>DEFAULT_BUFFER_FOR_PLAYBACK_MS</em></strong>,<br>                DefaultLoadControl.<strong><em>DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS</em></strong>,<br>                DefaultLoadControl.<strong><em>DEFAULT_TARGET_BUFFER_BYTES</em></strong>,<br>                DefaultLoadControl.<strong><em>DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS<br>        </em></strong>);<br><br>        <strong>player </strong>= ExoPlayerFactory.<em>newSimpleInstance</em>(<em>/* context= */ </em>MainActivity.<strong>this</strong>, renderersFactory, <strong>trackSelector</strong>, defaultLoadControl);<br>        <strong>player</strong>.addListener(<strong>new </strong>PlayerEventListener());<br>        <strong>player</strong>.setPlayWhenReady(<strong>startAutoPlay</strong>);<br>        <strong>player</strong>.addAnalyticsListener(<strong>new </strong>EventLogger(<strong>trackSelector</strong>));<br>        <strong>playerView</strong>.setPlayer(<strong>player</strong>);<br>        <strong>playerView</strong>.setPlaybackPreparer(<strong>this</strong>);<br><em><br>        </em><strong>mediaSource </strong>= buildMediaSource(Uri.<em>parse</em>(<strong>&quot;http://13.127.14.184/adaptive/lecturevideo/sample_lecture_playlist.m3u8&quot;</strong>)); <em><br><br>        </em><strong>player</strong>.prepare(<strong>mediaSource</strong>);<br>        <br>    </pre><p><strong>Build Media source based on different different kinds of URI</strong></p><pre><strong>private </strong>MediaSource buildMediaSource(Uri uri, @Nullable String overrideExtension) {<br>    @C.ContentType <strong>int </strong>type = Util.<em>inferContentType</em>(uri, overrideExtension);<br>    <strong>switch </strong>(type) {<br>        <strong>case </strong>C.<strong><em>TYPE_DASH</em></strong>:<br>            <strong>return new </strong>DashMediaSource.Factory(<strong>dataSourceFactory</strong>)<br>                    .createMediaSource(uri);<br>        <strong>case </strong>C.<strong><em>TYPE_SS</em></strong>:<br>            <strong>return new </strong>SsMediaSource.Factory(<strong>dataSourceFactory</strong>)<br>                    .createMediaSource(uri);<br>        <strong>case </strong>C.<strong><em>TYPE_HLS</em></strong>:<br>            <strong>return new </strong>HlsMediaSource.Factory(<strong>dataSourceFactory</strong>)<br>                    .createMediaSource(uri);<br>        <strong>case </strong>C.<strong><em>TYPE_OTHER</em></strong>:<br>            <strong>return new </strong>ExtractorMediaSource.Factory(<strong>dataSourceFactory</strong>).createMediaSource(uri);<br>        <strong>default</strong>: {<br>            <strong>throw new </strong>IllegalStateException(<strong>&quot;Unsupported type: &quot; </strong>+ type);<br>        }<br>    }<br>}</pre><p><strong>Github repository link</strong></p><p><a href="https://github.com/MayurSolanki/AdaptiveStreamingExoplayer">https://github.com/MayurSolanki/AdaptiveStreamingExoplayer</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kK1JljXOiLos-NWW2gFYwA.png" /></figure><p>Check out the latest code from above link and just replace .m3u8 link by your own m3u8 link.</p><p><strong>video link</strong></p><p><a href="https://youtu.be/i-GiZvJzRv0">https://youtu.be/i-GiZvJzRv0</a></p><h3>For more Resources on Exoplayer follow below link.</h3><p><a href="https://link.medium.com/rHFUld5MwY">&quot;Playing video by ExoPlayer&quot;</a></p><p><strong>Check out my new article on adaptive download using Exoplayer</strong></p><p><a href="https://medium.com/@mayur_solanki/adaptive-streaming-and-downloading-with-exoplayer-hls-dash-smooth-streaming-9ac298e8d934">Adaptive/Smooth streaming and downloading with Exoplayer (HLS/DASH/Smooth Streaming)</a></p><figure><a href="http://buymeacoff.ee/W1FTmPuaN"><img alt="" src="https://cdn-images-1.medium.com/max/170/1*bk_C8Um34KavCkO2yzMCZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c77b0032acdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Adaptive Streaming Files (.mpd/.m3u8) for Video on Server Using FFMPEG]]></title>
            <link>https://mayur-solanki.medium.com/how-to-create-mpd-or-m3u8-video-file-from-server-using-ffmpeg-97e9e1fbf6a3?source=rss-524c98b964b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/97e9e1fbf6a3</guid>
            <category><![CDATA[ffmpeg]]></category>
            <category><![CDATA[m3u8]]></category>
            <category><![CDATA[video-player]]></category>
            <category><![CDATA[exoplayer]]></category>
            <category><![CDATA[adaptive-streaming]]></category>
            <dc:creator><![CDATA[Mayur Solanki]]></dc:creator>
            <pubDate>Fri, 22 Feb 2019 11:23:21 GMT</pubDate>
            <atom:updated>2025-10-10T04:46:10.921Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using FFmpeg, create Adaptive Video Streaming Files (.mpd/.m3u8)</h3><p><strong>Steps that you should follow to generate the adaptive streaming link. Android Exoplayer supports only .mpd/.m3u8 for adaptive streaming</strong></p><ol><li>Install XAMPP/LAMP/WAMP on your local or dedicated server, like AWS.</li><li>Install the FFmpeg library on your server. <br>To install FFmpeg on the server, follow the links below.<br><a href="https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu">https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu</a><br><a href="https://www.ffmpeg.org/download.html">https://www.ffmpeg.org/download.html</a><br><a href="https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/">https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/</a></li><li>After installation, complete the <a href="http://www.tothenew.com/blog/apple-http-live-streaming-hls/">link</a> here, which contains a command to process the MP4 video file and generate .ts files for the m3u8 file.</li><li>Once using commands, all m3u8 files are generated for different types of resolutions, add them into one main file by reference and create the main m3u8 file.</li><li>Finally, you have the server path of that one m3u8 file only, and Exoplayer should link to that file.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6ap8k95qkCoYlGlZmjMnw.png" /><figcaption>after processing video using ffmpeg</figcaption></figure><p><strong>FFmpeg Commands to process mp4 video</strong></p><p>240x320</p><p>360x640</p><p>480x800</p><p>540x960</p><p>Step 1. Create one folder/directory with the name of the video</p><p>Step 2. Put the MP4 video in that folder</p><p>Step 3. Start performing the following operation</p><p>Note: Use the command below</p><pre>ffmpeg -i ../sample.mp4 -c:a aac -strict experimental -c:v libx264 -s 854x480 -aspect 16:9 -f hls -hls_list_size 1000000 -hls_time 2 480_out.m3u8</pre><ol><li>For 240x320</li></ol><pre>ffmpeg -i big_bunny.mp4 -c:a aac -strict experimental -c:v libx264 -s 240x320 -aspect 16:9 -f hls -hls_list_size 1000000 -hls_time 2 240_out.m3u8</pre><p>2. For 360x640</p><pre>ffmpeg -i big_bunny.mp4 -c:a aac -strict experimental -c:v libx264 -s 360x640 -aspect 16:9 -f hls -hls_list_size 1000000 -hls_time 2 360_out.m3u8</pre><p>3. For 480x800</p><pre>ffmpeg -i big_bunny.mp4 -c:a aac -strict experimental -c:v libx264 -s 480x800 -aspect 16:9 -f hls -hls_list_size 1000000 -hls_time 2 480_out.m3u8</pre><p>4. For 540x960</p><pre>ffmpeg -i big_bunny.mp4 -c:a aac -strict experimental -c:v libx264 -s 480x800 -aspect 16:9 -f hls -hls_list_size 1000000 -hls_time 2 540_out.m3u8</pre><p>After performing 4 resolution commands for distinct .m3u8 files will be generated.</p><p>Now, create an .m3u8 file with a playlist manually or programmatically</p><p>For example,<br>i.e {{videoname}}.m3u8</p><p>Add below text in that final m3u8 file (playlist.m3u8)</p><pre>#EXTM3U<br>#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=700000<br>240_out.m3u8<br>#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1000000<br>360_out.m3u8<br>#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=2000000<br>480_out.m3u8<br>#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=2000000<br>540_out.m3u8</pre><p><strong><em>Now your final m3u8 file like</em></strong></p><p><a href="https://drive.google.com/file/d/1P8A_LmHyeL_K2gitOGED2TidU4Qz92m0/view?usp=sharing">mediaFilePlaylist.m3u8</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3yEBkP-dny7scwPburJNHw.png" /><figcaption>after processing video using ffmpeg</figcaption></figure><p>And now the final m3u8 file link would be like</p><pre><strong>http://13.127.14.184/adaptive/bigbunny/playlist.m3u8</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kK1JljXOiLos-NWW2gFYwA.png" /><figcaption>Click setting button</figcaption></figure><p><strong>Github repository link</strong></p><p><a href="https://github.com/MayurSolanki/AdaptiveStreamingExoplayer">https://github.com/MayurSolanki/AdaptiveStreamingExoplayer</a></p><p>Check out the latest code from the above link and just replace the .m3u8 link with your m3u8 link.</p><p><strong>video link</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fi-GiZvJzRv0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Di-GiZvJzRv0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fi-GiZvJzRv0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/146e17fc8c8b66170cd258adaafb9e26/href">https://medium.com/media/146e17fc8c8b66170cd258adaafb9e26/href</a></iframe><p>If you want to learn how to integrate in Exoplayer, then follow the link below</p><p><a href="https://medium.com/@mayur_solanki/adaptive-streaming-with-exoplayer-c77b0032acdd">https://medium.com/@mayur_solanki/adaptive-streaming-with-exoplayer-c77b0032acdd</a></p><figure><a href="http://buymeacoff.ee/W1FTmPuaN"><img alt="" src="https://cdn-images-1.medium.com/max/170/1*bk_C8Um34KavCkO2yzMCZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97e9e1fbf6a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>