VideoContext.requestFullScreen
收藏
我的收藏

基础库 1.18.0 开始支持本方法,这是一个同步方法。

进入全屏。

前提条件
业务背景
使用限制
注意事项
支持沙盒
相关教程

语法

VideoContext.requestFullScreen(options)

参数说明

options 类型说明

object 类型,属性如下:

属性名类型默认值必填说明最低支持版本
directionenum
用来控制进入全屏时画面朝向
1.18.0

direction 的合法值

说明最低支持版本
0
正常竖向
1.18.0
90
屏幕逆时针 90 度
1.18.0
-90
屏幕顺时针 90 度
1.18.0

返回值

扫码体验

请使用字节宿主APP扫码

代码示例

开发者工具中预览

<video style="width: 240px; height: 180px;" />
<view style="display: flex; justify-co   <button bindtap=" requestFullScreen" size="mini">RequestFullScreen</button>
</view>
Page({
  videoContext: undefined,

  onReady() {
    this.videoContext = tt.createVideoContext("myVideo");
  },

  // 进入全屏
  requestFullScreen() {
    this.videoContext.requestFullScreen({ direction: -90 });
  },
});