TV & Desktop
TV & Desktop
Sample Project to download
Get Started
- Choose “TV Desktop” as Device for creating a new project

-
Before adding inputDevice feature, make sure everything works fine with tap or touch event with mouse on corona simulator.
- iOS/Android – touch
- TV – controller
- Desktop – mouse + keyboard
-
then add external code for button navigation to set the navigatable buttons. It is two ways navigation with up and down keys.
kInputDevices:setButton(layer.btn1)
kInputDevices:setButton(layer.btn2)
kInputDevices:setButton(layer.Settings)
kInputDevices:setButton(layer.NaviBtn)
4 ways navigation is not supported yet
Setting and Setup page
it is better for setting page to show the list of connected controller and the setup page to show the key assignment of controller. The key assignment can be editable. Sample lua files for table UI are available
-
Name:controllersTable assets/extLib/controllersTableUI.lua
-
Name:keyAssignTable assets/extLib/keyAssignTableUI.lua
Icons and Device build
android(FireTV)
- assets/tvAsset/Default-Landscape-assets/Default-Landscape.png
- assets/tvAsset/tvosLaunch-assets/Banner-xhdpi.png
tvos(appleTV)
-
assets/tvAsset/tvosLaunch-assets/Icon-tvOS-Launch.png
-
assets/tvAsset/tvosLaunch-assets/Icon-tvOS-TopShelf.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Large-Background.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Large-LogoA.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Large-LogoB.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Large-LogoC.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Large-LogoD.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Small-Background.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Small-LogoA.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Small-LogoB.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Small-LogoC.png
-
assets/tvAsset/tvosPallax-assets/Icon-tvOS-Small-LogoD.png
Windows
- assets/DeskTopIcon/Icon-win32.ico
OSX
- assets/DeskTopIcon/Icon-osx.icns
these .ico and .icns files are created with the following commands in Termnal app. Plese make icon_xx.png files and install image magic to Window PC
- mac_icon.command
rm -r icon.iconset
cp -r desktop_icon-assets icon.iconset
cd icon.iconset
rm icon_48x48.png
cp icon_32x32.png icon_16x16@2x.png
mv icon_64x64.png icon_32x32@2x.png
cp icon_256x256.png icon_128x128@2x.png
cp icon_512x512.png icon_256x256@2x.png
mv icon_1024x1024.png icon_512x512@2x.png
cd ..
iconutil --convert icns --output Icon-osx.icns icon.iconset
- win_icon.bat
set MYDIR=desktop_icon-assets
set ICON_FILE=Icon-win32.ico
magick ./%MYDIR%/icon_16x16.png ./%MYDIR%/icon_32x32.png ./%MYDIR%/icon_48x48.png %ICON_FILE%
Image Magick http://www.imagemagick.org/
Parallax Previewer App https://developer.apple.com/library/tvos/documentation/General/Conceptual/AppleTV_PG/CreatingParallaxArtwork.html#//apple_ref/doc/uid/TP40015241-CH19-SW1
Solar2D does not need .lsr file to buld TVOS app. it needs those Logo.png
PSD files - Image assets from layers https://helpx.adobe.com/photoshop/using/generate-assets-layers.html
Install app
you need a real device to test app. Solar2D does not support XCode simulator for apple TV yet.
-
appleTV (4th generation) connected USB-Type C cable with your Mac
-
corona SDK > build > tvos and select option install to apple device after build
-
fireTV online with same WiFi network of your PC or Mac
-
Settings > Developloper Option, enable adb debug and app from unknow source
-
Settings > About > Network and check IP address
-
When .apk is bult with Solar2D and is saved to the folder on your PC, use adb command on Terminal of PC or Mac.
-
adb connect ip_address_of_fireTV:5555
-
adb install -r your_app.apk
-
OSX app needs to be built with Solar2D on Mac
-
Windows app needs to be build with Solar2D on Windows
FireTV
-
FireStarter is a good app launcher
http://www.htpcbeginner.com/install-firestarter-on-fire-tv-without-adb-and-computer/
Limitations
- the size of Apple TV apps to 200MB
https://www.macstories.net/news/interesting-apple-tv-tidbits-app-size-limits-parallax-icons-more/
-
AppleTV system.DocumentsDirectory does not exist. Instead System.CacheDirectory is used for saving variables or etc but the data can be reset and removed. It affects In App Purchase feature as well.
-
drag&drop
-
4 way navigation
-
multi controllers
-
Desktop
- Mouse Right Click
- Mouse Scroll Wheel events
- copy/paste
-
Under investigating whether it works or not about exiting app by menu button
https://forums.solar2d.com/t/going-back-to-the-tv-menu-with-the-menu-button-on-the-remote/336933
Video
you can use native.newVideo() for appTV, fireTV and OSX but not Windows. Windows can not play video. Possibly open another app like browser by URL scheme.
fireTV supports the features as same as android features of Solar2D
video with webview
-
OSX ok
-
Windows not supported
https://forums.solar2d.com/t/how-would-i-use-a-webview/334901
-
tvos not supported
https://docs.coronalabs.com/daily/guide/tvos/index.html
video with native.newVideo()
- tvos ok
- OSX ok
- Windows not supported, not support media.playVideo() either