我正在一个带有音乐的网站上构建一个包装器应用程序。我想添加此媒体控件SystemMediaTransportControls
我在项目中添加了@nodert-win10/windows.media
和@nodert-win10/windows.media.playback
个依赖项。我找到了一个code,据我所知,可以做到,但我不知道如何使这个元素变得更好。我错过了什么?这是我的代码:
const { MediaPlaybackStatus, MediaPlaybackType }= require('@nodert-win10/windows.media');
const { BackgroundMediaPlayer } = require('@nodert-win10/windows.media.playback');
const Controls = BackgroundMediaPlayer.current.systemMediaTransportControls;
Controls.isChannelDownEnabled = false;
Controls.isChannelUpEnabled = false;
Controls.isFastForwardEnabled = false;
Controls.isNextEnabled = true;
Controls.isPauseEnabled = true;
Controls.isPlayEnabled = true;
Controls.isPreviousEnabled = true;
Controls.isRecordEnabled = false;
Controls.isRewindEnabled = false;
Controls.isStopEnabled = true;
Controls.playbackStatus = MediaPlaybackStatus.closed;
Controls.displayUpdater.type = MediaPlaybackType.music;
Controls.displayUpdater.musicProperties.title = 'TestTitle';
Controls.displayUpdater.musicProperties.arti
并在跟踪更改处理程序中:
Controls.playbackStatus = MediaPlaybackStatus.playing;