working on foundational examples
This commit is contained in:
@@ -5,7 +5,6 @@ import os
|
|||||||
|
|
||||||
from dailyai.services.daily_transport_service import DailyTransportService
|
from dailyai.services.daily_transport_service import DailyTransportService
|
||||||
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
||||||
from dailyai.services.playht_ai_service import PlayHTAIService
|
|
||||||
|
|
||||||
from examples.support.runner import configure
|
from examples.support.runner import configure
|
||||||
|
|
||||||
@@ -13,19 +12,14 @@ logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s")
|
|||||||
logger = logging.getLogger("dailyai")
|
logger = logging.getLogger("dailyai")
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
async def main(room_url):
|
async def main(room_url):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
# create a transport service object using environment variables for
|
|
||||||
# the transport service's API key, room url, and any other configuration.
|
|
||||||
# services can all define and document the environment variables they use.
|
|
||||||
# services all also take an optional config object that is used instead of
|
|
||||||
# environment variables.
|
|
||||||
#
|
|
||||||
# the abstract transport service APIs presumably can map pretty closely
|
|
||||||
# to the daily-python basic API
|
|
||||||
meeting_duration_minutes = 5
|
|
||||||
transport = DailyTransportService(
|
transport = DailyTransportService(
|
||||||
room_url, None, "Say One Thing", meeting_duration_minutes, mic_enabled=True
|
room_url,
|
||||||
|
None,
|
||||||
|
"Say One Thing",
|
||||||
|
mic_enabled=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
tts = ElevenLabsTTSService(
|
tts = ElevenLabsTTSService(
|
||||||
@@ -37,7 +31,6 @@ async def main(room_url):
|
|||||||
# Register an event handler so we can play the audio when the participant joins.
|
# Register an event handler so we can play the audio when the participant joins.
|
||||||
@transport.event_handler("on_participant_joined")
|
@transport.event_handler("on_participant_joined")
|
||||||
async def on_participant_joined(transport, participant):
|
async def on_participant_joined(transport, participant):
|
||||||
nonlocal tts
|
|
||||||
if participant["info"]["isLocal"]:
|
if participant["info"]["isLocal"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user