LivePlayerContext.requestFullScreen
解释:进入全屏
方法参数
Object object
object参数说明 :
示例
扫码体验
请使用百度APP扫码
图片示例
代码示例1 正常竖向
在开发者工具中预览效果 -
<view class="live-play"> <live-player id="myLive" src="{{src}}"></live-player> <div class="section"> <button type="primary" bind:tap="requestFullScreen">进入全屏</button> </div></view>
-
Page({data: {cur: 0,autoplay: false,src: 'https://vd3.bdstatic.com/mda-ia8e6q3g23py8qdh/hd/mda-ia8e6q3g23py8qdh.mp4?playlist=%5B%22hd%22%5D&auth_key=1521549485-0-0-d5d042ba3555b2d23909d16a82916ebc&bcevod_channel=searchbox_feed&pd=share'},onShow(){console.log('目前此组件在真机双端不能播放,请在开发者工具中查看完整效果');},onReady(e) {const livePlayerContext = swan.createLivePlayerContext('myLive');this.livePlayerContext = livePlayerContext;this.livePlayerContext.play();},requestFullScreen(e) {this.livePlayerContext.requestFullScreen({direction: 0});}});
代码示例2 屏幕逆时针90度
在开发者工具中预览效果 -
<view class="live-play"><live-player id="myLive" src="{{src}}"></live-player><div class="section"><button type="primary" bind:tap="requestFullScreen">进入全屏</button></div></view>
-
Page({data: {cur: 0,autoplay: false,src: 'https://vd3.bdstatic.com/mda-ia8e6q3g23py8qdh/hd/mda-ia8e6q3g23py8qdh.mp4?playlist=%5B%22hd%22%5D&auth_key=1521549485-0-0-d5d042ba3555b2d23909d16a82916ebc&bcevod_channel=searchbox_feed&pd=share'},onShow(){console.log('目前此组件在真机双端不能播放,请在开发者工具中查看完整效果');},onReady(e) {const livePlayerContext = swan.createLivePlayerContext('myLive');this.livePlayerContext = livePlayerContext;this.livePlayerContext.play();},requestFullScreen(e) {this.livePlayerContext.requestFullScreen({direction: 90});}});
代码示例3 屏幕顺时针90度
在开发者工具中预览效果 -
Page({data: {cur: 0,autoplay: false,src: 'https://vd3.bdstatic.com/mda-ia8e6q3g23py8qdh/hd/mda-ia8e6q3g23py8qdh.mp4?playlist=%5B%22hd%22%5D&auth_key=1521549485-0-0-d5d042ba3555b2d23909d16a82916ebc&bcevod_channel=searchbox_feed&pd=share'},onShow(){console.log('目前此组件在真机双端不能播放,请在开发者工具中查看完整效果');},onReady(e) {const livePlayerContext = swan.createLivePlayerContext('myLive');this.livePlayerContext = livePlayerContext;this.livePlayerContext.play();},requestFullScreen(e) {this.livePlayerContext.requestFullScreen({direction: -90});}});
