bilibili小游戏
指南
API
服务端
资源
FAQ
问题反馈
›
音频
概述
基础
系统信息
bl.getSystemInfo
bl.getSystemInfoSync
bl.getAppBaseInfo
更新
bl.getUpdateManager
UpdateManager
UpdateManager.applyUpdate
UpdateManager.onCheckForUpdate
UpdateManager.onUpdateFailed
UpdateManager.onUpdateReady
生命周期
bl.offShow
bl.onShow
bl.offHide
bl.onHide
bl.exitMiniProgram
bl.getLaunchOptions
bl.getLaunchOptionsSync
bl.getEnterOptionsSync
应用级事件
bl.offError
bl.onError
bl.offAudioInterruptionEnd
bl.onAudioInterruptionEnd
bl.offAudioInterruptionBegin
bl.onAudioInterruptionBegin
触摸事件
bl.offTouchCancel
bl.onTouchCancel
bl.onTouchEnd
bl.offTouchEnd
bl.offTouchMove
bl.onTouchMove
bl.offTouchStart
bl.onTouchStart
Touch
性能
bl.triggerGC
分包加载
bl.loadSubpackage
LoadSubpackageTask
LoadSubpackageTask.onProgressUpdate
定时器
setTimeout
clearTimeout
setInterval
clearInterval
调试
bl.setEnableDebug
console.debug
console.log
console.info
console.warn
console.error
bl.getLogManager
LogManager
LogManager.debug
LogManager.info
LogManager.log
LogManager.warn
渲染
画布
bl.createCanvas
Canvas.toTempFilePath
Canvas.toTempFilePathSync
Canvas.getContext
Canvas.toDataURL
RenderingContext
帧率
bl.setPreferredFramesPerSecond
requestAnimationFrame
cancelAnimationFrame
字体
bl.loadFont
bl.getTextLineHeight
图片
bl.createImage
Image
界面
交互
bl.showToast
bl.hideToast
bl.showLoading
bl.hideLoading
bl.showModal
bl.showActionSheet
bl.showAddToDesktopGuide
键盘
bl.offKeyboardComplete
bl.onKeyboardComplete
bl.offKeyboardConfirm
bl.onKeyboardConfirm
bl.offKeyboardInput
bl.onKeyboardInput
bl.updateKeyboard
bl.hideKeyboard
bl.showKeyboard
菜单
bl.setMenuStyle
bl.getMenuButtonBoundingClientRect
状态栏
bl.setStatusBarStyle
窗口
bl.offWindowResize
bl.onWindowResize
数据分析
bl.launchSuccess
bl.reportScene
网络
发起请求
bl.request
下载
bl.downloadFile
DownloadTask
DownloadTask.abort
DownloadTask.onProgressUpdate
DownloadTask.offProgressUpdate
上传
bl.uploadFile
UploadTask
UploadTask.abort
UploadTask.offHeadersReceived
UploadTask.offProgressUpdate
UploadTask.onProgressUpdate
UploadTask.onHeadersReceived
WebSocket
bl.connectSocket
SocketTask
SocketTask.close
SocketTask.onClose
SocketTask.onError
SocketTask.onMessage
SocketTask.onOpen
SocketTask.send
转发
bl.showShareMenu
bl.hideShareMenu
bl.offShareAppMessage
bl.onShareAppMessage
bl.shareAppMessage
数据缓存
bl.getStorageInfoSync
bl.getStorageInfo
bl.clearStorageSync
bl.clearStorage
bl.removeStorageSync
bl.removeStorage
bl.setStorageSync
bl.setStorage
bl.getStorageSync
bl.getStorage
媒体
音频
bl.createInnerAudioContext
bl.setInnerAudioOption
InnerAudioContext
InnerAudioContext.destroy
InnerAudioContext.offCanplay
InnerAudioContext.offEnded
InnerAudioContext.offError
InnerAudioContext.offPause
InnerAudioContext.offPlay
InnerAudioContext.offSeeked
InnerAudioContext.offSeeking
InnerAudioContext.offStop
InnerAudioContext.offTimeUpdate
InnerAudioContext.offWaiting
InnerAudioContext.onCanplay
InnerAudioContext.onEnded
InnerAudioContext.onError
InnerAudioContext.onPause
InnerAudioContext.onPlay
InnerAudioContext.onSeeked
InnerAudioContext.onSeeking
InnerAudioContext.onStop
InnerAudioContext.onTimeUpdate
InnerAudioContext.onWaiting
InnerAudioContext.pause
InnerAudioContext.play
InnerAudioContext.seek
InnerAudioContext.stop
图片
bl.saveImageToPhotosAlbum
视频
bl.saveVideoToPhotosAlbum
bl.createVideo
Video
Video.destroy
Video.play
Video.pause
Video.stop
Video.seek
Video.requestFullScreen
Video.exitFullScreen
Video.onWaiting
Video.offWaiting
Video.onProgress
Video.offProgress
Video.onPlay
Video.offPlay
Video.onPause
Video.offPause
Video.onEnded
Video.offEnded
Video.onTimeUpdate
Video.offTimeUpdate
Video.onError
Video.offError
相机
bl.createCamera
Camera
Camera.destroy
Camera.onAuthCancel
Camera.onCameraFrame
Camera.onStop
Camera.startRecord
Camera.stopRecord
Camera.takePhoto
Camera.closeFrameChange
Camera.listenFrameChange
位置
bl.getLocation
文件
bl.getFileSystemManager
FileSystemManager
FileSystemManager.access
FileSystemManager.accessSync
FileSystemManager.appendFile
FileSystemManager.appendFileSync
FileSystemManager.copyFile
FileSystemManager.copyFileSync
FileSystemManager.getFileInfo
FileSystemManager.getSavedFileList
FileSystemManager.mkdir
FileSystemManager.mkdirSync
FileSystemManager.readFile
FileSystemManager.readFileSync
FileSystemManager.readdir
FileSystemManager.readdirSync
FileSystemManager.rename
FileSystemManager.removeSavedFile
FileSystemManager.renameSync
FileSystemManager.rmdir
FileSystemManager.rmdirSync
FileSystemManager.saveFile
FileSystemManager.saveFileSync
FileSystemManager.stat
FileSystemManager.statSync
FileSystemManager.unlink
FileSystemManager.unlinkSync
FileSystemManager.unzip
FileSystemManager.writeFile
FileSystemManager.writeFileSync
Stats
Stats.isDirectory
Stats.isFile
设备
蓝牙-通用
bl.openBluetoothAdapter
bl.closeBluetoothAdapter
bl.startBluetoothDevicesDiscovery
bl.stopBluetoothDevicesDiscovery
bl.getConnectedBluetoothDevices
bl.getBluetoothDevices
bl.getBluetoothAdapterState
bl.onBluetoothDeviceFound
bl.onBluetoothAdapterStateChange
bl.offBluetoothDeviceFound
bl.offBluetoothAdapterStateChange
bl.isBluetoothDevicePaired
蓝牙-低功耗中心设备
bl.createBLEConnection
bl.closeBLEConnection
bl.getBLEDeviceServices
bl.getBLEDeviceCharacteristics
bl.getBLEMTU
bl.getBLEDeviceRSSI
bl.notifyBLECharacteristicValueChange
bl.readBLECharacteristicValue
bl.writeBLECharacteristicValue
bl.setBLEMTU
bl.onBLEConnectionStateChange
bl.onBLECharacteristicValueChange
bl.onBLEMTUChange
bl.offBLEConnectionStateChange
bl.offBLECharacteristicValueChange
bl.offBLEMTUChange
蓝牙-低功耗外围设备
bl.createBLEPeripheralServer
bl.onBLEPeripheralConnectionStateChanged
bl.offBLEPeripheralConnectionStateChanged
BLEPeripheralServer
BLEPeripheralServer.addService
BLEPeripheralServer.removeService
BLEPeripheralServer.startAdvertising
BLEPeripheralServer.stopAdvertising
BLEPeripheralServer.writeCharacteristicValue
BLEPeripheralServer.close
BLEPeripheralServer.onCharacteristicWriteRequest
BLEPeripheralServer.onCharacteristicReadRequest
BLEPeripheralServer.onCharacteristicSubscribed
BLEPeripheralServer.onCharacteristicUnsubscribed
BLEPeripheralServer.offCharacteristicWriteRequest
BLEPeripheralServer.offCharacteristicReadRequest
BLEPeripheralServer.offCharacteristicSubscribed
BLEPeripheralServer.offCharacteristicUnsubscribed
电量
bl.getBatteryInfoSync
bl.getBatteryInfo
剪切板
bl.setClipboardData
bl.getClipboardData
设备方向
bl.onDeviceMotionChange
bl.offDeviceMotionChange
bl.stopDeviceMotionListening
bl.startDeviceMotionListening
bl.setDeviceOrientation
bl.restoreDeviceOrientation
bl.getDeviceOrientationSync
网络
bl.onNetworkStatusChange
bl.getNetworkType
震动
bl.vibrateLong
bl.vibrateShort
性能
bl.onMemoryWarning
屏幕
bl.setScreenBrightness
bl.setKeepScreenOn
bl.getScreenBrightness
bl.onUserCaptureScreen
bl.setStatusBarHidden
加速计
bl.stopAccelerometer
bl.startAccelerometer
bl.onAccelerometerChange
bl.offAccelerometerChange
罗盘
bl.stopCompass
bl.startCompass
bl.onCompassChange
bl.offCompassChange
陀螺仪
bl.stopGyroscope
bl.startGyroscope
bl.onGyroscopeChange
bl.offGyroscopeChange
开放接口
小游戏跳转
bl.navigateToMiniProgram
APP更新
bl.updateApp
跳转站内链接
bl.openURL
打开站内视频链接
bl.openVideoDetail
用户信息
bl.getUserInfo
bl.createUserInfoButton
UserInfo
UserInfoButton
UserInfoButton.destroy
UserInfoButton.hide
UserInfoButton.offTap
UserInfoButton.onTap
UserInfoButton.show
实名认证状态
关注
bl.getGameFollowingStatus
bl.onGameFollowedFromMenu
bl.offGameFollowedFromMenu
bl.followGameUpper
bl.getGameUpperFollowingStatus
邀请
bl.getInvitationData
bl.getInvitationDetail
bl.getInvitationReward
ShareActivityInfo
InviteesInfo
赠送头像框
bl.presentPendant
登陆
bl.checkSession
bl.login
授权
bl.authorize
设置
bl.openSetting
bl.getSetting
AuthSetting
bl.createOpenSettingButton
OpenSettingButton
OpenSettingButton.destroy
OpenSettingButton.hide
OpenSettingButton.offTap
OpenSettingButton.onTap
OpenSettingButton.show
小游戏互跳
bl.showGameListButton
bl.closeGameListButton
预约游戏
bl.getGameReserveManager
GameReserveManager
GameReserveManager.getReserveInfo
GameReserveManager.reserve
手游下载
bl.getRelatedGameManager
RelatedGameManager
RelatedGameManager.getDownloadInfo
RelatedGameManager.showDownloadDetailPage
支付
bl.requestRecharge
开放数据域名
bl.getUserCloudStorage
bl.removeUserCloudStorage
bl.setUserCloudStorage
bl.getFollowingCloudStorage
bl.getAllCloudStorage
bl.getOpenDataContext
bl.followCloudUpper
bl.onMessage
UserGameData
KVData
KeyGameDataList
SingleUserGameDataList
OpenDataContext.postMessage
订阅消息
bl.requestSubscribeMessage
意见反馈
bl.createFeedbackButton
FeedbackButton
FeedbackButton.hide
FeedbackButton.offTap
FeedbackButton.onTap
FeedbackButton.show
角色创建上报
bl.createRole
敏感词查询
bl.sensitiveWordCheck
账号信息
bl.getAccountInfo
bl.getAccountInfoSync
人脸检测
bl.createFaceDetection
FaceDetection
FaceDetection.send
FaceDetection.onResult
FaceDetection.onError
FaceDetection.close
【必接】侧边栏能力
bl.checkScene
bl.navigateToScene
添加到桌面
bl.addShortcut
bl.checkShortcut
第三方服务
声网(Agora)
Cocos 声网接入指南
游戏对局回放
bl.getGameRecorder
GameRecorder
GameRecorder
GameRecorder.abort
GameRecorder.isAtempoSupported
GameRecorder.isFrameSupported
GameRecorder.isSoundSupported
GameRecorder.isVolumeSupported
GameRecorder.off
GameRecorder.on
GameRecorder.pause
GameRecorder.start
GameRecorder.stop
bl.createGameRecorderShareButton
GameRecorderShareButton
GameRecorderShareButton
GameRecorderShareButton.hide
GameRecorderShareButton.show
GameRecorderShareButton.onTap
GameRecorderShareButton.offTap
广告
bl.createRewardedVideoAd
RewardedVideoAd
RewardedVideoAd
RewardedVideoAd.load
RewardedVideoAd.show
RewardedVideoAd.destroy
RewardedVideoAd.onLoad
RewardedVideoAd.offLoad
RewardedVideoAd.onClose
RewardedVideoAd.offClose
RewardedVideoAd.onError
RewardedVideoAd.offError
客服能力
bl.openCustomerServiceConversation
InnerAudioContext.onCanplay(function callback)
监听音频进入可以播放状态的事件。但不保证后面可以流畅播放
参数
function callback
音频进入可以播放状态的事件的回调函数
←
InnerAudioContext.offWaiting
InnerAudioContext.onEnded
→
参数
function callback