Skip to content

Commit 60f5a02

Browse files
committed
Support external audio
1 parent 18f6cf9 commit 60f5a02

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

twitchio/ext/overlays/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ def set_audio(self, file: str | os.PathLike[str]) -> Self:
128128
data: NodeDataT = {}
129129
identifier: str = secrets.token_urlsafe(4)
130130

131+
uri = f"media/{file}" if not str(file).startswith(("http://", "https://")) else file
131132
data["type"] = "audio"
132133
data["location"] = str(file)
133134
data["html_id"] = identifier
134-
data["raw"] = f"<audio id='{identifier}'><source src='media/{file}'></audio>"
135+
data["raw"] = f"<audio id='{identifier}'><source src='{uri}'></audio>"
135136

136137
node = Node(data)
137138
self._audio = node

0 commit comments

Comments
 (0)