当前位置: 首页 > news >正文

开发网站去哪里学区块链技术和网站开发结合

开发网站去哪里学,区块链技术和网站开发结合,网站广告连接如何做,做it公司网站应用接续 介绍 基于ArkTS扩展的声明式开发范式编程语言编写的一个分布式视频播放器,主要包括一个直播视频播放界面,实现视频播放时可以从一台设备迁移到另一台设备继续运行,来选择更合适的设备继续执行播放功能以及PAD视频播放时协同调用手…

应用接续

介绍

基于ArkTS扩展的声明式开发范式编程语言编写的一个分布式视频播放器,主要包括一个直播视频播放界面,实现视频播放时可以从一台设备迁移到另一台设备继续运行,来选择更合适的设备继续执行播放功能以及PAD视频播放时协同调用手机编辑发送弹幕功能。

效果预览

1

使用说明

  1. 准备手机端与平板端两台设备,并且登录同一华为账号,双端设备打开WI-FI和蓝牙,建议双端设备接入同一个局域网,可提升数据传输的速度
  2. 双端设备均安装此应用
  3. 滑动浏览手机端视频,打开平板端应用
  4. 点击平板端手机输入按钮,调起手机端输入内容,提交后平板端查看

具体实现

  1. 在实现协同接口前,应用需要申请协同所需的访问控制权ohos.permission.DISTRIBUTED_DATASYNC。 在requestPermissions字段中增加权限声明ohos.permission.DISTRIBUTED_DATASYNC
  2. 同时需要在应用首次启动时弹窗向用户申请授权,在用户手动允许授权后,应用才会真正获取相应权限,从而成功访问操作目标对象。 在EntryAbility类中实现以下函数,从而在调用时动态弹窗向用户申请权限。
/** Copyright (c) 2024 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/import { abilityAccessCtrl, AbilityConstant, bundleManager, Permissions, UIAbility, Want } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { WindowUtil } from '../utils/WindowUtil';
import Logger from '../utils/Logger';export default class EntryAbility extends UIAbility {contentStorage?: LocalStorage;onContinue(wantParam: Record<string, Object>) {Logger.info(wantParam.version.toString(), wantParam.targetDevice.toString());// Preparing to Migrate Datalet activeLive: number = AppStorage.get<number>('activeLive') as number;// Save the data to be migrated in the 'data' field of wantParam.wantParam['activeLive'] = activeLive;// Setting the Source End Not to ExitwantParam["ohos.extra.param.key.supportContinueSourceExit"] = false;Logger.info(activeLive.toString());return AbilityConstant.OnContinueResult.AGREE}onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {Logger.info('Ability onCreate');this.checkPermissions();// If the invoking reason is migration, set the status to migratable to cope with cold start (ensuring migration continuity)if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) {this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {Logger.info(JSON.stringify(result));});}// Cold start of the application: Restore the saved migration dataif (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) {// Restore migrated data from wantlet activeLive = want?.parameters?.activeLive;AppStorage.setOrCreate<number>('activeLive', activeLive as number);Logger.info(activeLive as string);// Explicit invocation of page restorethis.contentStorage = new LocalStorage();Logger.info('Ability onCreate restoreWindowStage');this.context.restoreWindowStage(this.contentStorage);}}onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {Logger.info('Ability onCreate');// If the invoking reason is migration, set the status to migratable to cope with hot start (ensuring migration continuity)if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) {this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {Logger.info(JSON.stringify(result));});}//During the warm start of an application: Restore the saved migration dataif (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) {// Restore migrated data from wantlet activeLive = want?.parameters?.activeLive;AppStorage.setOrCreate<number>('activeLive', activeLive as number);Logger.info(activeLive as string);// Explicit invocation of page restorethis.contentStorage = new LocalStorage();Logger.info('Ability onNewWant restoreWindowStage');this.context.restoreWindowStage(this.contentStorage);}}// Check permission granting and dynamically apply for permissionsasync checkPermissions(): Promise<void> {const permissions: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];let grantStatus: abilityAccessCtrl.GrantStatus = await this.checkAccessToken(permissions[0]);// Verifying Permission Grantingif (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {// GrantedLogger.info('Permission already granted.');} else {// Not granted. Dynamically apply for authorization in the dialog box displayed to the userlet atManager = abilityAccessCtrl.createAtManager();try {atManager.requestPermissionsFromUser(this.context, ['ohos.permission.DISTRIBUTED_DATASYNC'], (err, data) => {Logger.info(JSON.stringify(data));});} catch (err) {Logger.error(JSON.stringify(err));return;}}}// Get the grant status of the current app's permissionsasync checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {let atManager = abilityAccessCtrl.createAtManager();let grantStatus: abilityAccessCtrl.GrantStatus = -1;// Obtains the token IDlet tokenId: number = 0;try {let bundleInfo: bundleManager.BundleInfo =await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;tokenId = appInfo.accessTokenId;} catch (err) {Logger.error(JSON.stringify(err));}try {grantStatus = await atManager.checkAccessToken(tokenId, permission);} catch (err) {Logger.error(JSON.stringify(err));}return grantStatus;}onDestroy(): void {Logger.info('Ability onDestroy');}onWindowStageCreate(windowStage: window.WindowStage): void {// Main window is created, set main page for this abilityLogger.info('Ability onWindowStageCreate');WindowUtil.requestFullScreen(windowStage, this.context);WindowUtil.updateStatusBarColor(this.context, true);windowStage.loadContent('pages/LivePage', (err) => {if (err.code) {Logger.error(JSON.stringify(err) ?? '');return;}Logger.info('Succeeded in loading the content.');});}onWindowStageDestroy(): void {// Main window is destroyed, release UI related resourcesLogger.info('Ability onWindowStageDestroy');}onWindowStageRestore(windowStage: window.WindowStage): void {WindowUtil.requestFullScreen(windowStage, this.context);}onForeground(): void {// Ability has brought to foregroundLogger.info('Ability onForeground');}onBackground(): void {// Ability has back to backgroundLogger.info('Ability onBackground');}
}
  1. 获取目标设备的设备ID。
  2. 在发起端设置目标组件参数,调用startAbilityForResult()接口启动目标端UIAbility,异步回调中的data用于接收目标端UIAbility停止自身后返回给调用方UIAbility的信息。
  3. 在目标端UIAbility任务完成后,调用terminateSelfWithResult()方法,将数据返回给发起端的UIAbility。
  4. 发起端UIAbility接收到目标端UIAbility返回的信息,对其进行处理。

以上就是本篇文章所带来的鸿蒙开发中一小部分技术讲解;想要学习完整的鸿蒙全栈技术。可以在结尾找我可全部拿到!
下面是鸿蒙的完整学习路线,展示如下:
1

除此之外,根据这个学习鸿蒙全栈学习路线,也附带一整套完整的学习【文档+视频】,内容包含如下

内容包含了:(ArkTS、ArkUI、Stage模型、多端部署、分布式应用开发、音频、视频、WebGL、OpenHarmony多媒体技术、Napi组件、OpenHarmony内核、鸿蒙南向开发、鸿蒙项目实战)等技术知识点。帮助大家在学习鸿蒙路上快速成长!

鸿蒙【北向应用开发+南向系统层开发】文档

鸿蒙【基础+实战项目】视频

鸿蒙面经

在这里插入图片描述

为了避免大家在学习过程中产生更多的时间成本,对比我把以上内容全部放在了↓↓↓想要的可以自拿喔!谢谢大家观看!

http://www.yayakq.cn/news/236491/

相关文章:

  • 有二维码怎样做网站山东泰安特产
  • 局域网网站建设协议建站哪家好用兴田德润
  • 个人网站设计制作步骤如何开发自己的app软件
  • 电子商务网站建设题6台州网站搜索引擎优化
  • 有学给宝宝做衣服的网站吗免费网站用官微建站
  • 做下载类网站一年赚多少钱互联网公司排名朗玛
  • 学习网站免费佛山专门做网站设计怎样做
  • 兰州网站建设小程序关于动漫制作专业
  • 电子网站建设心得专业搭建网站
  • 马鞍山哪里做网站一个网站怎么做
  • 南通营销网站建设杭州西湖区网站建设
  • 用网站做的简历做精品课程网站需要啥素材
  • 网站建设与网页设计是什么意思yum wordpress
  • 沈阳做网站价格广州新媒体运营公司排行榜
  • 公司重名 做网站哪些网站做问卷可以赚钱
  • 品牌网站建设哪家好保定商城网站建设
  • seo对网站的作用长尾词挖掘
  • 长春市建设局网站百度关键词seo公司
  • c2c网站的类型2015个人网站如何去工信部备案
  • 典型的营销型企业网站网络空间购买
  • 如何免费申请公司网站做网站需要注意的问题
  • 郑州网站建设搜索优化网站建设是不是都需要交费
  • 如何查看一个网站是用什么cms做的为什么做网站费用贵
  • 做cpa网站自己做的网站涉黄
  • ssr网站怎么做学网页设计怎样
  • 阳原网站建设wordpress 视图插件
  • 怎样在内网建设一个网站广州云购网站建设
  • visio网站开发流程图购买网站源码注意事项
  • 化工材料 技术支持 东莞网站建设国内免费iphone网站
  • 怎么编写网站代码网站制作方案介绍及要求