I use Eclipse for most of my Java development (and VSCode for JavaScript), so if there's an Eclipse plugin on offer, I'm going to take it.
The installation instructions seem fairly clear and obvious. It suggests using a new workspace which seems a bit extreme, but I generally create a new installation of Eclipse before installing a plugin I've not used before, so I'll take their advice.
Unfortunately, as often seems to happen with Eclipse plugins, there are "unresolved dependencies" and, for reasons beyond my ken, Eclipse cannot handle these the way that Linux packaging tools, or Maven, or Ruby can: you are left to your own devices.
Fortunately, a quick google showed up this thread, which included a comment that was spot on for me: you need to install the dynamic languages toolkit first. I'm not sure how much of this is actually required, and indeed not all of it would install for me (I'm using a fresh install of 2020-03) but between what would install and the Roku plugin, everything worked.
The Roku plugin contains the usual source editor that you'd expect. It also includes the ability to export your applications to the device, monitor and debug them. All of these features will be covered as we try and develop an application to play videos in the next few posts.
Unit Testing
I also found a unit test library, which says it is modelled after JUnit 5. However, because it seems to be impossible to literally run Roku programs "inside" eclipse, this feels hard to use. I will probably circle around to it next time I am working with Roku and will probably blog about it then.Roku Remote
To save you the hassle of having a remote on your desk, you can use the built-in Roku Remote view in Eclipse.
Before this will work, you need to add your device. Unfortunately, in the default perspective, you can't see all the controls to add the device. Make it take up the whole screen, configure it, and then bring it back down to gadget size.
As it happens, I found the actual remote on my desk to be more reliable.
Stream Testing
Roku also offer a "Stream Testing" tool. This enables you to connect to a stream and see if it will play successfully on your Roku.
This is embedded in the Eclipse plug-in, but in order to enable it you need to (one time) install the appropriate channel on your Roku box. To do this, you need to open the stream tester in a browser and click on the gear towards the top right corner and then click on the big box link that appears and then follow the instructions to install a new channel.
It's then possible to use the Stream Tester either in the browser or in Eclipse. To use it in Eclipse, select it from the "Roku > Web Tools" menu.
You will first need to connect it to your device using its IP address. You can then specify the video URL and press Play. The Roku should open the Stream Testing Channel and display your content.
Options
On the "General" tab, you can select the "Debug Video HUD" which shows banners at the top and bottom of the screen, telling you which files it is loading and playing, along with metadata about bit rates, subtitles and the like.
On the Cookies tab, you can provide cookies that you have established elsewhere to access protected content.
On the Headers tab, you can provide any headers that you need to access the content.
There is also a DRM tab which supports certain forms of DRM encryption if you know what you're doing (I don't).
#!/bin/bash
Deploying with a Script
Deploying using the Eclipse Export functionality gets very old, very quickly. If you don't want to do this, you can use the Makefile that they provide with various samples (it may just work out of the box; I haven't used make in 20 years and I wasn't about to go back). But I can still read Makefiles, so I dug through the various scripts and reconstructed what it is actually doing which is a zip followed by a curl. This is what I ended up with:#!/bin/bash
if [ -z "$PASSWORD" ] ; then
echo "No PASSWORD"
exit 1
fi
rm $ZIP
zip -ro $ZIP *
curl --silent --user rokudev:$PASSWORD --digest -F mysubmit=Install -Farchive=@$ZIP http://$ROKUIP/plugin_install
This really does want a password (so that you aren't saving it in a script) but the $ROKUIP and $ZIP could be variables or you could replace them with hardcoded versions. This script assumes it is running in the root directory of the project and that the ZIP file is going somewhere else.
I then connected this up as an "External Tool" in Eclipse (and passed PASSWORD in as an env var) so that I could push a single button and be deployed.
Summary
The Eclipse plugin is effective but flaky. If you use Eclipse, you should definitely get it.
No comments:
Post a Comment