@coze/realtime-api 1.0.1 → 1.0.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,11 @@ import { RealtimeClient, EventNames, RealtimeUtils } from "@coze/realtime-api";
45
45
  const client = new RealtimeClient({
46
46
  baseURL: "https://api.coze.cn",
47
47
  accessToken: "your_access_token",
48
+ // or
49
+ // accessToken: async () => {
50
+ // // refresh token if expired
51
+ // return 'your_oauth_token';
52
+ // },
48
53
  botId: "your_bot_id",
49
54
  voiceId: "your_voice_id", // Optional: Specify voice ID
50
55
  conversationId: "conversation_id", // Optional: For conversation continuity
@@ -58,8 +63,8 @@ const client = new RealtimeClient({
58
63
  // Essential Setup
59
64
  async function initializeVoiceChat() {
60
65
  // 1. Verify device permissions
61
- const hasPermission = await RealtimeUtils.checkPermission();
62
- if (!hasPermission) {
66
+ const result = await RealtimeUtils.checkDevicePermission();
67
+ if (!result.audio) {
63
68
  throw new Error("Microphone access required");
64
69
  }
65
70