ทดสอบเสียงบลูทูธในโปรแกรมจำลอง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ในโปรแกรมจำลอง Wear OS รูปภาพระบบที่ใช้ Wear OS 4 ขึ้นไปรวมถึง
การสนับสนุนบลูทูธจำลอง การสนับสนุนนี้ช่วยให้คุณทดสอบกรณีการใช้งานต่างๆ ได้
ที่เกี่ยวข้องกับเสียงบลูทูธ
จับคู่กับโทรศัพท์จำลอง
เมื่อใช้การสนับสนุนบลูทูธของโปรแกรมจำลอง คุณจะจับคู่กับโทรศัพท์ที่จำลองได้ ถึง
ให้เปิดใช้งานวิซาร์ดการตั้งค่าจากบรรทัดคำสั่งดังนี้
-append-userspace-opt androidboot.setupwizard_mode=REQUIRED
เล่นเสียงผ่านอุปกรณ์เอาต์พุตจำลอง
เมื่อใช้การสนับสนุนบลูทูธของโปรแกรมจำลอง คุณยังสามารถเล่นเสียงผ่าน
อุปกรณ์เอาต์พุตบลูทูธจำลอง ในการทดสอบการสลับเอาต์พุตเสียงใน
โปรแกรมจำลอง ให้เชื่อมต่อกับอุปกรณ์เอาต์พุตบลูทูธที่จำลองโดยใช้โอเพนซอร์ส
Bumble Project
เตรียมสภาพแวดล้อมของคุณ
เตรียมเครื่องสำหรับการพัฒนาเพื่อใช้งาน Bumble โปรดทำตามขั้นตอนต่อไปนี้
ขั้นตอน:
เรียกซอร์สโค้ดของ Bumble
git clone https://github.com/google/bumble
ไปที่ไดเรกทอรี bumble
จากนั้นสร้างและติดตั้ง
โมดูล Bumble:
cd bumble && python3 -m pip install "."
เปิดลำโพงบลูทูธจำลอง
หากต้องการเปิดลำโพงจำลอง ให้ทำตามขั้นตอนต่อไปนี้
เปิดโปรแกรมจำลองเวอร์ชันที่รองรับ Wear OS 4 ขึ้นไป
หมายเหตุ: หากคุณใช้เวอร์ชันโปรแกรมจำลอง
ที่ต่ำกว่า 33.1.10 ให้เรียกใช้โปรแกรมจำลองจากบรรทัดคำสั่งโดยใช้
พารามิเตอร์ -packet-streamer-endpoint default
หากต้องการค้นหาและเชื่อมต่อกับลำโพงจำลอง ให้เรียกใช้คำสั่งต่อไปนี้
ในไดเรกทอรี bumble
:
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim stdout | ffplay -i
เอาต์พุตเสียงจะเล่นผ่านลำโพงคอมพิวเตอร์ของคุณ
คุณยังสามารถเปลี่ยนเส้นทางเอาต์พุตไปยังไฟล์ได้ด้วย โดยทำดังนี้
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim output.sbc
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Test Bluetooth audio on emulators\n\nOn the Wear OS emulator, system images that run Wear OS 4 or higher include\nsupport for emulated Bluetooth. This support lets you test several use cases\nrelated to Bluetooth audio.\n\nPair with an emulated phone\n---------------------------\n\nUsing the emulator's Bluetooth support, you can pair with an emulated phone. To\ndo so, enable the setup wizard from the command line: \n\n -append-userspace-opt androidboot.setupwizard_mode=REQUIRED\n\nPlay audio through an emulated output device\n--------------------------------------------\n\nUsing the emulator's Bluetooth support, you can also play audio through an\nemulated Bluetooth output device. To test audio output switching in the\nemulator, connect to an emulated Bluetooth output device using the open source\n[Bumble project](https://www.github.com/google/bumble).\n\n### Prepare your environment\n\nTo prepare your development machine for using Bumble, complete the following\nsteps:\n\n1. Fetch the Bumble source code:\n\n ```\n git clone https://github.com/google/bumble\n ```\n2. Navigate to the `bumble` directory, then build and install\n Bumble modules:\n\n ```\n cd bumble && python3 -m pip install \".\"\n ```\n\n### Launch emulated Bluetooth speaker\n\nTo launch the emulated speaker, complete the following steps:\n\n1. Launch a version of the emulator that supports Wear OS 4 or higher.\n\n **Note:** If you're using an emulator version\n lower than 33.1.10, launch the emulator from the command line using the\n `-packet-streamer-endpoint default` parameter.\n2. To discover and connect to the emulated speaker, run the following\n command in the `bumble` directory:\n\n ```\n python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \\\n android-netsim stdout | ffplay -i\n ```\n\n The audio output is played through your computer's speakers.\n\n You can also redirect output to a file: \n\n ```\n python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \\\n android-netsim output.sbc\n ```"]]