In this sample, fileIo is used to obtain an audio file; AudioPlayer is used to play music, pause the playback, and play the next or previous song; DeviceManager is used to display the distributed device list and hop music playback across devices. The display effect is as follows:
Audio playback: The media subsystem provides audio and video services and implements audio playback by using AudioPlayer.
Data hop: The distributed data management module implements collaboration between databases of different devices for applications. The APIs provided by distributed data management can be used to save data to the distributed database and perform operations such as adding, deleting, modifying, and querying data in the distributed database.
ohos.permission.DISTRIBUTED_DATASYNC
Play music. Touch the buttons on the music player to play music, pause the playback, and play the next or previous music clip.
Play music across devices. On the Super Device formed by multiple networked devices, touch the Hop button and select a device to play the music on the peer device.
This sample can only be run on standard-system devices.
This sample is based on the stage model, which is supported from API version 9.
This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。