Package: alexa-browser-client
Alexa Browser ClientAlexa client in your browser. Django app. Talk to Alexa from your desktop, phone, or tablet browser.DemoThe demo should really be heard, so click the gif below to view it in youtube.Run the demoFirst follow these steps:Configure your Amazon oauth configurationSet your environment variablesInstall:$gitclonegit@github.com:richtier/alexa-browser-client.git
$cdalexa-browser-client
$virtualenv.venv-ppython3.6&&source.venv/bin/activate&&maketest_requirementsCompile snowboy$ make demoGo tohttp://localhost:8000for basic demo, orhttp://localhost:8000/mixer/to play with the response audioInstallationpip install alexa_browser_clientMake sure your settingsINSTALLED_APPScontains at least these entries:INSTALLED_APPS = [
    'django.contrib.staticfiles',
    'channels',
    'alexa_browser_client',
]DependenciesSnowboydetects when the wakeword "Alexa" is uttered.You must compileSnowboymanually. Copy the compiledsnowboyfolder to the top level of you project. By default, the folder structure should be:.
├── ...
├── snowboy
|   ├── snowboy-detect-swig.cc
|   ├── snowboydetect.py
|   └── resources
|       ├── alexa.umdl
|       └── common.res
└── ...If the default folder structure does not suit your needs you cancustomize the wakeword detector.Routing and urlsAddurl(r'^', include('alexa_browser_client.config.urls')),tourls.pyurl_patterns.Addinclude('alexa_browser_client.config.routing.channel_routing')to yourrouting.pychannel_routing.AuthenticationThis app uses Alexa Voice Service. To use AVS you must first have adeveloper account. Then register your producthere. Choose "Application" under "Is your product an app or a device"?Ensure you update your settings.py:SettingNotesALEXA_BROWSER_CLIENT_AVS_CLIENT_IDRetrieve by clicking on the your product listedhereALEXA_BROWSER_CLIENT_AVS_CLIENT_SECRETRetrieve by clicking on the your product listedhereALEXA_BROWSER_CLIENT_AVS_DEVICE_TYPE_IDRetrieve by reading "Product ID"hereRefresh tokenYou will need to login to Amazon via a web browser to get your refresh token.To enable this first gohereand click on your product to set some security settings underSecurity Profileand, assuming you're running on localhost:8000, set the following:settingvalueAllowed Originshttps://localhost:8000/refreshtoken/Allowed Return URLshttps://localhost:8000/refreshtoken/callback/UsageOnce you have all the settings configured:Run django:./manage.py runserverGo tohttp://localhost:8000and start talking to Alexa.CustomizationWakewordThe default wakeword is "Alexa". You can change this by customizing the lifecycle'saudio_detector_class:# my_project/consumers.pyimportalexa_browser_clientimportcommand_lifecycleclassCustomAudioDetector(command_lifecycle.wakeword.SnowboyWakewordDetector):wakeword_library_import_path='dotted.import.path.to.wakeword.Detector'resource_file=b'path/to/resource_file.res'decoder_model=b'path/to/model_file.umdl'classCustomAudioLifecycle(alexa_browser_client.AudioLifecycle):audio_detector_class=CustomAudioDetectorclassCustomAlexaConsumer(alexa_browser_client.AlexaConsumer):audio_lifecycle_class=CustomAudioLifecycleThen in yourrouting.py:import alexa_browser_client.consumers
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.sessions import SessionMiddlewareStack

from django.conf.urls import url


application = ProtocolTypeRouter({
    'websocket': SessionMiddlewareStack(
        URLRouter([
            url(r"^ws/$", alexa_browser_client.consumers.AlexaConsumer),
        ])
    ),
})VersioningWe useSemVerfor versioning. For the versions available, see thePyPI.Other projectsThis project usesVoice Command LifecycleandAlexa Voice Service Client.