ipad_header

Mac Swift Tips: How to stream video from Mac to iPad 💻

It’s been a month or so of my new life with an iPad Pro.
No Apple Pencil yet, but this little beautiful guy really changed many of my routines.
I now use Netflix 🍿 a lot more, since I can take my iPad with me on my bed whenever I feel inspired. And the audio is just great, compared to its portability.
I’ve got also many apps for studying software development that I use on my daily trips to work. Then there are the drawing and colouring apps, for when I feel relaxed. 👩‍🎨🎨
So it’s been a quite consistent update.
But must of all, the real revolution has been videos: I watch a lot of videos on it! (I’d dare to say 80% of all videos)
Most of them are CG tutorials synced on my iCloud Drive from my main Mac.
They can be as light as 2-3MBs, or as heavy as a few hundred MBs.
So syncing is not always the greatest way, since it can take some time and it will help to slowly clutter my mobile storage.
I don’t have an Apple TV, so AirPlay is not an option.
Instead, I did found a little trick to stream my videos on my ipad, requiring just my mac, my iPad, and a wifi shared by both of them.

How to stream video from Mac to iPad

(or whatever device sharing its wifi, really!)

ipad_header

Here’s the tip in short:
I just start a server on my mac in the folder where my videos are.
Then I connect to this server using Safari on iOS.
You can use the builtin Python SimpleHTTPServer in order to start the server, however, I did found that the npm http-server package is a lot more reliable.

The great thing about that is that even if you don’t have any wifi around, you can just create a local wifi using your mac! Click on Wi-fi -> Create Network, as shown below:

statusbar-create-wifi

Here are the steps if you just read blah blah blah server blah python blah blah:
  1. Open the terminal app.
    It’s located inside /Applications/Utilities/Terminal.app
    You may feel a little uneasy if you never used the terminal before, but – trust me – it ain’t as difficult as it seems!
    We’re just 4 lines of code away, really.
  2. Install brew if you already haven’t 🍺

    Here you can find more infos and then latest updated command for installing.
    Type all of the following line

    into a Terminal window and then press enter.
    Brew is a gorgeous system for managing external packages and tools, just like apt-get or yum on Linux. It really helps to keep everything clean and well organised, without having to dwell into subdirectories in order to compile libraries and things like that.

  3. Install NodeJS

    Simply type:

    and press enter.

    It’s just a one liner, thanks to brew!
    This command will install both Node and NPM, its package manager.
    Node is a framework for doing backend development using JavaScript, but we will just be using some of its awesome packages available.

  4. Install the http-server npm package.

    You can find more info about this package here
    This simple line will install the utility for starting a simple server that will serve our videos to the iPad.

  5. Grand Finale

    Inside terminal, go into the directory where your files are.
    You can do this by simply typing

    and then the path to folder.
    If you drag the folder to the terminal window, the path will appear after the command!
    For example:

    Then type

    to list all files that are inside that folder, just to be sure we’re in the right place.

    Now type

    in order to start a server on port 8000.

    ipad_streaming_tip

    Now open Safari on your iPad and go to the third address showed by the command – http://192.168.2.106:8000 – in my example.
    The iPad will see everything that it’s in that folder!

    When you want to stop the server, press CTRL+C (not CMD) on the terminal window where the server is running in order to kill it.

    You can navigate the filesystem and just play the videos or music you want.
    Happy watching! :)

Lascia una risposta

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

Immagine CAPTCHA

*

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">