CreateObjectURL and RevokeObjectURL (Explained by Example)

Поділитися
Вставка
  • Опубліковано 8 бер 2019
  • 💻 More Software engineering videos • Software Engineering b...
    In this video we will learn how to use CreateObjectURL and RevokeObjectURL to cache resources locally after loading them with the fetch url and using them locally, then finally releasing them after we are done by calling revoke.
    As usual we will use Javascript since this code runs in the browser and we will load an image over the air using fetch api then we will cache the image locally using CreateObjectURL then set this image as resource. Finally, we will revoke the resource.
    Source Code: github.com/hnasr/javascript_p...
    Stay Awesome!
    Hussein

КОМЕНТАРІ • 24

  • @Fernando_SC
    @Fernando_SC 3 роки тому +9

    I just discovered your channel and i already love it, your way of teaching is superb, despite i am not a native american speaker i understand every thing. thx!

  • @bachnghianguyen9626
    @bachnghianguyen9626 2 роки тому

    You are my hero. This video saves my project.

  • @AnatolyLeonov
    @AnatolyLeonov 4 роки тому +1

    Nice explanation. Finally, understand what it is after watching this

  • @joshuabharathi706
    @joshuabharathi706 2 роки тому

    Expiation with

  • @willac4261
    @willac4261 Рік тому

    Thank you! This was quite useful!

  • @young-ceo
    @young-ceo Рік тому

    This is useful, thanks a lot!!!!

  • @programmerarnab9046
    @programmerarnab9046 4 роки тому +3

    You Rock my man,,, You litterally Burnt it, :v i need to learn a whole bunch. You inspire me

  • @EhSUN37
    @EhSUN37 2 роки тому +2

    in eventlistener you could revoke the url first then blob another one to avoid memory leak. otherwise with each click the browser creates a new url which points to a new memory address even though the url variable changes to new one but the garbage collector wont delete it

  • @jivanmainali1742
    @jivanmainali1742 4 роки тому +1

    Yeah that was great but what If I want to load image videos from server.Should I need to create blob out of url in client side or serverside and then send that to client

  • @kartikeyaagrawal5917
    @kartikeyaagrawal5917 2 роки тому

    Here is a scenario. I want only the authorized user should be able to view the content(video). Can I pass the JWT token as a bearer header with fetch and get the link for the the authorized video. ...then following the same step above ??

  • @RajKumar-gm4rg
    @RajKumar-gm4rg 5 років тому

    Awesome

  • @a_vinix
    @a_vinix 3 роки тому

    how can i do it, but with videos?? and not images?

  • @alex-bc7si
    @alex-bc7si 5 років тому +5

    u could get all imgs by querySelectorAll

  • @soniablanche5672
    @soniablanche5672 Рік тому

    almost all stackoverflow threads are old and wants you to use the FileReader api but this is much simpler

  • @yekna459

    Any reason why revokeObjectURL doesn't do anything in Firefox? At least that's my situation

  • @HoaiLe-ty1ui
    @HoaiLe-ty1ui 3 роки тому

    Do it with video tag please , how to RevokeObjectURL a video url ?

  • @toma2502
    @toma2502 4 роки тому

    it doesn't work on mobile :/