演示模式
UniverSlidesUIPlugin 为当前演示文稿提供播放能力。播放按幻灯片顺序依次进行,标记为跳过的幻灯片会被略过,每一步都应用解析后的切换效果。
开始播放
TypeScript
const presentation = univerAPI.getActivePresentation()if (presentation) { await univerAPI.executeCommand('slide.operation.presentation.start', { unitId: presentation.getId(), fromBeginning: true, })}传入 fromBeginning: false 时,从当前活动的幻灯片开始播放;也可以传入 startSlideId,指定一张可见的幻灯片作为起点。
导航与停止
TypeScript
await univerAPI.executeCommand('slide.operation.presentation.next')await univerAPI.executeCommand('slide.operation.presentation.previous')await univerAPI.executeCommand('slide.operation.presentation.go-to-slide', { slideId: 'summary-slide',})await univerAPI.executeCommand('slide.operation.presentation.stop')在最后一张可见幻灯片上执行下一页命令会停止播放;在首页执行上一页命令会返回 false。
浏览器行为
全屏和双屏演示命令依赖浏览器 API。观众窗口必须在用户手势中直接打开,否则会被弹窗拦截。只读的 Slides UI 在注册 UI 插件并关闭编辑后,仍然可以运行演示模式。
你觉得这篇文档如何?