Active Audio Android Manual

Instreamatic offers consumers the power of a voice command while listening to a digital radio stream. Users can say 'Hey, Radio' and ask to open a webpage, show directions, request a promo code, and more. The ad will deliver an appropriate target action.

To fully enable the App, microphone access permission needs to be activated to your App manifest. You can learn more about how to do this via the following link:

Example Manifestarrow-up-right

triangle-exclamation

https://developer.android.com/topic/libraries/architecture/workmanager/advanced/long-running#declare-foreground-service-types-manifestarrow-up-right

circle-check

(Please turn off the AdBlocker to access the repository)

Project Configuration

repositories {
   jcenter()
   mavenCentral()
   maven {
       url 'http://instreamatic.com/nexus/repository/maven-public'
   }
}
ext {
   admanVersion = '9.2.2'
   serVersion = '6.15.0'
   admanEmbdVersion = '1.1.1'
   admanUWphraseVersion = '1.0.0'
}
dependencies {      
    api 'com.instreamatic:adman-android:' + project.ext.admanVersion + '@aar'
    api 'com.instreamatic:adman-android-view:' + project.ext.admanVersion + '@aar'
    api 'com.instreamatic:adman-android-voice:' + project.ext.admanVersion + '@aar'
    api 'com.sensory.speech.snsr:tnl:'+ project.ext.serVersion +'@aar'
    api 'com.instreamatic.embedded:phrase-spot:' + project.ext.admanEmbdVersion + '@aar'
    api 'com.instreamatic.embedded:voice-recognition-embedded:' + project.ext.admanEmbdVersion + '@aar'
    api 'com.instreamatic:adman-android-module-wphrase:' + project.ext.admanUWphraseVersion + '@aar'
}
android {
   ...
   packagingOptions {
       exclude 'META-INF/DEPENDENCIES.txt'
       exclude 'META-INF/LICENSE.txt'
       exclude 'META-INF/NOTICE.txt'
       exclude 'META-INF/NOTICE'
       exclude 'META-INF/LICENSE'
       exclude 'META-INF/DEPENDENCIES'
       exclude 'META-INF/notice.txt'
       exclude 'META-INF/license.txt'
       exclude 'META-INF/dependencies.txt'
       exclude 'META-INF/LGPL2.1'
   }
   
}

Implementation

Create an instance of Adman first

Then, set up ad request parameters. You can use the same SDK installation for both Voice Ads and Active Audio.

Voice Ads parameters example

Active Audio parameters example

If you need to switch between Voice Ads and Active Audio ads, add the following when updating the request parameters

Usage example:

circle-exclamation

Adding on-device recognition models

Wake word model (Hey, radio): spot_hey_radio_enUS.snsrarrow-up-right

On-device recognition models (separate from the wake word):

List of available models for on-device recognition (more to come):

Implementation example:

circle-info

If you want to add more models for on-device recognition, add one more VoiceRecognitionEmbedded::addModel with another model.

Ad Request and Playback

circle-exclamation

Ad Request and Playback for Voice Ads:

This is just a single use-case. You can request an ad at another event, but please keep the above sequence unchanged.

Ad Request and Playback for Active Audio:

If your request parameters were set for Active Audio, the above method will request an ad and then play it right away.

Please find the general usage example HEREarrow-up-right

Active Audio Request and Playback for server side in-stream insertion

First of all, you need to request an ad from our Ad Server. It can be done via VAST-Tag:

https://x3.instreamatic.com/v5/vast/1976?microphone=1&type=vor&device_id=<gaid/idfa>&gender=<gender>&age=<age>&ip=<ip>&user_id=<userid>&user_agent=<useragent>

Where:

Parameter Name

Description

user_id

Optional user identifier. You can send us your in-app identifıers for better targetıngç

ip

ip address for geo-targeting

gender

Gender parameter for targeting

age

Age parameter for targeting in min-max format

device_id

Advertising identifier. It's possible to put idfa or gaid there.

user_agent

UserAgent of the client application

Example:

circle-info

Instreamatic VOR Ad can be identified by the following values in the VAST Document:

  • “instreamatic” in the <AdSystem> tag;

  • “![CDATA[ vor ]]” in the “Type” extension

The combination of the two values above indicates the VOR Ad.

The Audio Ad can be found in the <MediaFiles> section of the VAST Document. This is the part for in-stream insertion.

Example:

It’s possible to get audio files in different codecs: MP3 192kbps/128kbps, AAC 32kbps/64kbps, m4a 32kbps/64kbps.

circle-exclamation

At the ad placement with Active Audio, call the following method:

Instreamatic SDK will start listening to the wake-word and you'll receive the START_DETECT event.

The SDK will wait for the wake-word while the ad is playing. You can retrieve the ad duration using the below method (if needed):

If SDK will catch the wake-word, it will enable the mic for command recognition. STOP_DETECT event will be reported.

Then the SDK will send the START event from AdmanVoice-module. This event must be used as an indication of the moment when the stream volume must be lowered.

At the end of the recognition session, the SDK will send the STOP event. This event must be used as an indication of the moment when the stream volume must be turned back on.

Don’t forget to call adman.sendCanShow() on all the ad placements even if there is no ad to play.

Last updated