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:
Please note that the application must be developed as a foreground service. And the foreground service must be launched while the activity is visible. Microphone access must be declared for foreground service as well. Please see the link below for reference:
For an actual example of foreground service, please click HERE
(Please turn off the AdBlocker to access the repository)
Project Configuration
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:
This approach to Active Audio must be used when you are going to play the ad with Instreamatic SDK. If you are going to play it with your own player or insert it into a stream, please see below for detailed instructions.
You can use the default approach for Voice Ads though.
Adding on-device recognition models
Wake word model (Hey, radio): spot_hey_radio_enUS.snsr
On-device recognition models (separate from the wake word):
List of available models for on-device recognition (more to come):
Language
Language Code
Filename
Implementation example:
If you want to add more models for on-device recognition, add one more VoiceRecognitionEmbedded::addModel with another model.
Ad Request and Playback
This approach to Active Audio must be used when you are going to play the ad with Instreamatic SDK. If you are going to play it with your own player or insert it into a stream, please see below for detailed instructions.
You can use the default approach for Voice Ads though.
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 HERE
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:
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.
Before playing an ad, the XML response must be converted to an array of bytes.
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