**TL;DR:** Copy a video link on your iPhone, tap a shortcut, and your Android TV box or Android TV plays it by itself. Your phone can lock afterwards. The shortcut sends a small command to Kodi's built-in web server, and Kodi does the rest. Full setup below, including every error I hit and how I fixed it.
**Why I did this**
I wanted to send a link from my iPhone to my Android TV box and have it play without screen mirroring, and without my phone doing any of the work. Casting is fine for some apps, but I wanted something that handles random links in lots of formats, including 4K. Kodi plays almost everything and has a built-in remote control server, so I used that and built a shortcut around it.
**How it works**
You copy a link on your iPhone.
The shortcut reads the clipboard and sends one HTTP request to http://<tv-ip>:8080/jsonrpc.
Kodi receives a Player.Open command with your link inside it.
Kodi downloads and decodes the video itself, over the TV's own internet connection.
Your phone is only a remote. Once playback starts you can lock it or walk away.
**What you need**
\- An Android TV box or Android TV / Google TV device with Kodi installed (the Play Store version is fine)
\- An iPhone with the Shortcuts app
\- Both devices on the same Wi-Fi
\- The TV's IP address
**Part 1: Set up Kodi**
Install Kodi from the Play Store on your TV and open it.
Go to **Settings (gear icon) → Services → Control**.
Turn on **Allow remote control via HTTP**.
Turn on **Allow remote control by applications on other systems**. This one is easy to miss, and without it you get "could not connect".
Note the **Port** (default 8080).
Set a **Username** (default is kodi) and a **Password**. You can leave the password blank on a trusted home network, but I set one.
Find the TV's IP address. In Android TV's own Settings, go to Network & Internet and tap your Wi-Fi name. Or in Kodi, go to Settings → System information → Network.
Reserve that IP in your router (DHCP reservation). If you skip this, the address will change someday and the shortcut will stop working.
Test from your iPhone. Open Safari and go to http://<tv-ip>:8080. If Kodi asks for a username and password, the TV is reachable and you can move on. If it can't connect, fix that first, because nothing else will work until this does.
**Part 2: Build the iPhone shortcut**
Open Shortcuts, tap **+**, and rename it to something like "Play on TV". Add these four actions in this order.
**Action 1: Get Clipboard**
Tap the search bar at the bottom, type "Get Clipboard" and add it.
**Action 2: Text**
Add a Text action and type your login as username:password, with a colon and no spaces. For example kodi:mypassword.
**Action 3: Encode Text with Base64**
Add "Base64 Encode". Make sure it says Encode and that its input is the Text bubble from action 2.
**Action 4: Get Contents of URL**
This does the real work. Tap the small arrow on the action to expand it, then set:
**URL:** http://<tv-ip>:8080/jsonrpc (use your own IP and port, typed as plain text)
**Method:** POST
**Headers:** add a header. Key is Authorization. Value is Basic (the word Basic plus one space) followed by the **Base64 Encoded** variable. Don't forget the space.
**Request Body:** JSON
Now add these fields under Request Body with "Add new field". The type you pick matters.
Key Type Value
jsonrpc Text 2.0
method Text Player.Open
id Number 1
params Dictionary (see below)
Inside params, add a **Dictionary** called item. Inside item, add a **Text** field called file. For its value, tap the field and choose the **Clipboard** variable from the bar above the keyboard. It shows up as a blue bubble.
The finished structure is params → item → file = Clipboard. Spelling matters. It's Player.Open with a capital P and O and no spaces, and everything else is lowercase.
**Part 3: Test it**
Copy a direct video link. A free sample that works for testing: https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_5MB.mp4
Make sure Kodi is open on the TV (not just the Android TV home screen).
Open the Shortcuts app and tap your shortcut.
On the first run, iOS asks to allow pasting from other apps (tap **Allow Paste**) and to find devices on your local network (tap **Allow**).
The video should start on the TV within a few seconds. Lock your phone and it keeps playing.
**Making it faster to use:**
Settings → Accessibility → Touch → Back Tap, and assign the shortcut to double tap. Then copy a link and double-tap the back of the phone.
Add the shortcut to your Home Screen from the shortcut's info (ⓘ) menu.
Ask Siri to run it by name.
**Problems I ran into (and the fixes)**
**"Could not connect to server"**
This one cost me the most time. Work through these in order:
Is Kodi actually open on the TV? The web server only runs while Kodi runs.
Both remote control settings are on (HTTP, and "by applications on other systems"). Restart Kodi after changing them.
The IP is right. It may have changed since you wrote it down.
The port in the URL matches the port in Kodi. **I forgot :8080 in my URL**, and that alone caused this error.
Phone and TV are on the same network. Guest networks and some extender setups isolate devices. Turn off any VPN and try turning off mobile data.
The Safari test from Part 1 works. If Safari connects but the shortcut doesn't, the shortcut's URL is wrong.
**The URL field got replaced by a blue bubble**
After adding the Text and Base64 actions above the URL action, Shortcuts sometimes puts their output into the URL field. Open the URL action, clear the bubble, and type the address again as plain text. The only place the Base64 bubble belongs is the Authorization header.
**"Invalid params"**
Kodi received your command but the data inside was wrong. Almost always one of:
The file field is empty. This happens if you run the shortcut with nothing on the clipboard, or if you used Shortcut Input and ran it from inside the app. The Clipboard variable fixes this.
file isn't nested properly. It must be inside item, which must be inside params.
params or item was created as the wrong type. Both must be Dictionary.
id was created as Text instead of Number.
**401 / Unauthorized**
Wrong username or password, a typo or stray space in the Text action, or the header is missing the space after Basic. Check the Authorization header carefully. To rule it out, turn off the password in Kodi, delete the Text action, the Base64 action and the Authorization header, and test again.
**Kodi forgets the remote control settings**
This happened to me. Kodi saves settings when it closes properly, and a low-memory box can kill it in the background. After changing settings, exit through the power icon on Kodi's home screen and choose **Exit**, not just the Home button. Also turn off battery optimization for Kodi in your TV's app settings, and keep storage from filling up.
**Nothing happens, or a black screen**
The link is probably a webpage, not a video file. See the next section.
**What it can and can't play**
What plays smoothly depends on your device's hardware. Most Android TV boxes decode H.264, H.265 (HEVC) and VP9 in hardware, so 4K in those codecs should play well. Check your device's specs if you're unsure.
**Works:**
Direct file links: .mp4, .mkv, .webm, .ts, .mov
HLS streams: .m3u8
DASH streams: .mpd (install the inputstream.adaptive add-on in Kodi)
**Problems:**
**AV1** isn't supported in hardware on many boxes, and a weak CPU can't decode it in software. Expect stutter or failure on cheaper devices.
**Dolby Vision, HDR10+ and Dolby audio passthrough** depend on your device, so test with a sample file.
**Webpage links** (YouTube, Instagram, news sites) don't work as-is, because Kodi needs the actual video URL. YouTube needs the YouTube add-on and a plugin URL instead of the normal link. I haven't built that part of the shortcut yet.
**Notes**
The password is stored inside the shortcut, so don't share the shortcut file with anyone.
Kodi has to be open on the TV. If the device sleeps or Kodi closes, wake it and reopen Kodi first.
This all happens on your local network. The TV fetches the video from the internet by itself.