title: VideoContext.showStatusBar header: develop nav: api

sidebar: videocontext_VideoContext-showStatusBar

解释:显示状态栏,仅在iOS全屏下有效。

方法参数

示例

在开发者工具中预览效果

扫码体验

sidebar: videocontext_VideoContext-showStatusBar - 图1 请使用百度APP扫码

代码示例

  • 在 swan 文件中
  1. <view class="wrap">
  2. <video id="myVideo" enable-danmu="true" src="https://b.bdstatic.com/swan-temp/940fe716b0eaad38f47b209d61657490.mp4"></video>
  3. <button bindtap="showStatusBar">点击显示状态栏</button>
  4. </view>
  • 在 js 文件中
  1. Page({
  2. data: { },
  3. onLoad() {
  4. const videoContext = swan.createVideoContext('myVideo');
  5. this.videoContext = videoContext;
  6. this.videoContext.play();
  7. },
  8. showStatusBar() {
  9. this.videoContext.requestFullScreen({direction: 90});
  10. let that = this;
  11. setTimeout(function () {
  12. this.videoContext.showStatusBar();
  13. })
  14. }
  15. });

Bug & Tip

  • bug:ios13 系统问题暂不支持本 API