IDE Setup
Install Local Maven Dependencies
The latest SDKs can be found in the Flex artifactory here. If you don’t have access to the Ooyala Flex artifactory, please request the files from flex-solutions@ooyala.com. You’ll need to download the JAR and POM for your specific version of Flex, and then import them into your local maven repository.
Example: mio-api-sdk-6.0.0.jar
Use the following command to import (absolute paths):
mvn install:install-file -Dfile=<path-to-file> -DgroupId=tv.nativ.mio -DartifactId=mio-api-sdk -Dversion=6.0.0 -Dpackaging=jar
Maven Dependencies (pom.xml)
<dependency> <groupId>tv.nativ.mio</groupId> <artifactId>mio-api-sdk</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.12</version> </dependency>
Complete Maven pom.xml Example
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ooyala.flex</groupId> <artifactId>project-name</artifactId> <version>1.9</version> <name>Project Display Name</name> <description>Project Description</description> <dependencies> <dependency> <groupId>tv.nativ.mio</groupId> <artifactId>mio-api-sdk</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.12</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>2.7.19</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher --> <version>3.1</version> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.9.1-01</version> </dependency> <!-- for 2.8.0-01 and later you must have an explicit dependency on groovy-eclipse-batch --> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>2.4.3-01</version> </dependency> </dependencies> </plugin> </plugins> </build> </project>
Groovy Script Class Structure
The Flex SDK gives access to the PluginCommand class. which contains context and services fields to be referenced in your scripts. We’ll use these fields to interact with Ooyala Flex.
import tv.nativ.mio.api.plugin.command.PluginCommand class MySample extends PluginCommand { def execute() { context.logInfo("Hello World!") }