<?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 Ben Cotte on Medium]]></title>
        <description><![CDATA[Stories by Ben Cotte on Medium]]></description>
        <link>https://medium.com/@ben_cotte?source=rss-dcdbf9f620aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hs-BrMrfWpGSdZrylaqMQg.png</url>
            <title>Stories by Ben Cotte on Medium</title>
            <link>https://medium.com/@ben_cotte?source=rss-dcdbf9f620aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:02:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ben_cotte/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[How to make random poppin’ avatars that look cool with React Spring]]></title>
            <link>https://medium.com/@ben_cotte/how-to-make-random-poppin-avatars-that-look-cool-with-react-spring-fcfbb9ee475?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcfbb9ee475</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[requestanimationframe]]></category>
            <category><![CDATA[react-spring]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Sat, 26 Aug 2023 21:21:58 GMT</pubDate>
            <atom:updated>2024-06-04T07:14:22.784Z</atom:updated>
            <content:encoded><![CDATA[<p>About two weeks ago, I worked with Kino Technologies — an ambitious startup that shapes new experiences around TV shows. Perfect, I am currently bullish on working on video-based experiences. The mission was to ship their landing page in a couple of days. My old friend <a href="https://medium.com/u/d62eaed3f2bc">Nico</a>&#39;s prototype included nifty avatars popping. <em>Gorgeous — as always with </em><a href="https://medium.com/u/d62eaed3f2bc"><em>Nico</em></a><em>’s work</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*qhyAfHxXBDgDjMNV6tCaCw.gif" /><figcaption>Popping avatars looking cool</figcaption></figure><blockquote>You can check the live version of the landing page <a href="https://skamwithfriends-landing.vercel.app/">here</a></blockquote><p>While shipping the landing page, I discovered new tricks and had the opportunity to dig into a few animation-related things.</p><p>This landing page includes two exciting parts: custom video animations (with a dragging gesture that does not suck on mobile) and these avatars popping. In this article, I’ll focus on the latter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xnnt0tajpVtWecMPul07BA.png" /><figcaption>the landing page has 2 interesting parts</figcaption></figure><p>My approach was to get going in 3 steps, which I’ll cover below:</p><ol><li>Get the animation right</li><li>Get them in a loop</li><li>Add randomness to the loop</li></ol><p>🎁 To complete this article, you can find a simplified version of the code in the article <a href="https://github.com/Versus-Skate/demo-react-spring/tree/main">here</a>, and a demo of this specific part <a href="https://demo-react-spring.vercel.app/avatars-poppin">here</a>.</p><h3>Get Animations right with <a href="https://www.react-spring.dev/">React Spring</a></h3><p>At first, I started implementing the animation with <a href="https://medium.com/framer.com/motion/">Framer motion</a> but quickly discovered that orchestration would be a challenge. I quickly moved to using <a href="https://www.react-spring.dev/">React Spring</a>.</p><p>Indeed, there are two parts to the animation:</p><ol><li>The Avatar pops</li><li>Then, the message appears and fades out while moving up</li></ol><h4>Getting the springs ready</h4><p>There are 4 avatars and 4 messages. Therefore, I instantiate 8 springs.</p><pre>const [springs, api] = useSprings(AVATARS.length * 2, (index) =&gt; ({<br>  from: from(),<br>  to: to(index),<br>  config: {<br>    duration: duration(index),<br>  },<br>}));</pre><p>I arbitrarily set that the first spring is the first avatar, the second is the first message, the third is the second avatar, etc…</p><pre>const isAvatar = (index: number) =&gt; index % 2 === 0;</pre><p>I add a few animation utility functions (<em>from</em>, <em>to</em>, and <em>duration</em>) based on whether it is the avatar or the text:</p><pre>const from = () =&gt; ({<br>  textY: 0,<br>  textOpacity: 0,<br>  avatarY: 0,<br>});<br><br>const to = (index: number) =&gt; isAvatar(index) ?<br>  [{<br>    avatarY: -8,<br>  }, {<br>    avatarY: 0,<br>  }]<br>  : [{<br>    textY: 0,<br>    textOpacity: 1,<br>    config: {<br>      duration: 0,<br>    },<br>  }, {<br>    textY: -60,<br>    textOpacity: 0,<br>  }]<br><br>const duration = (index: number) =&gt; isAvatar(index) ? 100 : 2000;</pre><p>Finally, I wrap the spring <em>api.start </em>call in a function that takes indexes as parameters so that I can start the animation on any of the springs given their indexes are provided.</p><pre>const apiStart = (api: any, indexes: number[]) =&gt; {<br>  api.start((i: number) =&gt; {<br>    if (!indexes.includes(i)) { return }<br>    return {<br>      from: from(),<br>      to: to(i),<br>      config: {<br>        duration: duration(i),<br>      },<br>    }<br>  });<br>}</pre><h4>The avatar pops</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*iU8GRqQ1cyYYIe0nZzgTkg.gif" /><figcaption>Avatars pop</figcaption></figure><p>The animation utilities above show that the properties prefixed with “avatar” are responsible for the animation.</p><h4>The message appears and fades out</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*DluR7T89aQLkgfOM-fLMYQ.gif" /><figcaption>Messages fade out</figcaption></figure><p>Similarly, the animation utilities above show that the properties prefixed with “text” are responsible for the animation.</p><h4>Triggering on click</h4><p>At this point, the animation of all the springs happens on click so that they can be fine-tuned easily.</p><pre>const handleOnClick = () =&gt; {<br>  apiStart(api, [0, 1, 2, 3, 4, 5, 6, 7]);<br>}</pre><p>The springs are ready. The animation starts on click for all of them. We now only need to pass them to their dedicated components…</p><pre>export default function AvatarsPoppin() {<br>  <br>  const [springs, api] = useSprings(AVATARS.length * 2, (index) =&gt; ({<br>    from: from(),<br>    to: to(index),<br>    config: {<br>      duration: duration(index),<br>    },<br>  }));<br><br>  const handleOnClick = () =&gt; {<br>    apiStart(api, [0, 1, 2, 3, 4, 5, 6, 7]);<br>  }<br><br>  return (<br>    &lt;main className=&#39;flex items-center gap-4 h-screen w-full justify-center&#39;&gt;<br>      {AVATARS.map((_, index) =&gt; (<br>        &lt;div <br>          key={index}<br>          className=&#39;flex flex-col items-center relative&#39;<br>          onClick={handleOnClick}<br>        &gt;<br>          &lt;Text<br>            spring={springs[index * 2 + 1]}<br>            text={AVATARS[index].text}<br>          /&gt;<br>          &lt;Avatar<br>            spring={springs[index * 2]}<br>            index={index}<br>          /&gt;<br>        &lt;/div&gt;<br>      ))}<br>    &lt;/main&gt;<br>  );<br>}</pre><p>…and apply them on their containers.</p><pre>const Text = ({ text, spring }: { text: string, spring: any }) =&gt; {<br>  return (<br>    &lt;animated.div<br>      className={`<br>        absolute<br>        -top-16<br>        w-[100px]<br>        h-[46px]<br>        text-[15px] text-center<br>        align-text-bottom<br>        flex<br>        items-end<br>        justify-center<br>      `}<br>      style={{<br>        y: spring.textY,<br>        opacity: spring.textOpacity,<br>      }}<br>    &gt;<br>      &lt;span&gt;<br>        {text}<br>      &lt;/span&gt;<br>    &lt;/animated.div&gt;<br>  );<br>};<br>const Avatar = ({ index, spring }: { index: number, spring: any }) =&gt; {<br><br>  const getImage = (index: number) =&gt; {<br>    switch (index) {<br>      case 0:<br>        return bubblePerson1;<br>      case 1:<br>        return bubblePerson2;<br>      case 2:<br>        return bubblePerson3;<br>      case 3:<br>        return bubblePerson4;<br>    }<br>  }<br><br>  return (<br>    &lt;animated.div<br>      style={{<br>        y: spring.avatarY,<br>      }}<br>    &gt;<br>      &lt;Image<br>        src={getImage(index)!}<br>        alt={&#39;Bubble person &#39; + index}<br>        width={70}<br>        height={70}<br>        className=&quot;rounded-full w-[70px] h-[70px]&quot;<br>        objectFit=&#39;cover&#39;<br>        placeholder=&#39;blur&#39;<br>      /&gt;<br>    &lt;/animated.div&gt;<br>  );<br>};</pre><pre>const Avatar = ({ index, spring }: { index: number, spring: any }) =&gt; {<br><br>  const getImage = (index: number) =&gt; {<br>    switch (index) {<br>      case 0:<br>        return bubblePerson1;<br>      case 1:<br>        return bubblePerson2;<br>      case 2:<br>        return bubblePerson3;<br>      case 3:<br>        return bubblePerson4;<br>    }<br>  }<br><br>  return (<br>    &lt;animated.div<br>      style={{<br>        y: spring.avatarY,<br>      }}<br>    &gt;<br>      &lt;Image<br>        src={getImage(index)!}<br>        alt={&#39;Bubble person &#39; + index}<br>        width={70}<br>        height={70}<br>        className=&quot;rounded-full w-[70px] h-[70px]&quot;<br>        objectFit=&#39;cover&#39;<br>        placeholder=&#39;blur&#39;<br>      /&gt;<br>    &lt;/animated.div&gt;<br>  );<br>};</pre><h3>Get the animations in a loop with requestAnimationFrame</h3><p>Now that the animations are correctly triggered on click, we want them to be started automatically at intervals… therefore I instinctively thought of setInterval.</p><pre>useEffect(() =&gt; {<br>  const intervalId = setInterval(() =&gt; {<br>    apiStart(api, [0, 1, 2, 3, 4, 5, 6, 7]);<br>  }, 1000);<br><br>  return () =&gt; {<br>    clearInterval(intervalId);<br>  }<br>}, []);</pre><p>I also tried to set custom durations for the avatar and the message separately using useSpring custom loops. Something like:</p><pre>const props = useSpring({<br>    to: async (next) =&gt; {<br>      await new Promise((resolve) =&gt; setTimeout(resolve, delay)); // Initial delay<br><br>      while (true) {<br>        await next({ y: -20, config: { duration: 50 } }); // Move up<br>        await next({ y: 0, config: { duration: 50 } }); // Move down<br>        await new Promise((resolve) =&gt; setTimeout(resolve, totalDuration + delay)); // Pause<br>        await next({ y: -20, config: { duration: individualBubbleDuration / 10 } }); // Move up<br>        await next({ y: 0, config: { duration: individualBubbleDuration / 10 } }); // Move down<br>        await new Promise((resolve) =&gt; setTimeout(resolve, totalDuration - individualBubbleDuration)); // Pause<br>      }<br>    },<br>    from: { y: 0 },<br>    immediate: false,<br>  });</pre><p>…well, it was complicated AND not precise.</p><p>But then, under the influence of <a href="https://blog.webdevsimplified.com/2021-12/request-animation-frame/">this article</a>, I (re)discovered <a href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame">requestAnimationFrame</a> — which appears to be more efficient and flexible, as we will see later on.</p><pre>useLayoutEffect(() =&gt; {<br>  let prevTimestamp: number | null = null;<br>  let animationId: number | null = null;<br><br>  const animate = (timestamp: number) =&gt; {<br>    if (!prevTimestamp) {<br>      prevTimestamp = timestamp;<br>    }<br><br>    const progress = timestamp - prevTimestamp;<br><br>    if (progress &gt; 2000) {<br>      prevTimestamp = timestamp;<br>      apiStart(api, [0, 1, 2, 3, 4, 5, 6, 7])<br>    }<br><br>    animationId = requestAnimationFrame(animate);<br>  };<br><br>  animationId = requestAnimationFrame(animate);<br><br>  return () =&gt; cancelAnimationFrame(animationId!);<br>}, []);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*qpgi8OJ9803tpEOxYxqnGw.gif" /><figcaption>Avatars popping in sync</figcaption></figure><p>We’re not done yet. There are two things we want to guarantee:</p><ol><li>The avatar at the top left pops up first</li><li>Avatars loop at defined intervals</li></ol><p>And to cover both points, we will need two things:</p><ul><li><em>startsAfter</em>: we want to express for each couple avatar+message that they <strong>first pop</strong> after a given time</li><li><em>loopDuration</em>: we want to express for each couple avatar+message that they <strong>loop</strong> after a given time</li></ul><p>At the moment, we will make things simple. Both will be explicit arrays for each couple.</p><pre>const computeStartAfters = () =&gt; {<br>  return AVATARS.map((_, index) =&gt; (index + 1) * 1000);<br>}<br><br>const computeLoopDuration = () =&gt; {<br>  return [2000, 2000, 2000, 2000];<br>}</pre><p>And we need to modify the <em>animate</em> function to take this concept into action. We will need to animate each couple separately.</p><pre>useLayoutEffect(() =&gt; {<br>  animateAtIndex(0, api, startsAfter, loopDurations);<br>  animateAtIndex(1, api, startsAfter, loopDurations);<br>  animateAtIndex(2, api, startsAfter, loopDurations);<br>  animateAtIndex(3, api, startsAfter, loopDurations);<br>}, []);<br><br>const animateAtIndex = (coupleIndex: number, api: any, startsAfter: any, loopDurations: any) =&gt; {<br>  let prevTimestamp: number | null = null;<br>  let animationId: number | null = null;<br>  let hasStarted = false;<br>  const springIndexes = [coupleIndex * 2, coupleIndex * 2 + 1];<br><br>  const animate = (timestamp: number) =&gt; {<br>    if (!prevTimestamp) {<br>      prevTimestamp = timestamp;<br>      hasStarted = false;<br>    }<br><br>    const progress = timestamp - prevTimestamp;<br><br>    if (!hasStarted &amp;&amp; progress &gt; startsAfter[coupleIndex]) {<br>      hasStarted = true;<br>      prevTimestamp = timestamp;<br>      apiStart(api, springIndexes);<br>    } else if (hasStarted &amp;&amp; progress &gt; loopDurations[coupleIndex]) {<br>      prevTimestamp = timestamp;<br>      apiStart(api, springIndexes);<br>    }<br><br>    animationId = requestAnimationFrame(animate);<br>  };<br><br>  animationId = requestAnimationFrame(animate);<br><br>  return () =&gt; cancelAnimationFrame(animationId!);<br>};</pre><p>Plus, we can separate the spring ref from the spring instantiations to avoid having the initial animation on the component mount.</p><pre>const api = useSpringRef();<br>const [springs] = useSprings(AVATARS.length * 2, (index) =&gt; ({<br>  ref: api,<br>  from: from(),<br>  to: to(index),<br>  config: {<br>    duration: duration(index),<br>  },<br>}));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*pUALWMvTQHxw4r_lVnYizw.gif" /><figcaption>Popping avatars looking cool</figcaption></figure><p>It looks fire. Are we done already?</p><p>Not yet — try to unfocus the tab and come back afterward. What’s is going on? The animation weirdly syncs together, like the previous gif “<em>Avatars popping in sync</em>,” i.e., all messages pop simultaneously. Damn.</p><p>😑 Huh — why does it happen in the first place?</p><blockquote>requestAnimationFrame() calls are paused in most browsers when running in background tabs or hidden <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe">&lt;iframe&gt;</a>s in order to improve performance and battery life.<br><br>Source: <a href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame">mdn</a></blockquote><p>I could have anticipated this if I had just read the manual entirely. Head on to the last part to see how you can fix this.</p><h3>Add randomness to the mix</h3><p>Adding randomness to the loop durations was an easy way to fix this. Plus, it adds a friendly vibe to the animation.</p><p>We achieve this by simply modifying <em>computeStartAfters</em> and <em>computeLoopDuration.</em></p><pre>const computeStartAfters = () =&gt; {<br>  return AVATARS.map((_, index) =&gt; Math.random() * 1000 + (index + 1) * 1000);<br>}<br><br>const computeLoopDuration = () =&gt; {<br>  const minDuration = 4000;<br>  return [Math.random() * 2000 + minDuration, Math.random() * 2000 + minDuration, Math.random() * 2000 + minDuration, Math.random() * 2000 + minDuration];<br>}</pre><p>Tadaaam!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*qhyAfHxXBDgDjMNV6tCaCw.gif" /><figcaption>Avatars popping randomly</figcaption></figure><p><strong>🎁 Bonus section </strong>— After completing this work, I was so stoked by the project led by Kino Technologies around the TV show <a href="https://skamwithfriends.com/">SKAM</a>, and the animation skills I practiced with React Spring, that I took a few more days to ship an alternate project: Isak’s phone.</p><p>The idea is to recreate the phone of the main character of the TV show, Isak. Indeed, I needed to use random poppin’ animations — <a href="https://demo-react-spring.vercel.app/isak-phone">Check this out</a>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SmjedUetyIPrT1qU5B12oQ.gif" /><figcaption><a href="https://demo-react-spring.vercel.app/isak-phone">Play with the demo</a></figcaption></figure><p>That’s it. Next up, I will probably write about a better strategy to create a timeline from a video as first dealt with <a href="https://medium.com/p/eb77dda85e58/edit?source=your_stories_page-------------------------------------">here</a>, or write about custom video interactions featured in this landing page in the intro section of this article.</p><p>Tell me in the comments if you prefer one or the other first ️🤷‍♂️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*fZnTykTd932dxGe2j11TiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*10b2dLJ1vYu_Cw1YXr3Ulg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcfbb9ee475" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Technical Investigations: Harnessing Spikes as a Powerful Communication Tool for Teamwork]]></title>
            <link>https://medium.com/@ben_cotte/unlocking-technical-investigations-harnessing-spikes-as-a-powerful-communication-tool-for-teamwork-353e241bfa82?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/353e241bfa82</guid>
            <category><![CDATA[spike]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 15:57:16 GMT</pubDate>
            <atom:updated>2023-08-26T21:16:50.304Z</atom:updated>
            <content:encoded><![CDATA[<p>There exists this time when you talk about stories you want to implement, and the lead engineer in the room shouts appropriately, “Let’s do a POC!”. For coding a lot lately, having your hands dirty is undoubtedly the best way to know the unknown. I’m helping a startup set up its analytics stack, and such a situation arose, which allowed me to dive again into this communication tool called “spike.”</p><p>As often, the legitimate question is whether another communication layer is not overkill and how it dampens your team&#39;s velocity and autonomy. I’d say that it’s more often that the most significant leverage you can build upon is not your team skill but rather how clear the communication is. Communication between product managers and engineers, between engineers, and even for oneself.</p><p>And rather than relying on an additional effort from the engineer leading the “spike,” it might be interesting to use a common tool/framework for presenting the decisions.</p><p>Find below when to use spikes, what they should include, and how they can be integrated into your workflow.</p><h3>Now is the time</h3><p>Heard at a backlog refinement:</p><blockquote>— Hey, we have this EPIC where we’d love to start implementing Segment to track our users’ behaviors. Here is our tracking plan, and we were thinking about splitting it in 5 stories [blablabla], says the Product Manager<br> — Nice, looks clear, but I wonder how Segment could be effectively integrated with our front-end framework. Let’s do a POC!, replies the Engineer</blockquote><p>Typically, you create a spike when there is an important uncertainty on the technical implementation.</p><ul><li>If you have difficulty estimating a user story, you should start a spike instead.</li><li>If you have essential doubts about technical rabbit holes when architecting an EPIC or a bet, you should start a spike.</li></ul><h3>What it should include</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*84TTRhe8_GVzKDmnybk_Ow.png" /><figcaption>Example of a fictional Spike document</figcaption></figure><h3>Lifecycle of a spike</h3><p>A spike is a flow document (vs. stock documents). It serves a single purpose, alleviating uncertainty over a given technical uncertainty.</p><p>As such, their lifecycle can be seen as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*kRgNC_NIUWT6vr8XomvSzg.png" /></figure><p>That’s it — if you have communication difficulties when unlocking technical roadblocks, try spikes 🤷‍♂️</p><p><em>Resources to dig further about spikes: User Stories Applied - Mike Cohn.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*Ih7cdHvvMKvZJfYXoOYkMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*cS_WQB73PQiTfDNGBoSzbw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=353e241bfa82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You don’t have the level not to be focused, mate ]]></title>
            <link>https://medium.com/@ben_cotte/you-dont-have-the-level-not-to-be-focused-mate-453e47070bd0?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/453e47070bd0</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[founders-stories]]></category>
            <category><![CDATA[founders]]></category>
            <category><![CDATA[vertical-networks]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Tue, 14 Feb 2023 15:01:41 GMT</pubDate>
            <atom:updated>2023-02-14T15:58:51.238Z</atom:updated>
            <content:encoded><![CDATA[<pre>T&#39;as pas l&#39;niveau d&#39;pas être focus, mec<br><br>// Vald - Technique</pre><p><strong>Full-send on </strong><a href="https://medium.com/crv-insights/the-next-1b-consumer-startup-will-be-a-vertical-social-network-heres-why-4b4520fb5db1"><strong>vertical networks</strong></a> and other things I learned this year as a bootstrap entrepreneur.</p><h3>One year</h3><p>That’s about one year since I quit my position in Product at Partoo and started working full-time on personal things. Re-reading <a href="https://medium.com/@ben_cotte/back-to-square-one-eff33dc30a77">Back to Square One</a> — my publication about this then-upcoming new era — feels like reading archives from a distant past.</p><p>I forcefully had a new watch at<a href="https://www.loom.com/share/880097b6613e486eb876639518824cf6"> my presentation video</a> to a Discord group we created to support one another with a couple of fellow indie workers. This also felt funny.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2F880097b6613e486eb876639518824cf6&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fshare%2F880097b6613e486eb876639518824cf6&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F880097b6613e486eb876639518824cf6-00001.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1280" height="960" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b9af41bcf73c9b5111f60adfdd427b3/href">https://medium.com/media/2b9af41bcf73c9b5111f60adfdd427b3/href</a></iframe><p>One <strong>simple</strong> thing is clear: I need to focus more.</p><p>Listening to Vald’s album repeatedly, these words kept coming in circles: “T’as pas l’niveau d’pas être focus, mec”.</p><p><strong>What is less simple, though</strong>, is to avoid getting into the same situation in 2023. How do you know you’re losing focus? What are the signs? What is the cost? How to bring that focus back in?</p><h3>Three is too much</h3><p>2022 started with two projects: <a href="http://unbundlingreddit.com/">Unbundling Reddit</a> an on-demand service for subreddit analysis. And <a href="http://www.stokeclub.life/">Stoke Club</a>, a vertical network for surfers.</p><p>In short, Unbundling Reddit was super time-consuming. Computing one report would take hours of manual work. I had no intent to automate it since it was the part creating value. I placed the past reports on Gumroad and only accepted a few new requests here and there. <strong>On the back burner</strong>.</p><p>In between, I grew a sharp passion for a voice-centered project: <a href="http://vero.fm/">vero.fm</a>. Different people hopped in along the way to help out, and we tried to find signals in short experiments. We were particularly efficient at quickly testing it. Especially not over-delivering for once. Signals were not there for the moment. <strong>On the back burner</strong>.</p><p>And finally, Stoke Club. It was and is taking most of my time. Primarily coding, I admit. We have a couple of good practices with Nico, preventing us from losing sight. <strong>But we made critical mistakes</strong>. We considered “this big bag of features” a must-have, and we were like, “we need to deliver until we have 100 users”. That mindset was obviously wrong. We knew how to run experiments diligently, <strong>yet we missed it</strong>.</p><p>I am blaming this on my loss of focus.</p><p>It did not happen on Unbundling Reddit, nor on vero.fm. So maybe, <strong>shared leadership</strong> was a reason. I often blindly trusted Nico without questioning, and he probably did the same.</p><p>Eventually, we reached 100 users sooner than we wanted to, but in doing so, <strong>we lost great opportunities to learn and iterate faster</strong>.</p><h3>Not again</h3><p>How to acknowledge the same situation next time? Here are the signs I am spotting:</p><ul><li>I lose focus when I stop talking to myself in the shower or walking for endless hours at night 😅.</li><li>I lose focus when I am not permanently inspired/kept in my thoughts by one thing.</li><li>Literally, when I am not a driving danger for anyone else.</li></ul><p>That was easy to know that I had lost focus on Stoke Club.</p><p><strong>It reminded me of the time at Partoo</strong> when I needed to be this “code puker” to keep on our early growth — relying on Thibault’s business sense. At the end of the day, that eroded my passion for the project.</p><p>It almost repeated this time. How easy would that be? <em>Code this for five years, and you’ll have another success story.</em> This is not what I want and not what the project needs. Doing so directly impacts my convictions for a project.</p><h3>Onward</h3><p><strong>The good thing</strong> is that we’re not 2014 this time, and there is <a href="https://medium.com/u/d62eaed3f2bc">Nico</a>. Discussing was key to recognizing the situation. We had rich conversations about how we wanted to build things up in the future. He expressed doubts about the current setting. I recognized that pattern above, and that helped us move on.</p><p><strong>I am psyched</strong>. For once, I know what I want to focus on. But more importantly, I know better how to address it efficiently.</p><p>I want to go full-send on the <em>vertical network meets sports </em>rabbit hole. Namely, experimenting at the intersection between a specific hobby &amp; an inclusive experience. And by “specific hobby,” I mean surfing (alright… <em>maybe</em> skateboarding too).</p><p>It took one year. Excited about what this year will bring.</p><p><strong>One last word</strong>. Bootstrapping makes less room for growing work-related relationships. I felt so fortunate to have met great minds. <a href="https://medium.com/u/3b8e7c742fb7">Charlie Sutton</a>, <a href="https://medium.com/u/9de24e255a59">Ryan Goodman</a>, <a href="https://medium.com/u/936b68f23995">Erik Hazzard</a>, <a href="https://medium.com/u/ed2390bbf715">Laura Nunnery</a>, <a href="https://medium.com/u/becd34b7ad5e">Theo Ben Hassen</a>, <a href="https://medium.com/u/6b16bea9e993">Diane Mergui</a>, and the Founder Club 🫶: Thank you for your support!</p><p>I feel passionate about this vertical network thesis, and I would love to meet new people in the app consumer industry. Please, do reach out!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eomX3eYDHIeWsU7OWIa3sA.png" /><figcaption>Another kind of year review: Year in Surf 2022 for the Stoke Club users</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=453e47070bd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Smooth and Interactive Video Timeline with React Native and FFmpeg]]></title>
            <link>https://medium.com/@ben_cotte/creating-a-smooth-and-interactive-video-timeline-with-react-native-and-ffmpeg-8c6624ad90ca?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c6624ad90ca</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ffmpeg]]></category>
            <category><![CDATA[videos]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Fri, 16 Dec 2022 15:57:31 GMT</pubDate>
            <atom:updated>2023-08-26T21:14:58.731Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>TLDR</em></strong><em> — you will learn the following:</em></blockquote><blockquote><em>1️⃣ Install and run ffmpeg in react native projects which work both on Android and iOS.<br>2️⃣ Learn two secret tricks to render the video timeline correctly.<br><br>and you can access the final version of </em><a href="https://github.com/Versus-Skate/VideoTimelineExample"><em>the code on github</em></a><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*fgdhDfShCF1TXqzlUrv-6Q.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*uBL1ghavFz2tqWGB67QoDw.gif" /><figcaption>What you should get with this article — a video which scrubs on scrolling the timeline</figcaption></figure><h3>Why create a video timeline on React Native?</h3><p>In 2020, Nicolas and I were brainstorming ideas to play around with our habit of sending each other short clips of our skateboarding flat-ground tricks over messenger.</p><p>To record these, we usually have to put our phones on the ground and start recording, which results in very long videos with many failed attempts before one successful trick lands. In the end, only the 4 seconds of the landed trick are worth keeping.</p><p>With little to no experience in video editing on mobile, we started completing the first Origami Studio prototype.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*uZojbNHHKhszDZnAjx8Oig.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJg1msU42Mf_5VH36-0-NQ.png" /><figcaption>Demo from the Origami Studio project — these origami files can quickly become hard to read 😅</figcaption></figure><p>The core loop was complete. Once the video is selected, the user can quickly trim the video by placing the selected window around “the pop.” The pop is the moment the board hits the ground.</p><p>We tested the experience on a few skateboarding friends. Still, as time passed, we focused our effort on the <a href="http://www.stokeclub.life/">Stoke Club app</a>… Then came November 2022, when too determined to put this prototype in a usable app, I found some time to create this trimming experience in React Native.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*tN92-spHyFai8Da3qoswrw.gif" /></figure><p>I shared the result on Reddit, hitting the top post of the week, and the comments I had from the community motivated me to write a how-to guide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ca60Hv3aUFlM_l-wdtAWaw.png" /><figcaption><a href="https://www.reddit.com/r/reactnative/comments/z827pr/show_rreactnative_finally_achieved_video_timeline/">Reddit post</a> on r/reactnative</figcaption></figure><h3>What do we want to achieve?</h3><p>Along with the core user loop described in the previous section come some specifications. Namely, the following:</p><ol><li>Given the video is loaded, then we see that the timeline is placed at the start of the duration window.</li><li>Given the video timeline goes out of the duration window, then it bounces back to its borders.</li><li>Given the video is loaded, then the video loops only in the duration window.</li><li>Given the user scrolls the timeline, then the video scrubs to the frame represented on the pop line at the center of the duration window.</li><li>Given the user releases the scroll, then the video plays again, starting from the “pop” line and looping forward.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*8riwrpKXBt0NqKnrZt_GcQ.png" /><figcaption>A bit of naming — to be on the same page</figcaption></figure><p>With this in mind, let’s finally jump into the code.</p><h3>How can I code this?</h3><p>While generating the timeline was easy with Origami Studio, I had little idea of how to implement this within React Native. Until I hear about <a href="https://ffmpeg.org/"><strong>FFmpeg</strong></a>.</p><p>I’ll describe the coding steps below:</p><ol><li>Pre-requisites: React Native &amp; Image picker</li><li>Use FFmpeg in React Native</li><li>Completing the timeline</li></ol><h3>1. Pre-requisites</h3><h4>Start a react native project</h4><pre>npx react-native init VideoTimelineExample</pre><p>Follow the instructions from <a href="https://reactnative.dev/docs/next/environment-setup">react-native documentation</a> on both targets iOS and Android.</p><p>Run on both targets to check if everything is ok.</p><pre>npx react-native run-android<br>npx react-native run-ios</pre><p>You should get the React Native default screens.</p><figure><img alt="React native default project runs on both targets" src="https://cdn-images-1.medium.com/max/1024/1*f0fVXTeKmoXPLkjltSVhZQ.png" /><figcaption>React native default project running on both targets</figcaption></figure><h4>Add image picker</h4><p>To select a video from the library, we will use <a href="https://github.com/ivpusic/react-native-image-crop-picker">RN Image Crop Picker</a>. Follow the installation steps for this library described in <a href="https://github.com/ivpusic/react-native-image-crop-picker#install">their installation section</a>.</p><p>First, make a simple screen with a button in the center by modifying App.js.</p><pre>// App.js<br>import React from &#39;react&#39;;<br>import {SafeAreaView, View, Text, StyleSheet} from &#39;react-native&#39;;<br><br>const App = () =&gt; {<br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      &lt;View style={styles.buttonContainer}&gt;<br>        &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>      &lt;/View&gt;<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>});<br><br>export default App;</pre><p>Then, let’s add the image picker handler to the button. We are going to set a state with minimum video information: URI, fileName, and creationDate.</p><pre>// App.js<br>import React, {useState} from &#39;react&#39;;<br>import {SafeAreaView, Pressable, Text, StyleSheet} from &#39;react-native&#39;;<br><br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(null); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      &lt;Pressable<br>        style={styles.buttonContainer}<br>        onPress={handlePressSelectVideoButton}&gt;<br>        &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>      &lt;/Pressable&gt;<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>});<br><br>export default App;</pre><p>And finally, we will display the selected video so that it loops. For this step, we will use <a href="https://github.com/react-native-video/react-native-video/blob/master/API.md#installation">react-native-video</a>. Follow their installation instructions <a href="https://github.com/react-native-video/react-native-video/blob/master/API.md#installation">in their docs</a>.</p><pre>// App.js<br>import React, {useState} from &#39;react&#39;;<br>import {<br>  SafeAreaView,<br>  Dimensions,<br>  Pressable,<br>  Text,<br>  StyleSheet,<br>  View,<br>} from &#39;react-native&#39;;<br><br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br>import Video from &#39;react-native-video&#39;;<br><br>const SCREEN_WIDTH = Dimensions.get(&#39;screen&#39;).width;<br>const SCREEN_HEIGHT = Dimensions.get(&#39;screen&#39;).height;<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(null); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      {selectedVideo ? (<br>        &lt;View style={styles.videoContainer}&gt;<br>          &lt;Video<br>            style={styles.video}<br>            resizeMode={&#39;cover&#39;}<br>            source={{uri: selectedVideo.uri}}<br>            repeat={true}<br>          /&gt;<br>        &lt;/View&gt;<br>      ) : (<br>        &lt;Pressable<br>          style={styles.buttonContainer}<br>          onPress={handlePressSelectVideoButton}&gt;<br>          &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>  videoContainer: {<br>    width: SCREEN_WIDTH,<br>    height: 0.6 * SCREEN_HEIGHT,<br>    backgroundColor: &#39;rgba(255,255,255,0.1)&#39;,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>    backgroundColor: &#39;green&#39;,<br>  },<br>  video: {<br>    height: &#39;100%&#39;,<br>    width: &#39;100%&#39;,<br>  },<br>});<br><br>export default App;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*E1o5A8ZiCSUM3kwhTMOEFg.gif" /><figcaption>React Native &amp; Image picker working on both devices</figcaption></figure><h3>2. Use FFmpeg in React Native</h3><h4>What is FFmpeg</h4><p>FFmpeg is an open-source software project that provides a complete solution for recording, converting, and streaming audio and video. It is widely used for transcoding multimedia files, allowing users to convert files between different formats and play them on different devices. It also provides a set of libraries and tools that can be used to develop media applications — according to Chat GPT. And this is the last part that is of interest to us. We will use FFmpeg to generate images from a given video, creating the frames for the timeline.</p><h4>Install and test FFmpeg</h4><p>Start by installing ffmpeg-kit-react-native. Refer to <a href="https://github.com/arthenica/ffmpeg-kit/tree/main/react-native">their documentation</a> to install.</p><pre>yarn add ffmpeg-kit-react-native</pre><p>Note: To run it on Android, you must modify the min SDK version to 24 in the build.gradle file, like below:</p><pre>minSdkVersion = 24</pre><p>Now, we will start using FFmpeg by running a command once the video is loaded. Let’s add an <em>handleVideoLoad</em> handler.</p><pre>import React, {useState} from &#39;react&#39;;<br>import {<br>  SafeAreaView,<br>  Dimensions,<br>  Pressable,<br>  Text,<br>  StyleSheet,<br>  View,<br>} from &#39;react-native&#39;;<br><br>import RNFS from &#39;react-native-fs&#39;;<br>import {FFmpegKit, ReturnCode, FFmpegKitConfig} from &#39;ffmpeg-kit-react-native&#39;;<br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br>import Video from &#39;react-native-video&#39;;<br><br>const SCREEN_WIDTH = Dimensions.get(&#39;screen&#39;).width;<br>const SCREEN_HEIGHT = Dimensions.get(&#39;screen&#39;).height;<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(null); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  const handleVideoLoad = () =&gt; {<br>    let outputImagePath = `${RNFS.CachesDirectoryPath}/${selectedVideo.localFileName}.mp4`;<br>    FFmpegKit.execute(<br>      `-i ${selectedVideo.uri} -c:v mpeg4 ${outputImagePath}`,<br>    ).then(async session =&gt; {<br>      const state = FFmpegKitConfig.sessionStateToString(<br>        await session.getState(),<br>      );<br>      const returnCode = await session.getReturnCode();<br>      const failStackTrace = await session.getFailStackTrace();<br>      const duration = await session.getDuration();<br><br>      if (ReturnCode.isSuccess(returnCode)) {<br>        console.log(<br>          `Encode completed successfully in ${duration} milliseconds;`,<br>        );<br>      } else if (ReturnCode.isCancel(returnCode)) {<br>        console.log(&#39;Encode canceled&#39;);<br>      } else {<br>        console.log(<br>          `Encode failed with state ${state} and rc ${returnCode}.${<br>            (failStackTrace, &#39;\\n&#39;)<br>          }`,<br>        );<br>      }<br>    });<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      {selectedVideo ? (<br>        &lt;View style={styles.videoContainer}&gt;<br>          &lt;Video<br>            style={styles.video}<br>            resizeMode={&#39;cover&#39;}<br>            source={{uri: selectedVideo.uri}}<br>            repeat={true}<br>            onLoad={handleVideoLoad}<br>          /&gt;<br>        &lt;/View&gt;<br>      ) : (<br>        &lt;Pressable<br>          style={styles.buttonContainer}<br>          onPress={handlePressSelectVideoButton}&gt;<br>          &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>  videoContainer: {<br>    width: SCREEN_WIDTH,<br>    height: 0.6 * SCREEN_HEIGHT,<br>    backgroundColor: &#39;rgba(255,255,255,0.1)&#39;,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>    backgroundColor: &#39;green&#39;,<br>  },<br>  video: {<br>    height: &#39;100%&#39;,<br>    width: &#39;100%&#39;,<br>  },<br>});<br><br>export default App;</pre><p>Look at <em>handleVideoLoad. </em>We use an FFmpeg command, the one given in the lib documentation, to check if everything runs appropriately on both targets. And it should!</p><p>Let’s mention that we use <a href="https://github.com/itinance/react-native-fs">react-native-fs</a> to handle the file system part. Be sure to install it.</p><p>Once you pick a video, it runs the command, and you should get the following log:</p><pre>Encode completed successfully in XXXX milliseconds;</pre><p>Now, we have our first FFmpeg command working in React Native! Voilà! The one we used above is only copying the video file elsewhere. By the way, you can check it by opening the path given by the logs:</p><pre> LOG  Output #0, mp4, to &#39;/data/user/0/com.videotimelineexample/cache/RPReplay_Final1668803007.mp4&#39;:</pre><p>For our timeline, we want to generate one image from the video per second. To do this, we need to modify the FFmpeg command. You can see the extra-long <a href="https://ffmpeg.org/ffmpeg.html">FFmpeg documentation</a> to check all the parameters available. In our case, we will use the following command:</p><pre>-ss 0 -i ${videoURI} -vf &quot;fps=${FRAME_PER_SEC}/1:round=up,scale=${FRAME_WIDTH}:-2&quot; -vframes ${frameNumber} ${outputImagePath}</pre><p>Some explanations about the above command:</p><ul><li>-ss: starts at second 0</li><li>-i: URI of the input file</li><li>-vf: video filters. We only need one frame per second in our case, so <strong>FRAME_PER_SEC</strong> is set to 1. About <em>scale, </em>we only need a small size for our timeline. It will be 40px wide, so we can make <strong>FRAME_WIDTH</strong> set to 80 so that we handle 2x resolution screens.</li><li>-vframes: number of frames we want. We know that we only need one frame per second. So we will base it on the video duration.</li></ul><p>We want to extract the code about FFmpeg into a static class to separate the concerns.</p><pre>// lib/FFmpeg.js<br>import {FFmpegKit, FFmpegKitConfig, ReturnCode} from &#39;ffmpeg-kit-react-native&#39;;<br>import RNFS from &#39;react-native-fs&#39;;<br><br>import {<br>  FRAME_PER_SEC,<br>  FRAME_WIDTH,<br>} from &#39;../App.js&#39;;<br><br>class FFmpegWrapper {<br>  static getFrames(<br>    localFileName,<br>    videoURI,<br>    frameNumber,<br>    successCallback,<br>    errorCallback,<br>  ) {<br>    let outputImagePath = `${RNFS.CachesDirectoryPath}/${localFileName}_%4d.png`;<br>    const ffmpegCommand = `-ss 0 -i ${videoURI} -vf &quot;fps=${FRAME_PER_SEC}/1:round=up,scale=${FRAME_WIDTH}:-2&quot; -vframes ${frameNumber} ${outputImagePath}`;<br><br>    FFmpegKit.executeAsync(<br>      ffmpegCommand,<br>      async session =&gt; {<br>        const state = FFmpegKitConfig.sessionStateToString(<br>          await session.getState(),<br>        );<br>        const returnCode = await session.getReturnCode();<br>        const failStackTrace = await session.getFailStackTrace();<br>        const duration = await session.getDuration();<br><br>        if (ReturnCode.isSuccess(returnCode)) {<br>          console.log(<br>            `Encode completed successfully in ${duration} milliseconds;.`,<br>          );<br>          console.log(`Check at ${outputImagePath}`);<br>          successCallback(outputImagePath);<br>        } else {<br>          console.log(&#39;Encode failed. Please check log for the details.&#39;);<br>          console.log(<br>            `Encode failed with state ${state} and rc ${returnCode}.${<br>              (failStackTrace, &#39;\\n&#39;)<br>            }`,<br>          );<br>          errorCallback();<br>        }<br>      },<br>      log =&gt; {<br>        console.log(log.getMessage());<br>      },<br>      statistics =&gt; {<br>        console.log(statistics);<br>      },<br>    ).then(session =&gt;<br>      console.log(<br>        `Async FFmpeg process started with sessionId ${session.getSessionId()}.`,<br>      ),<br>    );<br>  }<br>}<br><br>export default FFmpegWrapper;</pre><p>About the <em>outputFilePath, </em>you see that we are using a specific notation:</p><pre>${RNFS.CachesDirectoryPath}/${localFileName}_%4d.png</pre><p>Note the %4d — it enables us to suffix our generated image with a number automatically incremented containing four digits.</p><p>And we can simplify <strong>App.js</strong> by modifying <em>handleVideoLoad</em>:</p><pre>// in App.js<br><br>  const handleVideoLoad = videoAssetLoaded =&gt; {<br>    const numberOfFrames = Math.ceil(videoAssetLoaded.duration);<br>    FFmpegWrapper.getFrames(<br>      selectedVideo.localFileName,<br>      selectedVideo.uri,<br>      numberOfFrames,<br>      filePath =&gt; {<br>        console.log(&#39;Empty success callback&#39;);<br>      },<br>    );<br>  };</pre><p>At this point, you also need to add two constants to <strong>App.js</strong>:</p><pre>export const FRAME_PER_SEC = 1;<br>export const FRAME_WIDTH = 80;</pre><p>Let’s select a video again and see the result in the logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwiJwLsaptQoCkTtXT-mAg.png" /><figcaption>With a 9 sec video, we get 10 frames -&gt; perfect!</figcaption></figure><p>Nice, we have our images generated. FFmpeg does exactly what we want. Let’s see how we integrate the frames to complete the timeline component.</p><h3>3. Completing the timeline</h3><p>Completing the timeline means three things:</p><ul><li>Displaying the frames,</li><li>Adding the duration window,</li><li>Handling events on the timeline — like the interactions with the video selected.</li></ul><h4>Displaying the frames</h4><p>For displaying the frames, we will make use of the success callback left empty. We add a state variable <strong>frames</strong>, which will be filled with loading items when the FFmpeg computes the images and will display once done.</p><p>To do so, modify <strong>handleVideoLoad :</strong></p><pre>  const handleOnLoad = videoAssetLoaded =&gt; {<br><br>    const numberOfFrames = Math.ceil(videoAssetLoaded.duration);<br>    setFrames(<br>      Array(numberOfFrames).fill({<br>        status: FRAME_STATUS.LOADING.name.description,<br>      }),<br>    );<br><br>    FFmpegWrapper.getFrames(<br>      selectedVideo.localFileName,<br>      selectedVideo.uri,<br>      numberOfFrames,<br>      filePath =&gt; {<br>        const _frames = [];<br>        for (let i = 0; i &lt; numberOfFrames; i++) {<br>          _frames.push(<br>            `${filePath.replace(&#39;%4d&#39;, String(i + 1).padStart(4, 0))}.png`,<br>          );<br>        }<br>        setFrames(_frames);<br>      },<br>    );<br>  };</pre><p>You will need to set <strong>FRAME_STATUS</strong> like below:</p><pre>const FRAME_STATUS = Object.freeze({<br>  LOADING: {name: Symbol(&#39;LOADING&#39;)},<br>  READY: {name: Symbol(&#39;READY&#39;)},<br>});</pre><p>Which gives a complete <strong>App.js </strong>file like the one below:</p><pre>// App.js<br>import React, {useState} from &#39;react&#39;;<br>import {<br>  SafeAreaView,<br>  Dimensions,<br>  Pressable,<br>  Text,<br>  StyleSheet,<br>  View,<br>} from &#39;react-native&#39;;<br><br>import RNFS from &#39;react-native-fs&#39;;<br>import {FFmpegKit, ReturnCode, FFmpegKitConfig} from &#39;ffmpeg-kit-react-native&#39;;<br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br>import Video from &#39;react-native-video&#39;;<br>import FFmpegWrapper from &#39;./lib/FFmpeg&#39;;<br><br>const SCREEN_WIDTH = Dimensions.get(&#39;screen&#39;).width;<br>const SCREEN_HEIGHT = Dimensions.get(&#39;screen&#39;).height;<br>export const FRAME_PER_SEC = 1;<br>export const FRAME_WIDTH = 80;<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const FRAME_STATUS = Object.freeze({<br>  LOADING: {name: Symbol(&#39;LOADING&#39;)},<br>  READY: {name: Symbol(&#39;READY&#39;)},<br>});<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br>  const [frames, setFrames] = useState(); // &lt;[{status: &lt;FRAME_STATUS&gt;}]&gt;<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  const handleVideoLoad = videoAssetLoaded =&gt; {<br>    const numberOfFrames = Math.ceil(videoAssetLoaded.duration);<br>    setFrames(<br>      Array(numberOfFrames).fill({<br>        status: FRAME_STATUS.LOADING.name.description,<br>      }),<br>    );<br><br>    FFmpegWrapper.getFrames(<br>      selectedVideo.localFileName,<br>      selectedVideo.uri,<br>      numberOfFrames,<br>      filePath =&gt; {<br>        const _frames = [];<br>        for (let i = 0; i &lt; numberOfFrames; i++) {<br>          _frames.push(<br>            `${filePath.replace(&#39;%4d&#39;, String(i + 1).padStart(4, 0))}.png`,<br>          );<br>        }<br>        setFrames(_frames);<br>      },<br>    );<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      {selectedVideo ? (<br>        &lt;View style={styles.videoContainer}&gt;<br>          &lt;Video<br>            style={styles.video}<br>            resizeMode={&#39;cover&#39;}<br>            source={{uri: selectedVideo.uri}}<br>            repeat={true}<br>            onLoad={handleVideoLoad}<br>          /&gt;<br>        &lt;/View&gt;<br>      ) : (<br>        &lt;Pressable<br>          style={styles.buttonContainer}<br>          onPress={handlePressSelectVideoButton}&gt;<br>          &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>  videoContainer: {<br>    width: SCREEN_WIDTH,<br>    height: 0.6 * SCREEN_HEIGHT,<br>    backgroundColor: &#39;rgba(255,255,255,0.1)&#39;,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>    backgroundColor: &#39;green&#39;,<br>  },<br>  video: {<br>    height: &#39;100%&#39;,<br>    width: &#39;100%&#39;,<br>  },<br>});<br><br>export default App;</pre><p>We will use a <strong>ScrollView </strong>to display the frames placed under the video container:</p><pre>&lt;ScrollView<br>  showsHorizontalScrollIndicator={false}<br>  horizontal={true}<br>  style={styles.framesLine}<br>  alwaysBounceHorizontal={true}<br>  scrollEventThrottle={1}<br>&gt;<br><br>  {frames.map((frame, index) =&gt; {<br>    if (frame.status === FRAME_STATUS.LOADING.name.description) {<br>      return &lt;View style={styles.loadingFrame} key={index}&gt;&lt;/View&gt;;<br>    } else {<br>      return (<br>        &lt;Image<br>          key={index}<br>          source={{<br>            uri: &#39;file://&#39; + frame,<br>          }}<br>          style={{<br>            width: TILE_WIDTH,<br>            height: TILE_HEIGHT,<br>          }}<br>        /&gt;<br>      );<br>    }<br>  })}<br><br>&lt;/ScrollView&gt;</pre><p>Also, we will isolate the rendering of the frames in a <strong>renderFrame</strong> function.</p><p>Below is the complete App.js file with the correct styling:</p><pre>// App.js<br>import React, {useState} from &#39;react&#39;;<br>import {<br>  SafeAreaView,<br>  Dimensions,<br>  Pressable,<br>  Text,<br>  StyleSheet,<br>  View,<br>  ScrollView,<br>  Image,<br>} from &#39;react-native&#39;;<br><br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br>import Video from &#39;react-native-video&#39;;<br>import FFmpegWrapper from &#39;./lib/FFmpeg&#39;;<br><br>const SCREEN_WIDTH = Dimensions.get(&#39;screen&#39;).width;<br>const SCREEN_HEIGHT = Dimensions.get(&#39;screen&#39;).height;<br>export const FRAME_PER_SEC = 1;<br>export const FRAME_WIDTH = 80;<br>const TILE_HEIGHT = 80;<br>const TILE_WIDTH = FRAME_WIDTH / 2; // to get a 2x resolution<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const FRAME_STATUS = Object.freeze({<br>  LOADING: {name: Symbol(&#39;LOADING&#39;)},<br>  READY: {name: Symbol(&#39;READY&#39;)},<br>});<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br>  const [frames, setFrames] = useState(); // &lt;[{status: &lt;FRAME_STATUS&gt;}]&gt;<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  const handleVideoLoad = videoAssetLoaded =&gt; {<br>    const numberOfFrames = Math.ceil(videoAssetLoaded.duration);<br>    setFrames(<br>      Array(numberOfFrames).fill({<br>        status: FRAME_STATUS.LOADING.name.description,<br>      }),<br>    );<br><br>    FFmpegWrapper.getFrames(<br>      selectedVideo.localFileName,<br>      selectedVideo.uri,<br>      numberOfFrames,<br>      filePath =&gt; {<br>        const _frames = [];<br>        for (let i = 0; i &lt; numberOfFrames; i++) {<br>          _frames.push(<br>            `${filePath.replace(&#39;%4d&#39;, String(i + 1).padStart(4, 0))}.png`,<br>          );<br>        }<br>        setFrames(_frames);<br>      },<br>    );<br>  };<br><br>  const renderFrame = (frame, index) =&gt; {<br>    if (frame.status === FRAME_STATUS.LOADING.name.description) {<br>      return &lt;View style={styles.loadingFrame} key={index}&gt;&lt;/View&gt;;<br>    } else {<br>      return (<br>        &lt;Image<br>          key={index}<br>          source={{<br>            uri: &#39;file://&#39; + frame,<br>          }}<br>          style={{<br>            width: TILE_WIDTH,<br>            height: TILE_HEIGHT,<br>          }}<br>        /&gt;<br>      );<br>    }<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      {selectedVideo ? (<br>        &lt;&gt;<br>          &lt;View style={styles.videoContainer}&gt;<br>            &lt;Video<br>              style={styles.video}<br>              resizeMode={&#39;cover&#39;}<br>              source={{uri: selectedVideo.uri}}<br>              repeat={true}<br>              onLoad={handleVideoLoad}<br>            /&gt;<br>          &lt;/View&gt;<br>          {frames &amp;&amp; (<br>            &lt;ScrollView<br>              showsHorizontalScrollIndicator={false}<br>              horizontal={true}<br>              style={styles.framesLine}<br>              alwaysBounceHorizontal={true}<br>              scrollEventThrottle={1}&gt;<br>              {frames.map((frame, index) =&gt; renderFrame(frame, index))}<br>            &lt;/ScrollView&gt;<br>          )}<br>        &lt;/&gt;<br>      ) : (<br>        &lt;Pressable<br>          style={styles.buttonContainer}<br>          onPress={handlePressSelectVideoButton}&gt;<br>          &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>  videoContainer: {<br>    width: SCREEN_WIDTH,<br>    height: 0.6 * SCREEN_HEIGHT,<br>    backgroundColor: &#39;rgba(255,255,255,0.1)&#39;,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  video: {<br>    height: &#39;100%&#39;,<br>    width: &#39;100%&#39;,<br>  },<br>  framesLine: {<br>    width: SCREEN_WIDTH,<br>  },<br>  loadingFrame: {<br>    width: TILE_WIDTH,<br>    height: TILE_HEIGHT,<br>    backgroundColor: &#39;rgba(0,0,0,0.05)&#39;,<br>    borderColor: &#39;rgba(0,0,0,0.1)&#39;,<br>    borderWidth: 1,<br>  },<br>});<br><br>export default App;</pre><h4>Adding the duration window</h4><p>The duration window is this yellow component. It lies on top of the timeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*4oiHOeJ16DOUgaPvQgsigg.png" /></figure><p>Nothing complicated about showing this component along with the ‘pop line’, see below:</p><pre>// ...<br><br>export const FRAME_PER_SEC = 1;<br>export const FRAME_WIDTH = 80;<br>const TILE_HEIGHT = 80;<br>const TILE_WIDTH = FRAME_WIDTH / 2; // to get a 2x resolution<br><br>const DURATION_WINDOW_DURATION = 4;<br>const DURATION_WINDOW_BORDER_WIDTH = 4;<br>const DURATION_WINDOW_WIDTH =<br>  DURATION_WINDOW_DURATION * FRAME_PER_SEC * TILE_WIDTH;<br>const POPLINE_POSITION = &#39;50%&#39;;<br><br>// ...<br><br>const App = () =&gt; {<br><br>  // ...<br><br>          {frames &amp;&amp; (<br>            &lt;View style={styles.durationWindowAndFramesLineContainer}&gt;<br>              &lt;View style={styles.durationWindow}&gt;<br>                &lt;View style={styles.durationLabelContainer}&gt;<br>                  &lt;Text style={styles.durationLabel}&gt;<br>                    {DURATION_WINDOW_DURATION} sec.<br>                  &lt;/Text&gt;<br>                &lt;/View&gt;<br>              &lt;/View&gt;<br>              &lt;View style={styles.popLineContainer}&gt;<br>                &lt;View style={styles.popLine} /&gt;<br>              &lt;/View&gt;<br>              &lt;ScrollView<br>                showsHorizontalScrollIndicator={false}<br>                horizontal={true}<br>                style={styles.framesLine}<br>                alwaysBounceHorizontal={true}<br>                scrollEventThrottle={1}&gt;<br>                {frames.map((frame, index) =&gt; renderFrame(frame, index))}<br>              &lt;/ScrollView&gt;<br>            &lt;/View&gt;<br>          )}<br> <br>  // ...<br>};<br><br>const styles = StyleSheet.create({<br><br>  // ...<br><br>  durationWindowAndFramesLineContainer: {<br>    top: -DURATION_WINDOW_BORDER_WIDTH,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  durationWindow: {<br>    width: DURATION_WINDOW_WIDTH,<br>    borderColor: &#39;yellow&#39;,<br>    borderWidth: DURATION_WINDOW_BORDER_WIDTH,<br>    borderRadius: 4,<br>    height: TILE_HEIGHT,<br>    alignSelf: &#39;center&#39;,<br>    zIndex: 25,<br>  },<br>  durationLabelContainer: {<br>    backgroundColor: &#39;yellow&#39;,<br>    alignSelf: &#39;center&#39;,<br>    top: -26,<br>    paddingHorizontal: 8,<br>    paddingVertical: 4,<br>    borderTopLeftRadius: 4,<br>    borderTopRightRadius: 4,<br>  },<br>  durationLabel: {<br>    color: &#39;rgba(0,0,0,0.6)&#39;,<br>    fontWeight: &#39;700&#39;,<br>  },<br>  popLineContainer: {<br>    position: &#39;absolute&#39;,<br>    alignSelf: POPLINE_POSITION === &#39;50%&#39; &amp;&amp; &#39;center&#39;, // otherwise raise Error(&quot;Not implemented&quot;),<br>    zIndex: 25,<br>  },<br>  popLine: {<br>    width: 3,<br>    height: TILE_HEIGHT,<br>    backgroundColor: &#39;yellow&#39;,<br>  },<br>});</pre><p>⚠️ But, we have two problems:</p><ol><li>We can’t scroll the timeline to the left — it bounces back immediately.</li><li>We can’t scroll when touching on the duration window.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*4GpKM2z78L_f-hxhMGQv1w.gif" /><figcaption>2 problems — can’t go left and does not capture scroll on top of the duration window</figcaption></figure><blockquote>🤫 Find below the 2 tricks to cope with these problems</blockquote><p><strong>For problem 1</strong>, the trick is to prepend an element of a given width (half the screen minus half the duration window). And to append a similar one.</p><p>In other words, you should consider your frames like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*ZkOlrvDk5TUJoVVYq1qYEQ.png" /></figure><p><strong>For problem 2</strong>, the trick is to place the duration window below the timeline and to <strong>only add “borders elements”</strong> on top of the frames line. Now that the duration window is behind, we also need to add a little bit to its height.</p><p>Finally, to get the proper rendering on both Android and iOS, we will need to be careful about z positions — let’s set arbitrarily the following ones:</p><ul><li>For the video — videoContainer: zIndex to 0</li><li>For the duration window — durationWindowAndFramesLineContainer: zIndex to 10</li><li>For anything we want above the timeline, i.e the 2 duration window borders and the popline — poplineContainer, durationWindowLeftBorder, durationWindowRightBorder: zIndex to25</li></ul><pre>&lt;View style={styles.durationWindowLeftBorder}/&gt;<br>&lt;View style={styles.durationWindowRightBorder}/&gt;<br>// in styles...<br>  durationWindowLeftBorder: {<br>    position: &#39;absolute&#39;,<br>    width: DURATION_WINDOW_BORDER_WIDTH,<br>    alignSelf: &#39;center&#39;,<br>    height: TILE_HEIGHT,<br>    left: SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>    borderTopLeftRadius: 8,<br>    borderBottomLeftRadius: 8,<br>    backgroundColor: &#39;#FFED50&#39;,<br>    zIndex: 25,<br>  },<br>  durationWindowRightBorder: {<br>    position: &#39;absolute&#39;,<br>    width: DURATION_WINDOW_BORDER_WIDTH,<br>    right: SCREEN_WIDTH - SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    borderTopRightRadius: 8,<br>    borderBottomRightRadius: 8,<br>    backgroundColor: &#39;#FFED50&#39;,<br>    zIndex: 25,<br>  },</pre><p><em>Note: we will also need to remove centering of items in the videoContainer class.</em></p><p>This leads us to the following complete code below:</p><pre>// App.js<br>import React, {useState} from &#39;react&#39;;<br>import {<br>  SafeAreaView,<br>  Dimensions,<br>  Pressable,<br>  Text,<br>  StyleSheet,<br>  View,<br>  ScrollView,<br>  Image,<br>} from &#39;react-native&#39;;<br><br>import ImagePicker from &#39;react-native-image-crop-picker&#39;;<br>import Video from &#39;react-native-video&#39;;<br>import FFmpegWrapper from &#39;./lib/FFmpeg&#39;;<br><br>const SCREEN_WIDTH = Dimensions.get(&#39;screen&#39;).width;<br>const SCREEN_HEIGHT = Dimensions.get(&#39;screen&#39;).height;<br>export const FRAME_PER_SEC = 1;<br>export const FRAME_WIDTH = 80;<br>const TILE_HEIGHT = 80;<br>const TILE_WIDTH = FRAME_WIDTH / 2; // to get a 2x resolution<br><br>const DURATION_WINDOW_DURATION = 4;<br>const DURATION_WINDOW_BORDER_WIDTH = 4;<br>const DURATION_WINDOW_WIDTH =<br>  DURATION_WINDOW_DURATION * FRAME_PER_SEC * TILE_WIDTH;<br>const POPLINE_POSITION = &#39;50%&#39;;<br><br>const getFileNameFromPath = path =&gt; {<br>  const fragments = path.split(&#39;/&#39;);<br>  let fileName = fragments[fragments.length - 1];<br>  fileName = fileName.split(&#39;.&#39;)[0];<br>  return fileName;<br>};<br><br>const FRAME_STATUS = Object.freeze({<br>  LOADING: {name: Symbol(&#39;LOADING&#39;)},<br>  READY: {name: Symbol(&#39;READY&#39;)},<br>});<br><br>const App = () =&gt; {<br>  const [selectedVideo, setSelectedVideo] = useState(); // {uri: &lt;string&gt;, localFileName: &lt;string&gt;, creationDate: &lt;Date&gt;}<br>  const [frames, setFrames] = useState(); // &lt;[{status: &lt;FRAME_STATUS&gt;, uri: &lt;string&gt;}]&gt;<br><br>  const handlePressSelectVideoButton = () =&gt; {<br>    ImagePicker.openPicker({<br>      mediaType: &#39;video&#39;,<br>    }).then(videoAsset =&gt; {<br>      console.log(`Selected video ${JSON.stringify(videoAsset, null, 2)}`);<br>      setSelectedVideo({<br>        uri: videoAsset.sourceURL || videoAsset.path,<br>        localFileName: getFileNameFromPath(videoAsset.path),<br>        creationDate: videoAsset.creationDate,<br>      });<br>    });<br>  };<br><br>  const handleVideoLoad = videoAssetLoaded =&gt; {<br>    const numberOfFrames = Math.ceil(videoAssetLoaded.duration);<br>    setFrames(<br>      Array(numberOfFrames).fill({<br>        status: FRAME_STATUS.LOADING.name.description,<br>      }),<br>    );<br><br>    FFmpegWrapper.getFrames(<br>      selectedVideo.localFileName,<br>      selectedVideo.uri,<br>      numberOfFrames,<br>      filePath =&gt; {<br>        const _framesURI = [];<br>        for (let i = 0; i &lt; numberOfFrames; i++) {<br>          _framesURI.push(<br>            `${filePath.replace(&#39;%4d&#39;, String(i + 1).padStart(4, 0))}`,<br>          );<br>        }<br>        const _frames = _framesURI.map(_frameURI =&gt; ({<br>          uri: _frameURI,<br>          status: FRAME_STATUS.READY.name.description,<br>        }));<br>        setFrames(_frames);<br>      },<br>    );<br>  };<br><br>  const renderFrame = (frame, index) =&gt; {<br>    if (frame.status === FRAME_STATUS.LOADING.name.description) {<br>      return &lt;View style={styles.loadingFrame} key={index} /&gt;;<br>    } else {<br>      return (<br>        &lt;Image<br>          key={index}<br>          source={{uri: &#39;file://&#39; + frame.uri}}<br>          style={{<br>            width: TILE_WIDTH,<br>            height: TILE_HEIGHT,<br>          }}<br>          onLoad={() =&gt; {<br>            console.log(&#39;Image loaded&#39;);<br>          }}<br>        /&gt;<br>      );<br>    }<br>  };<br><br>  return (<br>    &lt;SafeAreaView style={styles.mainContainer}&gt;<br>      {selectedVideo ? (<br>        &lt;&gt;<br>          &lt;View style={styles.videoContainer}&gt;<br>            &lt;Video<br>              style={styles.video}<br>              resizeMode={&#39;cover&#39;}<br>              source={{uri: selectedVideo.uri}}<br>              repeat={true}<br>              onLoad={handleVideoLoad}<br>            /&gt;<br>          &lt;/View&gt;<br>          {frames &amp;&amp; (<br>            &lt;View style={styles.durationWindowAndFramesLineContainer}&gt;<br>              &lt;View style={styles.durationWindow}&gt;<br>                &lt;View style={styles.durationLabelContainer}&gt;<br>                  &lt;Text style={styles.durationLabel}&gt;<br>                    {DURATION_WINDOW_DURATION} sec.<br>                  &lt;/Text&gt;<br>                &lt;/View&gt;<br>              &lt;/View&gt;<br>              &lt;View style={styles.popLineContainer}&gt;<br>                &lt;View style={styles.popLine} /&gt;<br>              &lt;/View&gt;<br>              &lt;View style={styles.durationWindowLeftBorder} /&gt;<br>              &lt;View style={styles.durationWindowRightBorder} /&gt;<br>              &lt;ScrollView<br>                showsHorizontalScrollIndicator={false}<br>                horizontal={true}<br>                style={styles.framesLine}<br>                alwaysBounceHorizontal={true}<br>                scrollEventThrottle={1}&gt;<br>                &lt;View style={styles.prependFrame} /&gt;<br>                {frames.map((frame, index) =&gt; renderFrame(frame, index))}<br>                &lt;View style={styles.appendFrame} /&gt;<br>              &lt;/ScrollView&gt;<br>            &lt;/View&gt;<br>          )}<br>        &lt;/&gt;<br>      ) : (<br>        &lt;Pressable<br>          style={styles.buttonContainer}<br>          onPress={handlePressSelectVideoButton}&gt;<br>          &lt;Text style={styles.buttonText}&gt;Select a video&lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/SafeAreaView&gt;<br>  );<br>};<br><br>const styles = StyleSheet.create({<br>  mainContainer: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  buttonContainer: {<br>    backgroundColor: &#39;#000&#39;,<br>    paddingVertical: 12,<br>    paddingHorizontal: 32,<br>    borderRadius: 16,<br>  },<br>  buttonText: {<br>    color: &#39;#fff&#39;,<br>  },<br>  videoContainer: {<br>    width: SCREEN_WIDTH,<br>    height: 0.6 * SCREEN_HEIGHT,<br>    backgroundColor: &#39;rgba(255,255,255,0.1)&#39;,<br>    zIndex: 0,<br>  },<br>  video: {<br>    height: &#39;100%&#39;,<br>    width: &#39;100%&#39;,<br>  },<br>  durationWindowAndFramesLineContainer: {<br>    top: -DURATION_WINDOW_BORDER_WIDTH,<br>    width: SCREEN_WIDTH,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    justifyContent: &#39;center&#39;,<br>    zIndex: 10,<br>  },<br>  durationWindow: {<br>    width: DURATION_WINDOW_WIDTH,<br>    borderColor: &#39;yellow&#39;,<br>    borderWidth: DURATION_WINDOW_BORDER_WIDTH,<br>    borderRadius: 4,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    alignSelf: &#39;center&#39;,<br>  },<br>  durationLabelContainer: {<br>    backgroundColor: &#39;yellow&#39;,<br>    alignSelf: &#39;center&#39;,<br>    top: -26,<br>    paddingHorizontal: 8,<br>    paddingVertical: 4,<br>    borderTopLeftRadius: 4,<br>    borderTopRightRadius: 4,<br>  },<br>  durationLabel: {<br>    color: &#39;rgba(0,0,0,0.6)&#39;,<br>    fontWeight: &#39;700&#39;,<br>  },<br>  popLineContainer: {<br>    position: &#39;absolute&#39;,<br>    alignSelf: POPLINE_POSITION === &#39;50%&#39; &amp;&amp; &#39;center&#39;,<br>    zIndex: 25,<br>  },<br>  popLine: {<br>    width: 3,<br>    height: TILE_HEIGHT,<br>    backgroundColor: &#39;yellow&#39;,<br>  },<br>  durationWindowLeftBorder: {<br>    position: &#39;absolute&#39;,<br>    width: DURATION_WINDOW_BORDER_WIDTH,<br>    alignSelf: &#39;center&#39;,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    left: SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>    borderTopLeftRadius: 8,<br>    borderBottomLeftRadius: 8,<br>    backgroundColor: &#39;yellow&#39;,<br>    zIndex: 25,<br>  },<br>  durationWindowRightBorder: {<br>    position: &#39;absolute&#39;,<br>    width: DURATION_WINDOW_BORDER_WIDTH,<br>    right: SCREEN_WIDTH - SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>    height: TILE_HEIGHT + DURATION_WINDOW_BORDER_WIDTH * 2,<br>    borderTopRightRadius: 8,<br>    borderBottomRightRadius: 8,<br>    backgroundColor: &#39;yellow&#39;,<br>    zIndex: 25,<br>  },<br>  framesLine: {<br>    width: SCREEN_WIDTH,<br>    position: &#39;absolute&#39;,<br>  },<br>  loadingFrame: {<br>    width: TILE_WIDTH,<br>    height: TILE_HEIGHT,<br>    backgroundColor: &#39;rgba(0,0,0,0.05)&#39;,<br>    borderColor: &#39;rgba(0,0,0,0.1)&#39;,<br>    borderWidth: 1,<br>  },<br>  prependFrame: {<br>    width: SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>  },<br>  appendFrame: {<br>    width: SCREEN_WIDTH / 2 - DURATION_WINDOW_WIDTH / 2,<br>  },<br>});<br><br>export default App;<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*YLeF1dv9QMI6mJT7qadGiA.gif" /><figcaption>The timeline is complete!</figcaption></figure><p>Perfect, let’s now focus on interactions between the timeline and the video.</p><h4>Interacting with the timeline</h4><p>If we get back to our specifications, we still have to complete the ones dealing with video interactions:</p><ol><li>✅ Given the video is loaded, then we see that the timeline is placed at the start of the duration window.</li><li>✅ Given the video timeline goes out of the duration window, then it bounces back to its borders.</li><li>Given the video is loaded, then the video loops only in the duration window.</li><li>Given the user scrolls the timeline, then the video scrubs to the frame represented on the pop line at the center of the duration window.</li><li>Given the user releases the scroll, then the video plays again, starting from the “pop” line and looping forward.</li></ol><p><strong>For spec 3</strong> — we need to check the current video time. When this current time is over the time represented at the right border, then we need to seek the video back to the time represented at the left border. So first, we will need 3 things: one event handler which keeps the offset of the timeline updated in the state, and two functions that gives the time represented at the borders given this offset.</p><pre>const handleOnScroll = ({nativeEvent}) =&gt; {<br>  setFramesLineOffset(nativeEvent.contentOffset.x);<br>};</pre><pre>const getLeftLinePlayTime = offset =&gt; {<br>  return offset / (FRAME_PER_SEC * TILE_WIDTH);<br>};<br>const getRightLinePlayTime = offset =&gt; {<br>  return (offset + DURATION_WINDOW_WIDTH) / (FRAME_PER_SEC * TILE_WIDTH);<br>};</pre><p>We use them in the video event handler onProgress:</p><pre>const videoPlayerRef = useRef();<br><br>// ...<br><br>const handleOnProgress = ({currentTime}) =&gt; {<br>    if (currentTime &gt;= getRightLinePlayTime(framesLineOffset)) {<br>      videoPlayerRef.current.seek(getLeftLinePlayTime(framesLineOffset));<br>    }<br>  };<br><br>// ...<br><br>&lt;Video<br>  ref={videoPlayerRef}<br>  style={styles.video}<br>  resizeMode={&#39;cover&#39;}<br>  source={{uri: selectedVideo.uri}}<br>  repeat={true}<br>  onLoad={handleVideoLoad}<br>  onProgress={handleOnProgress}<br>/&gt;</pre><p>And we place the onScroll event handler in the ScrollView element after initialising the state variable framesLineOffset:</p><pre>const [framesLineOffset, setFramesLineOffset] = useState(0); // number<br><br>// ...<br><br>&lt;ScrollView<br>  showsHorizontalScrollIndicator={false}<br>  horizontal={true}<br>  style={styles.framesLine}<br>  alwaysBounceHorizontal={true}<br>  scrollEventThrottle={1}<br>  onScroll={handleOnScroll}&gt;<br>  &lt;View style={styles.prependFrame} /&gt;<br>  {frames.map((frame, index) =&gt; renderFrame(frame, index))}<br>  &lt;View style={styles.appendFrame} /&gt;<br>&lt;/ScrollView&gt;</pre><p><strong>Finally (youhou!), for spec 4 &amp; 5 </strong>— we will only need to seek the playback time at the time represented by the “pop line”. So, it will only be two lines added to the handleOnScroll event handler + a similar function like getLeftLinePlayTime or getRightLinePlayTime but for the time represented at the “pop line”:</p><pre>const getPopLinePlayTime = offset =&gt; {<br>  return (<br>    (offset + (DURATION_WINDOW_WIDTH * parseFloat(POPLINE_POSITION)) / 100) /<br>    (FRAME_PER_SEC * TILE_WIDTH)<br>  );<br>};<br><br>const handleOnScroll = ({nativeEvent}) =&gt; {<br>  const playbackTime = getPopLinePlayTime(nativeEvent.contentOffset.x);<br>  videoPlayerRef.current?.seek(playbackTime);<br>  setFramesLineOffset(nativeEvent.contentOffset.x);<br>};</pre><p>And to make clear to the user that we are seeking the video at the pop line when scrolling, we will pause the video when the user touches the timeline, using onTouchStart and onTouchEnd (and add onMomentumScrollEnd to have an ok experience on Android devices) ScrollView event handlers:</p><pre>const [paused, setPaused] = useState(false);<br><br>//...<br><br>const handleOnTouchEnd = () =&gt; {<br>  setPaused(false);<br>};<br>const handleOnTouchStart = () =&gt; {<br>  setPaused(true);<br>};<br><br>//...<br><br>&lt;Video<br>  ref={videoPlayerRef}<br>  style={styles.video}<br>  resizeMode={&#39;cover&#39;}<br>  source={{uri: selectedVideo.uri}}<br>  repeat={true}<br>  paused={paused}<br>  onLoad={handleVideoLoad}<br>  onProgress={handleOnProgress}<br>/&gt;<br><br>//...<br><br>&lt;ScrollView<br>  showsHorizontalScrollIndicator={false}<br>  horizontal={true}<br>  style={styles.framesLine}<br>  alwaysBounceHorizontal={true}<br>  scrollEventThrottle={1}<br>  onScroll={handleOnScroll}<br>  onTouchStart={handleOnTouchStart}<br>  onTouchEnd={handleOnTouchEnd}<br>  onMomentumScrollEnd={handleOnTouchEnd}&gt;</pre><p><strong>🙌 All specs: completed!</strong></p><ol><li>✅ Given the video is loaded, then we see that the timeline is placed at the start of the duration window.</li><li>✅ Given the video timeline goes out of the duration window, then it bounces back to its borders.</li><li>✅ Given the video is loaded, then the video loops only in the duration window.</li><li>✅ Given the user scrolls the timeline, then the video scrubs to the frame represented on the pop line at the center of the duration window.</li><li>✅ Given the user releases the scroll, then the video plays again, starting from the “pop” line and looping forward.</li></ol><p>Et voilà! You have everything you need to create a video app with a timeline for iOS and Android.</p><p><a href="https://github.com/Versus-Skate/VideoTimelineExample">Find the complete version on Github</a>.</p><h3>Some limits</h3><ol><li><strong>Async frame generation</strong>. Currently the frames generated by ffmpeg display once they are all computed. That would be better to asynchronously generate each one and display then when ready.</li><li><strong>Android emulator</strong>. To test on Android, I only relied on the emulator and add a video to the Google Photo app by drag and dropping from my desktop. On Google Photo, the video stalls at random time, which also appears when playing the video with React Native Video. I expect it to solve itself with native phone video from a real device.</li><li><strong>Playing animation</strong>. As you can see on the real app demoed above, there is a playing cursor animation. But I am not satisfied with it yet. It is an important part of UX and I want to focus deeper on it before presenting it. This could lead to a new dedicated post 🔥</li></ol><p>Thanks for reading!</p><p>We are Nollie Studio — a mobile experience studio focused on rider communities. If you want to work with us, you can find us <a href="https://nollie-studio.collective.work/">from our collective.work page</a>.</p><p>And if you enjoy the read, give us a clap or share it with your friends 🙏.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDYbnfavsLLfKbbIvuMAzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*no8PvUabZfS0vkCq6BnpdA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c6624ad90ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Back to square one]]></title>
            <link>https://medium.com/@ben_cotte/back-to-square-one-eff33dc30a77?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/eff33dc30a77</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Tue, 02 Nov 2021 11:27:54 GMT</pubDate>
            <atom:updated>2021-11-02T11:27:54.330Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Originally published in my newsletter </em><a href="http://nollie.substack.com/"><em>Nollie</em></a></p><p>Glad to see you here, friend,</p><p>I am <strong>at a crossroads</strong> in my “professional” life. I have lived a <em>successful</em> entrepreneurial adventure for six years at <a href="http://www.partoo.co/">Partoo</a>, right after college. Undergoing the struggle of the beginning (I handled the CTO role for about two years — huh!), the fast-paced growth (200+ employees to date), a profitable exit (with great investors/partners in the name of <a href="https://www.webedia-group.com/">Webedia</a>). And, finally, the quieter individual contributor time as Product Manager (more on how and why to step down from CPO to product manager will drop here eventually).</p><p>Now, I am <strong>back to square one</strong> (officially on Jan 14th). And, I expect it to leave more room for <strong>experiments</strong> — more space <strong>for writing</strong> and <strong>sharing</strong>.</p><p>My focus is progressively shifting onto two things. My <strong>collaboration with Nicolas</strong>, a long-time friend, genius product designer, and co-creator of <a href="https://techcrunch.com/2017/10/16/facebook-acquires-anonymous-teen-compliment-app-tbh-will-let-it-run/">TBH</a> later acquired by Facebook. We started working together about a year ago, with a common interest in <strong>community-based products</strong>. We have been iterating on different topics, which boils down to <strong>social networks</strong>. The most advanced experiment is <strong>Stoke Club</strong> — a unique way to share the stoke within the surfing community.</p><p>The second thing I am continuously circling around is <a href="http://www.unbundlingreddit.com/"><strong>Unbundling Reddit</strong></a> — a service I started five months ago to <strong>help entrepreneurs</strong> get community insights/user discovery/business opportunities from subreddits. I really feel that Reddit is an under-valued source for observations. And one of the best places to hang out on the internet.</p><p>I imagine future publications being about <em>these topics</em>: <strong>community-led products, entrepreneurship</strong>, seeking <strong>Product-Market fit</strong> (+skateboarding — let’s be honest).</p><blockquote><em>In other words, you </em>could benefit<em> from reading this newsletter if:</em></blockquote><blockquote>We have been working together, and you want to stay close</blockquote><blockquote>We share similar vibes and you want to relate</blockquote><blockquote>You are starting a new entrepreneurial journey, or aspiring to it soon, and you want to see how I approach some topics (which tools, which training, thoughts…)</blockquote><p>And if subscribing to yet another newsletter feels too much, I am also sharing vibes on <a href="https://twitter.com/ben_cotte">Twitter</a>.</p><p><em>One last thing,</em></p><blockquote><em>Nollie, short for “nose ollie”, is an ollie executed at the front of the board while the rider is positioned in their natural stance.</em></blockquote><blockquote><em>Wikipedia</em></blockquote><p>All being said, this newsletter is about a <strong>natural stance</strong>. I’d be happy if we could share a common argument on a given topic. If ever you comment on an article from this newsletter, we will likely become friends. <strong>Let’s be friends</strong><em>. </em>I will need all the support in the world in this new exciting time, and I hope to share this with you.</p><p>Cheers,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eff33dc30a77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Superhuman — a Product Critique]]></title>
            <link>https://medium.com/@ben_cotte/superhuman-a-product-critique-dc9f0223bb49?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc9f0223bb49</guid>
            <category><![CDATA[superhuman]]></category>
            <category><![CDATA[product-critique]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Tue, 12 May 2020 13:08:08 GMT</pubDate>
            <atom:updated>2020-05-13T08:17:05.386Z</atom:updated>
            <content:encoded><![CDATA[<h3>Superhuman — a Product Critique</h3><p>Writing Product critiques is a great exercise to grow product intuition. Here is my take on Superhuman — based on the <a href="https://medium.com/the-year-of-the-looking-glass/how-to-do-a-product-critique-98b657050638">framework shared by J. Zhuo</a>.</p><p><em>If you want to skim through the main article ideas, you can find Google slides at the bottom of the article.</em></p><h3>Before hitting the landing page</h3><p>Superhuman came to my attention by stumbling on an <a href="https://uxdesign.cc/so-youre-building-a-superhuman-of-x-b39015f3d7a6">article</a> published in <a href="https://medium.com/u/8863cbbfbca7">UX Collective</a> and written by <a href="https://medium.com/u/f07ca821e19d">Mehdi Boudoukhane</a>. It was in October 2019. The title struck me. Mostly the formula “Superhuman of X” — referring to the famous one-liner pitches overused by early start-uppers. The article described loud and clear how Superhuman was reinventing email client, and the sky-rocketing metrics they were showing.</p><p>It came even more so since it was just a couple of weeks after a colleague introduced me to the inbox-0 Gmail setup using the <a href="https://klinger.io/post/71640845938/dont-drown-in-email-how-to-use-gmail-more">multiple inboxes</a>. Despite apparent flaws (multiple inboxes setup does not work on Gmail mobile app, switching Gmail accounts is still super slow), this 7-year-old setup got my emails better organized. I could not be closer to the 0-inbox goal.</p><p>By the middle of the article, I jumped to <a href="http://superhuman.com/">their landing page</a>. The unique selling point was clear: Speed. But it did not click with me. Moreover, I was not into the brand design, which has a strong professional focus — even though I now realize how consistent it is with their value proposition.</p><p>Finally, a few months later, another colleague brought <a href="https://www.alfredapp.com/">Alfred</a> (the popular productivity app for mac) back to my attention. And for some reason, it resonated with Superhuman and what I had read about it. And all-in-all, at this stage, my one-liner for presenting Superhuman would have been straightforward: <em>Alfred for emails. </em>😅</p><p>Additionally, the buzz around Rahul Vorha and his latest project were huge. <a href="https://www.acquired.fm/episodes/superhuman">In a comprehensive interview</a>, the founder explains how he raised 750k based on a single slide, which pointed out the worst Gmail shortcomings.</p><p>By then, I requested an invitation for this 30$ email client, even though it took me some time to swallow my pride. I think what convinced me was that I was getting to see and describe what a luxury product was.</p><h3>Before the first loading screen</h3><p>Upon receiving my invitation email, I noticed how far I was from the Mailbox beta-coin universe, which I enjoyed so much back in 2015. Remember how cute was the Mailbox Betacoin?</p><p><a href="https://dribbble.com/shots/1690958-Betacoin-Illustrations?utm_source=Clipboard_Shot&amp;utm_campaign=lindaeliasen&amp;utm_content=Betacoin%20Illustrations&amp;utm_medium=Social_Share">Betacoin Illustrations</a></p><p>The Superhuman long-awaited invitation email is straightforward, written in plain text, and asking to answer a 20+ required questions Typeform. Indeed, it also mentioned that I made my way up the 200k waiting list. The Typeform felt long, and frankly quite dull. However, it struck me how relevant questions were. It made me ponder my email habits. To me, it pictured how careful Superhuman has been about their user research.</p><p>Yet, I was far from seeing the first loading screen. I counted no less than six other steps.</p><p>After the Typeform, came the 30-minutes consultation planning, which was only made possible after entering my credit card information in a Stripe form.</p><p>From the moment I validated my consultation time-slot on Calendly, I received three reminders, including two emails and one SMS. But most surprisingly, I could not get my hands on the product until then. I felt a growing need for testing Superhuman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CYm-BLwguNTTN2RRXRiQw.png" /><figcaption>Trying to start using Superhuman before the consultation — find all the slides at the bottom of the article.</figcaption></figure><h3>First use</h3><p>Finally, I got to use Superhuman under the supervision of the consultation attendant. I think that it was the first time a physical person onboarded me. It added up to my perception of Superhuman commitment to email management. I also noticed no network effect incentive at the first sign-in. The consultant would later confirm that what they seek, at the moment, is to get the email right one person at a time.</p><p>The first step consisted of sharing my screen and demo my current email flow. When I showed the multiple inbox setup, the consultant immediately coined the right name for <a href="https://klinger.io/post/71640845938/dont-drown-in-email-how-to-use-gmail-more">my GTD setup</a>.</p><p>After activating my access, she let me run through the in-app onboarding exercises. It felt like video game missions — with tips displayed on the right sidebar. And it ended up sending a “Benoit is onboard!” email to the Superhuman team — which got me smiling.</p><p>The next step was the setup. The consultant diligently explained to me Superhuman opinion about email management while commenting on my old habits. In other words, she debunked the multiple inbox strategy by telling me that there was no need for all this visual noise. An email was meant to be acted upon. Period. However, she introduced the concept of <em>Splits,</em> which looks like a superior version of Gmail tabs. Superior in setting them up from filters in a few keystrokes. Superior in moving from one to the other by just hitting tab.</p><p>But more importantly, she uncovered the power of ⌘ + K. An Alfred-like power move. The spotlight of email. This command is similar to the same shortcut you find on Slack. It toggles a focused search input to run any action or navigate anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FdiIa9AL_kIhKFHMFZKW3g.png" /><figcaption>⌘ + K power move — find all the slides at the bottom of the article</figcaption></figure><p>Finally, she helped me hitting inbox zero — dequeuing my emails one at a time and showing off fancy features such as the calendar focus by pressing tab in an email with any mention of a date.</p><p>After the end of the consultation, I kept using Superhuman for another 20 minutes. I mostly felt like playing with the keyboard shortcuts. It made the exploration of the app extremely delightful.</p><p>However, I submitted two feature requests from the app during this first use, which is relatively rare for me. One of them was about the support of Gmail star icon variations — which is at the root of the multiple inbox setup I was using. I wanted to be sure that my old habits could still be maintainable within Superhuman. But I admit that since then, I haven’t been thinking about them again.</p><p>I also grinned at the discrete snackbar, which reminds you to use shortcuts whenever you are caught using the mouse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onusrjBf08NFwgeyRAfGdA.png" /><figcaption>As a shortcut refresher, you will see these snackbars anytime you use the mouse.</figcaption></figure><h3>After one week</h3><p>One week on using Superhuman made dealing with my emails more pleasing. I think that the two prominent factors are the end-to-end keyboard integration and simply how fast the account switch is, in comparison to Gmail. Plus, the fact that they don’t use the pull-to-refresh dark pattern on their mobile app.</p><p>To my surprise, I did spend a bit more time on emails than I used to. It can be due to a first-week bias — a specific moment when I wanted to use and discover the product.</p><p>I noticed them an additional three feature requests: Grammarly support, Smart reminders, and fixing mobile notifications. But besides their details, I was impressed with how close the relation felt, to get me notifying them.</p><h3>After three weeks</h3><p>The experience is gratifying. Now and then, a delightful new tip is delivered by Rohan through a series of continuous onboarding emails. In one gif, he tells you about any new power moves or further configuration. I think I opened every single one of them.</p><p>Interestingly, I see no real killer feature that Gmail can not complete. Some argue that with a few tweaks and configurations, you could have the same experience on Gmail. I believe in two things. First, you don’t need a specific killer feature to step aside. The keyboard-first experience, a propper offline mode, the slick navigation, any simple details, make it visible. Second, I believe that it is precisely the point of Superhuman — a minimalist approach that conveys the maximum value to the user. A Gmail for which you don’t need plugins to cover the most critical use cases. Rahul Vohra — former founder of the most popular Gmail plugin makes it sound even more dramatic.</p><p>However, it also felt odd when a friend asked me how I got in. I felt amused at first, but also stupid. I was amused by the question as if I was part of a club. Stupid for paying $30 for accessing my emails. When a Superhuman form asked me which target users I thought Superhuman would be an excellent fit for, as part of their product-market fit measurement, I pictured that I was not in the target. Emails surely have seen busier inboxes than mine. I will undoubtedly churn by the start of next month when I will acknowledge the cost of the solution in plain digits on my bank account. I connect with the “mental load” triggered by the price of the service as <a href="https://medium.com/u/32fb91e5fd77">Lucas Matney</a> puts it in <a href="https://techcrunch.com/2019/06/27/my-six-months-with-30-month-email-service-superhuman/">a Techcrunch article</a> where he explains his churn from Superhuman.</p><p>Finally, testing Superhuman was both intriguing and interesting. I learned how a company could deliver a strong message of caring and seriousness, in a complicated market with free alternatives run by big companies. Listening to Superhuman CEO takes about product launch (Superhuman has not launched yet, and does not intend to do so), product-market fit (Superhuman states that they came up with a systematic evaluation of their Product-Market fit), and pricing has been steady learnings to me.</p><h3>Ryan Hoover on Twitter</h3><p>@a16z @rahulvohra Superhuman is a great example of &quot;thinking wrong&quot;: - Friction to start using the service is very high - They&#39;re charging for a traditionally free utility (email) In startups, people often prescribe their assumptions as best practices. It&#39;s good practice to challenge them.</p><p>As a final thought, I was delighted to see their latest creative way to make you learn their shortcuts. ⬇️</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2Fa7e68ca8bf0c47dfa1d5efa7710c70b3&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fshare%2Fa7e68ca8bf0c47dfa1d5efa7710c70b3&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2Fa7e68ca8bf0c47dfa1d5efa7710c70b3-00001.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=loom" width="732" height="549" frameborder="0" scrolling="no"><a href="https://medium.com/media/2967edeaae211756e2c54c5e6b55016c/href">https://medium.com/media/2967edeaae211756e2c54c5e6b55016c/href</a></iframe><p>Find the critical ideas illustrated in this slideshow below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fembed%3Fid%3D1CDub0Umu6C1HWGwm1ByhJwj0d8NZ-fiQoepll9KztGg%26size%3Dl&amp;display_name=Google+Docs&amp;url=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fd%2F1CDub0Umu6C1HWGwm1ByhJwj0d8NZ-fiQoepll9KztGg%2Fedit%3Fusp%3Dsharing&amp;image=https%3A%2F%2Flh3.googleusercontent.com%2FCgQX0oeuTPG3N8z6fehwq-YnkMJ_mq1Co6JuUTIK-BX4OQEUxdJc-0Ms1Y5eZDqGQRE1FSsczQ%3Dw1200-h630-p&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="700" height="559" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dba1423895d0854c2d72ddc85c0df69/href">https://medium.com/media/3dba1423895d0854c2d72ddc85c0df69/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc9f0223bb49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I designed a product roadmap — I failed — I tried again]]></title>
            <link>https://medium.com/@ben_cotte/i-designed-a-product-roadmap-i-failed-i-tried-again-bda74ad296a6?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bda74ad296a6</guid>
            <category><![CDATA[roadmaps]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Fri, 20 Apr 2018 06:48:36 GMT</pubDate>
            <atom:updated>2018-04-20T06:48:36.203Z</atom:updated>
            <content:encoded><![CDATA[<p>At <a href="https://www.partoo.co/en/">Partoo</a>, it had always been hard to track who was doing what and when. Things were moving fast, priorities changed every week. I was evolving from CTO to CPO, therefore, my first task — and probably the most challenging one — was to draw a product roadmap.</p><p>I made the first version, failed, tried again, and eventually improved — at least on some aspects. Here is the <strong>story</strong>.</p><h3>First, I spent — too much — time on the prioritization problem</h3><p>Roadmapping is a way of choosing your battles as a company. Greater constraints are time and resources, thus needing to prioritize. To do so, a lot of threats are looming, you can rely on someone guts — might it be yours, the CEO’s, your biggest client’s (and <a href="https://svpg.com/seven-deadly-sins-of-product-planning/">7 other deadly sins</a>). Anyway, a lot of different factors enter the room, having a clear overview was the first effort I led.</p><p>At this point, I chose to rely on the expertise of Intercom. They are doing a terrific job on their podcasts about <a href="https://www.intercom.com/books/product-management">Product Management</a>. From the episode of their ‘Intercom on product management’ podcast ‘<a href="https://itunes.apple.com/us/podcast/intercom-on-product-management/id1300291461?mt=2#">Chapter 5: Which new features should you actually build?</a>’, I literally selected the <strong>10 criteria</strong> since it covers this wide range of different matters — from business, users and to operations.</p><p>Namingly:</p><ul><li>Does it fit your vision?</li><li>Will it still matter in 5 years?</li><li>Will everyone benefit from it?</li><li>Will it improve, complement or innovate on the existing workflow?</li><li>Does it grow the business?</li><li>Will it generate new meaningful engagement?</li><li>If it succeeds, can we support and afford it?</li><li>Can we design it so that reward is greater than effort?</li><li>Can we do it well?</li><li>Can we scope it well?</li></ul><p>Now that I had a set of criteria, I wanted a consistent technique to assess current and upcoming tasks with this filter. There is such a technique — called <a href="https://en.wikipedia.org/wiki/Analytic_hierarchy_process">AHP</a>. It provides an easy way of computing a score for a given task based on multiple criteria. Bottom line is that on the one hand, you evaluate above-mentioned questions 2 by 2 (let’s say question 1 is 2 times more important than question 2). On the other hand, you evaluate each task on a given question (or get relevant a team involved in replying) on a scale from 1 to 9 (a detailed HOW TO article will follow 🤗 — promise).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiXRdaGEliA6UahbpXOv8Q.png" /><figcaption>Scoring a task</figcaption></figure><p>At the end of the day, I had a consistent method to score each task, which we currently use as a ‘priority hint’ — in an overly complicated Google sheet. I thought I would be done by then.</p><h3>Then, tasks redefinition — although needed — impacted clarity</h3><p>From living without a dedicated Product team at Partoo — we took a certain habit of skipping to implementation immediately. And inherently, lots of decisions were made in a text editor. I wanted to cope with that. Adding a more concrete frame over other steps than implementation would help — at least to communicate — all the other things we needed to do before rushing implementation. Therefore, I divided every new task in 4 steps: Exploration / Conception / Implementation / Launch. Each of them would be defined by a given input and an expected output.</p><p>Although it appears as an obvious path for any company, it was rather new at Partoo. And even though it helps us a lot — it drastically complicated the reading of the GSheet roadmap. On one line lies — and is still lying — 8 different dates. An ETD and an ETA for each step. It was already too much for anyone to grasp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYeheX5X1T2RoPssdT-Yag.png" /><figcaption>Preview from the roadmap GSheet</figcaption></figure><h3>Finally, I understood what it meant to know your audience</h3><p>Be it a 25 person startup (which was Partoo at the time), or a 50k+ people company, roadmaps need to be clear and accessible to everyone.</p><p>I realized that the tool I came up with was <strong>overly complicated to read</strong> and understand. The key ingredients which helped me go over that were to: 1) understand who were the roadmap users, 2) set a when&amp;where.</p><p>In this case, there were 2 user groups for the roadmap:</p><ul><li>the whole team</li><li>the key stakeholders which are the team leaders</li></ul><p>For the <strong>whole team</strong>, <strong>clarity</strong> was way more important than details — everyone had to be <strong>informed</strong>. After spending some hours trying to generate visualization from my data, I decided to go for an <strong>MVP</strong> instead. I came up with a ‘<strong>real board</strong>’ made of polystyrene and ropes and hung it onto the office wall. The when&amp;where has been set as monthly gather-ups ‘Petit dej’ Produit’ where we read the roadmap board together. It is by far the easiest and quickest way to build — and get feedback — on a roadmap visualization for the team. Moreover, it gave me the opportunity to test and learn quickly on which info was important for the second group — and how I could gradually improve the GSheet roadmap.</p><p>Indeed, the <strong>key stakeholders group</strong> was to be <strong>consulted</strong> and had to challenge the roadmap. For this group, a dedicated when&amp;where has been set as every first week of the month (one week prior to ‘Petit dej’ Produit’), and the goto tool is the GSheet.</p><p>Note to self: it might make sense to engineer a bit better now so that our folks in Italy and Spain can get instant access to it. 🙃</p><h3>Where are we now?</h3><p>First, by now, I am really supported by Seb who fully joined the product team, and which helps me a lot iterating faster through such tasks. Being able to quickly debate and discuss our work helps us anticipating key questions like <a href="https://en.wikipedia.org/wiki/Responsibility_assignment_matrix">knowing your audience</a> or to avoid over-engineering things.</p><p>Second, as for any product, <strong>knowing my users</strong> definitely helped me conceive a first visualization tool, be it a real board. And quick iterations from feedbacks over this board highlighted which unnecessary information — like score computation details 😅) — to trim on the more detailed and scalable GSheet, which is aimed at the key stakeholders. The latter has already lost more than 50% of its initial weight 😎. Now my key result at aim is to generate as many interactions in the GSheet as on the real board.</p><p>Then, even though there is still so much room for learning and making a better job at managing all tasks in an efficient way, I feel that we achieved something when I read <strong>our last peer review</strong>:</p><blockquote><em>‘I just understood tech direction @Partoo thanks to the Roadmap! It gives a new boost to the productivity of devs + products ❤️’</em></blockquote><p><em>I really hope this journal about making the first roadmap at Partoo can help you avoid common mistakes I made.</em></p><p>️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bda74ad296a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Product for Managing your Knowledge]]></title>
            <link>https://medium.com/@ben_cotte/a-product-for-managing-your-knowledge-175e17f2a061?source=rss-dcdbf9f620aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/175e17f2a061</guid>
            <dc:creator><![CDATA[Ben Cotte]]></dc:creator>
            <pubDate>Fri, 06 Feb 2015 14:59:18 GMT</pubDate>
            <atom:updated>2015-02-06T16:39:23.951Z</atom:updated>
            <content:encoded><![CDATA[<p>I would like to present a product that truly changed my way of dealing with knowledge, of <em>managing knowledge.</em><br>Until now, I was facing the following problems: I got into inspiring classes from ESSEC Business School or UC Berkeley, and took the habit of summing them up in real-time on an A4 sheet, drawing arrows and circles between keywords.<br>However, I quickly faced two types of problems: how to store these valuable notes efficiently, and how to find them when I needed to.</p><p>The first problem was easy to address. At the end of each semester, I was spending some hours <strong>scanning</strong> my notes, i.e. I would take pictures of every course notes I had, and I would upload it on Google Drive. Then I would have to place each scanned note into the right sub-folder corresponding to the course. It was a pain in the neck, but it was working.<br>However, it was harder to deal with the second problem. But first, let me tell you a short story on how storing my knowledge helped me on a working task.</p><p>It had been one month that I had begun my internship at Lazada (Rocket Internet’s Amazon clone in South-East Asia), as Regional Marketing Analyst on the newly created Affiliate Marketing channel. Part of my job, at the regional level, was to manage the work of each of the five local affiliate managers, responsible for recruiting and keeping affiliate partners into our program. My boss asked me this: “I want you to help them doing their job” — at least, it is what I understood. I was vaguely remembering a framework I had learnt a few months earlier to manage an online marketing campaign: the REAN framework. The REAN framework had been popularized in the book “Cult of Analytics”, written by<strong> Steve Jackson</strong>. I directly contacted him on LinkedIn, to get further explanations on how I could adapt this simplistic funnel structure to help me better manage the local affiliate managers working at Lazada. Two weeks later, I was able to find back my notes from my marketing courses and take into accounts interesting advice from Steve Jackson himself. I came up to my boss to present him a REAN framework applied to manage our affiliate managers on a weekly basis. Every day corresponded to a letter of the REAN acronym and constituted in a clear Call to Action with a KPI associated with it, e.g. Mondays were the R (for REACH) day, with a number of potential affiliates to reach and a corresponding KPI to meet. The system was applied instantly, to the benefits of all: at a local level, affiliate managers had a better understanding of what they should be doing, and at a regional level, it was easier for us to help them meeting their objectives and helping them.</p><p>This creative idea toward a better management system had only been possible because, after remembering the concept, I could find the scanned version of my marketing course note in my Google Drive folder.</p><p>But at this point, the second problem arose: how can I find the right resources if I don’t remember exactly which course sub-folder it is in? At first I thought that it was a problem of visualizing the resources, i.e. it was painful and inefficient to have to go through each course sub-folder and scanned note to find the right resource. And what about sharing these resources? What about sharing them, while keeping them protected?<br>So I tried a few products to cope with this. I tried setting up a Pinterest private board — but after reaching the customer service, I learnt that it was not allowed to share private boards. I created a private Wordpress — requiring password access, with a portfolio theme to display my notes — but uploading the scanned version and organizing the content was super painful.</p><p>So after a while, I let it go. I was still scanning my courses, but I dropped the idea of having a better visualizing interface. Until I started using <strong>Evernote</strong> — and this became the major reason for me using it.<br>When I started using the free version, I found myself trying what the other solutions could not afford me, I uploaded my scanned course notes into the desktop app — as easy as a drag-and-drop. If I had a pdf of the course, it even displayed it right into the note window, and was enabling annotations. I re-created my folder tree into the Evernote account using one note per entire discipline, and stacked notebooks per school I had been into (dividing into ESSEC, UC Berkeley and Harvard Extension School). But I was far from imagining the most useful feature: <strong>the text in image recognition. </strong>It allows me to search the topic I am looking for, and to get back the occurrences where it appears in the scanned handwritten notes. And now that they released the complementary “Scannable” app, I am ever more satisfied with this product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*KaGhh5ZauyV3EHUH.jpg" /></figure><p>Since I am valuing more than $5 a month the ability to have an easy and efficient access to what I have been learning at school, I am ok with getting the Premium account which allows me to get enough imports to put the structure in place.<br>I think that Evernote is an awesome product, but which can sometimes suffer from inefficient communication being used in a lot of different cases. My problem was obvious to me, and the Evernote product answers it just right. <strong>I feel privileged for having been able to go to university, and easy and efficient access to what I have been learning there represents for me a huge asset.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=175e17f2a061" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>