一区二区三区三上|欧美在线视频五区|国产午夜无码在线观看视频|亚洲国产裸体网站|无码成年人影视|亚洲AV亚洲AV|成人开心激情五月|欧美性爱内射视频|超碰人人干人人上|一区二区无码三区亚洲人区久久精品

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

鴻蒙實(shí)戰(zhàn)開發(fā):【相機(jī)和媒體庫】

jf_46214456 ? 來源:jf_46214456 ? 作者:jf_46214456 ? 2024-03-20 16:36 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

介紹

在ArkTS中調(diào)用相機(jī)拍照和錄像,以及如何使用媒體庫接口進(jìn)行媒體文件的增、刪、改、查操作。本示例用到了

  • 權(quán)限管理能力
  • 相機(jī)模塊能力接口
  • 圖片處理接口
  • 音視頻相關(guān)媒體業(yè)務(wù)能力接口
  • 媒體庫管理接口
  • 設(shè)備信息能力接口
  • 文件存儲(chǔ)管理能力接口
  • 彈窗能力接口

效果預(yù)覽

image.png

使用說明

1.啟動(dòng)應(yīng)用,在權(quán)限彈窗中授權(quán)后返回應(yīng)用,首頁顯示當(dāng)前設(shè)備的相冊信息,首頁監(jiān)聽相冊變化會(huì)刷新相冊列表。

2.點(diǎn)擊 + 按鈕,彈出相機(jī)、錄音、文本文件三個(gè)圖標(biāo)。

3.安裝相機(jī)應(yīng)用[Camera]應(yīng)用后,點(diǎn)擊相機(jī)圖標(biāo),進(jìn)入相機(jī)界面,默認(rèn)是拍照模式,點(diǎn)擊底部拍照按鈕可以拍照,拍照完成會(huì)在底部左側(cè)顯示照片預(yù)覽圖。點(diǎn)擊錄像切換到錄像模式,點(diǎn)擊底部按鈕開始錄像,點(diǎn)擊結(jié)束按鈕結(jié)束錄像,結(jié)束錄像后底部左側(cè)顯示視頻圖標(biāo)。點(diǎn)擊系統(tǒng)Back鍵或界面頂部返回按鈕返回首頁。

4.點(diǎn)擊錄音圖標(biāo)進(jìn)入錄音界面,點(diǎn)擊右側(cè)開始按鈕開始錄音,按鈕變?yōu)闀和0粹o,點(diǎn)擊可以暫停和繼續(xù)錄音,點(diǎn)擊左側(cè)結(jié)束按鈕結(jié)束錄音返回首頁。

5.點(diǎn)擊文本圖標(biāo)進(jìn)入文本編輯界面,輸入文本內(nèi)容后點(diǎn)擊Save按鈕,會(huì)創(chuàng)建并寫入文本文件,完成后返回首頁。

6.點(diǎn)擊相冊進(jìn)入文件列表界面,展示相冊內(nèi)的文件,列表中有刪除重命名按鈕,點(diǎn)擊可以刪除文件和重命名文件。

7.安裝視頻播放[VideoPlayer]應(yīng)用后,點(diǎn)擊視頻文件可以調(diào)起視頻播放界面播放該視頻。

相關(guān)概念

媒體庫管理:媒體庫管理提供接口對公共媒體資源文件進(jìn)行管理,包括文件的增、刪、改、查等。 相機(jī):相機(jī)模塊支持相機(jī)相關(guān)基礎(chǔ)功能的開發(fā),主要包括預(yù)覽、拍照、錄像等。

工程目錄

entry/src/main/ets/
|---MainAbility
|   |---MainAbility.ts                      // 主程序入口,應(yīng)用啟動(dòng)時(shí)獲取相應(yīng)權(quán)限
|---pages
|   |---index.ets                           // 首頁
|   |---AlbumPage.ets                       // 相冊頁面
|   |---CameraPage.ets                      // 相機(jī)頁面
|   |---RecordPage.ets                      // 錄音頁面
|   |---DocumentPage.ets                    // 存儲(chǔ)文件頁面
|---model                                  
|   |---CameraService.ts                    // 相機(jī)模塊(拍照錄像模式)
|   |---DateTimeUtil.ts                     // 日期工具包
|   |---MediaUtils.ts                       // 媒體工具模塊
|   |---RecordModel.ts                      // 錄音模塊(底層能力實(shí)現(xiàn))
|   |---TimeUtils.ts                        // 時(shí)間工具包
|---view                                    
|   |---BasicDataSource.ets                 // 初始化媒體服務(wù)數(shù)組
|   |---MediaItem.ets                       // 定義具體的某一媒體模塊頁面 
|   |---MediaView.ets                       // 媒體模塊的前置模塊(判斷是否有展示的媒體內(nèi)容)
|   |---RenameDialog.ets                    // 重命名文件模塊 
|   |---TitleBar.ets                        // 標(biāo)題欄

具體實(shí)現(xiàn)

  • 布局原理:定義@ObjectLink 裝飾的數(shù)組變量album存放資源文件,使用list()組件中ListItem()循環(huán)數(shù)組展示,加號(hào)Button(),點(diǎn)擊后觸發(fā) animateTo({ duration: 500, curve: Curve.Ease })控制動(dòng)畫展示,[源碼參考]。
/*

 * Copyright (c) 2022-2023 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';

import common from '@ohos.app.ability.common';

import Want from '@ohos.app.ability.Want';

import router from '@ohos.router';

import TitleBar from '../view/TitleBar';

import MediaUtils from '../model/MediaUtils';

import { MediaView } from '../view/MediaView';

import Logger from '../model/Logger';



@Observed

export default class Album {

  constructor(public albumName: string, public count: number, public mediaType?: mediaLibrary.MediaType) {

    this.albumName = albumName;

    this.count = count;

    this.mediaType = mediaType;

  }

}



@Entry

@Component

struct Index {

  private mediaUtils: MediaUtils = MediaUtils.getInstance(getContext(this))

  @State albums: Array< Album > = []

  @State selectIndex: number = 0

  @State operateVisible: boolean = false



  async onPageShow() {

    this.albums = [];

    this.albums = await this.mediaUtils.getAlbums();

  }



  @Builder OperateBtn(src, zIndex, translate, handleClick) {

    Button() {

      Image(src)

        .width('70%')

        .height('70%')

    }

    .type(ButtonType.Circle)

    .width('40%')

    .height('40%')

    .backgroundColor('#0D9FFB')

    .zIndex(zIndex)

    .translate({ x: translate.x, y: translate.y })

    .transition({ type: TransitionType.Insert, translate: { x: 0, y: 0 } })

    .transition({ type: TransitionType.Delete, opacity: 0 })

    .onClick(handleClick)

  }



  build() {

    Stack({ alignContent: Alignment.BottomEnd }) {

      Column() {

        TitleBar()

        List() {

          ForEach(this.albums, (item: Album, index) = > {

            ListItem() {

              MediaView({ album: item })

                .id(`mediaType${index}`)

            }

          }, item = > item.albumName)

        }

        .divider({ strokeWidth: 1, color: Color.Gray, startMargin: 16, endMargin: 16 })

        .layoutWeight(1)

      }

      .width('100%')

      .height('100%')



      Stack({ alignContent: Alignment.Center }) {

        Button() {

          Image($r('app.media.add'))

            .width('100%')

            .height('100%')

        }

        .width(60)

        .height(60)

        .padding(10)

        .id('addBtn')

        .type(ButtonType.Circle)

        .backgroundColor('#0D9FFB')

        .onClick(() = > {

          animateTo({ duration: 500, curve: Curve.Ease }, () = > {

            this.operateVisible = !this.operateVisible

          })

        })



        Button() {

          Image($r('app.media.icon_camera'))

            .id('camera')

            .width('100%')

            .height('100%')

        }

        .width(60)

        .height(60)

        .padding(10)

        .type(ButtonType.Circle)

        .backgroundColor('#0D9FFB')

        .translate({ x: 0, y: -80 })

        .visibility(this.operateVisible ? Visibility.Visible : Visibility.None)

        .onClick(() = > {

          this.operateVisible = !this.operateVisible;

          let context: common.UIAbilityContext | undefined = AppStorage.Get('context');

          let want: Want = {

            bundleName: "com.samples.camera_page",

            abilityName: "EntryAbility",

          };

          context && context.startAbility(want,  (err) = > {

            if (err.code) {

              Logger.error('StartAbility', `Failed to startAbility. Code: ${err.code}, message: ${err.message}`);

            }

          });

        })



        Button() {

          Image($r('app.media.icon_record'))

            .id('record')

            .width('100%')

            .height('100%')

        }

        .width(60)

        .height(60)

        .padding(10)

        .type(ButtonType.Circle)

        .backgroundColor('#0D9FFB')

        .translate({ x: -80, y: 0 })

        .visibility(this.operateVisible ? Visibility.Visible : Visibility.None)

        .onClick(() = > {

          this.operateVisible = !this.operateVisible

          router.push({ url: 'pages/RecordPage' })

        })



        Button() {

          Image($r('app.media.icon_document'))

            .width('100%')

            .height('100%')

        }

        .width(60)

        .height(60)

        .padding(10)

        .id('document')

        .type(ButtonType.Circle)

        .backgroundColor('#0D9FFB')

        .translate({ x: 0, y: 80 })

        .visibility(this.operateVisible ? Visibility.Visible : Visibility.None)

        .onClick(() = > {

          this.operateVisible = !this.operateVisible

          router.pushUrl({ url: 'pages/DocumentPage' })

        })

      }

      .width(180)

      .height(220)

      .margin({ right: 40, bottom: 120 })

    }

    .width('100%')

    .height('100%')

  }



  aboutToDisappear() {

    this.mediaUtils.offDateChange()

  }

}
  • 獲取資源文件:通過引入媒體庫實(shí)例(入口)接口@ohos.multimedia.medialibrary,例如通過this.getFileAssetsFromType(mediaLibrary.MediaType.FILE)獲取FILE類型的文件資源,并通過albums.push()添加至album數(shù)組中。
  • 展示系統(tǒng)資源文件:當(dāng)album內(nèi)的值被修改時(shí),只會(huì)讓用 @ObjectLink 裝飾的變量album所在的組件被刷新,當(dāng)前組件不會(huì)刷新。
  • 錄音功能:通過引入音視頻接口@ohos.multimedia.media,例如通過media.createAudioRecorder()創(chuàng)建音頻錄制的實(shí)例來控制音頻的錄制,通過this.audioRecorder.on('prepare', () => {this.audioRecorder.start()})異步方式開始音頻錄制,[源碼參考]
/*

 * Copyright (c) 2022 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 media from '@ohos.multimedia.media'

import Logger from '../model/Logger'



let audioConfig = {

  audioSourceType: 1,

  audioEncoder: 3,

  audioEncodeBitRate: 22050,

  audioSampleRate: 22050,

  numberOfChannels: 2,

  format: 6,

  uri: ''

}



export default class RecordModel {

  private tag: string = 'RecordModel'

  private audioRecorder: media.AudioRecorder = undefined



  initAudioRecorder(handleStateChange: () = > void) {

    this.release();

    this.audioRecorder = media.createAudioRecorder()

    Logger.info(this.tag, 'create audioRecorder success')

    this.audioRecorder.on('prepare', () = > {

      Logger.info(this.tag, 'setCallback  prepare case callback is called')

      this.audioRecorder.start()

    })

    this.audioRecorder.on('start', () = > {

      Logger.info(this.tag, 'setCallback start case callback is called')

      handleStateChange()

    })

    this.audioRecorder.on('stop', () = > {

      Logger.info(this.tag, 'audioRecorder stop called')

      this.audioRecorder.release()

    })

    this.audioRecorder.on('pause', () = > {

      Logger.info(this.tag, 'audioRecorder pause finish')

      handleStateChange()

    })

    this.audioRecorder.on('resume', () = > {

      Logger.info(this.tag, 'audioRecorder resume finish')

      handleStateChange()

    })

  }



  release() {

    if (typeof (this.audioRecorder) !== `undefined`) {

      Logger.info(this.tag, 'audioRecorder  release')

      this.audioRecorder.release()

      this.audioRecorder = undefined

    }

  }



  startRecorder(pathName: string) {

    Logger.info(this.tag, `startRecorder, pathName = ${pathName}`)

    if (typeof (this.audioRecorder) !== 'undefined') {

      Logger.info(this.tag, 'start prepare')

      audioConfig.uri = pathName

      this.audioRecorder.prepare(audioConfig)

    } else {

      Logger.error(this.tag, 'case failed, audioRecorder is null')

    }

  }



  pause() {

    Logger.info(this.tag, 'audioRecorder pause called')

    if (typeof (this.audioRecorder) !== `undefined`) {

      this.audioRecorder.pause()

    }

  }



  resume() {

    Logger.info(this.tag, 'audioRecorder resume called')

    if (typeof (this.audioRecorder) !== `undefined`) {

      this.audioRecorder.resume()

    }

  }



  finish() {

    if (typeof (this.audioRecorder) !== `undefined`) {

      this.audioRecorder.stop()

    }

  }

}
  • 拍照錄像功能:通過引入相機(jī)模塊接口@ohos.multimedia.camera,例如通過this.cameraManager.createCaptureSession()創(chuàng)建相機(jī)入口的實(shí)例來控制拍照和錄像,通過this.captureSession.start()開始會(huì)話工作,[源碼參考]
/*

 * Copyright (c) 2022 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 camera from '@ohos.multimedia.camera'

import deviceInfo from '@ohos.deviceInfo'

import fileio from '@ohos.fileio'

import image from '@ohos.multimedia.image'

import media from '@ohos.multimedia.media'

import mediaLibrary from '@ohos.multimedia.mediaLibrary'

import Logger from '../model/Logger'

import MediaUtils from '../model/MediaUtils'



const CameraMode = {

  MODE_PHOTO: 0, // 拍照模式

  MODE_VIDEO: 1 // 錄像模式

}



const CameraSize = {

  WIDTH: 1920,

  HEIGHT: 1080

}



export default class CameraService {

  private tag: string = 'CameraService'

  private context: any = undefined

  private mediaUtil: MediaUtils = undefined

  private cameraManager: camera.CameraManager = undefined

  private cameras: Array< camera.CameraDevice > = undefined

  private cameraId: string = ''

  private cameraInput: camera.CameraInput = undefined

  private previewOutput: camera.PreviewOutput = undefined

  private photoOutPut: camera.PhotoOutput = undefined

  private captureSession: camera.CaptureSession = undefined

  private mReceiver: image.ImageReceiver = undefined

  private photoUri: string = ''

  private fileAsset: mediaLibrary.FileAsset = undefined

  private fd: number = -1

  private curMode = CameraMode.MODE_PHOTO

  private videoRecorder: media.VideoRecorder = undefined

  private videoOutput: camera.VideoOutput = undefined

  private handleTakePicture: (photoUri: string) = > void = undefined

  private cameraOutputCapability: camera.CameraOutputCapability = undefined

  private videoConfig: any = {

    audioSourceType: 1,

    videoSourceType: 0,

    profile: {

      audioBitrate: 48000,

      audioChannels: 2,

      audioCodec: 'audio/mp4v-es',

      audioSampleRate: 48000,

      durationTime: 1000,

      fileFormat: 'mp4',

      videoBitrate: 48000,

      videoCodec: 'video/mp4v-es',

      videoFrameWidth: 640,

      videoFrameHeight: 480,

      videoFrameRate: 30

    },

    url: '',

    orientationHint: 0,

    location: {

      latitude: 30, longitude: 130

    },

    maxSize: 10000,

    maxDuration: 10000

  }



  constructor(context: any) {

    this.context = context

    this.mediaUtil = MediaUtils.getInstance(context)

    this.mReceiver = image.createImageReceiver(CameraSize.WIDTH, CameraSize.HEIGHT, 4, 8)

    Logger.info(this.tag, 'createImageReceiver')

    this.mReceiver.on('imageArrival', () = > {

      Logger.info(this.tag, 'imageArrival')

      this.mReceiver.readNextImage((err, image) = > {

        Logger.info(this.tag, 'readNextImage')

        if (err || image === undefined) {

          Logger.error(this.tag, 'failed to get valid image')

          return

        }

        image.getComponent(4, (errMsg, img) = > {

          Logger.info(this.tag, 'getComponent')

          if (errMsg || img === undefined) {

            Logger.info(this.tag, 'failed to get valid buffer')

            return

          }

          let buffer = new ArrayBuffer(4096)

          if (img.byteBuffer) {

            buffer = img.byteBuffer

          } else {

            Logger.error(this.tag, 'img.byteBuffer is undefined')

          }

          this.savePicture(buffer, image)

        })

      })

    })

  }



  async savePicture(buffer: ArrayBuffer, img: image.Image) {

    Logger.info(this.tag, 'savePicture')

    this.fileAsset = await this.mediaUtil.createAndGetUri(mediaLibrary.MediaType.IMAGE)

    this.photoUri = this.fileAsset.uri

    Logger.info(this.tag, `this.photoUri = ${this.photoUri}`)

    this.fd = await this.mediaUtil.getFdPath(this.fileAsset)

    Logger.info(this.tag, `this.fd = ${this.fd}`)

    await fileio.write(this.fd, buffer)

    await this.fileAsset.close(this.fd)

    await img.release()

    Logger.info(this.tag, 'save image done')

    if (this.handleTakePicture) {

      this.handleTakePicture(this.photoUri)

    }

  }



  async initCamera(surfaceId: string) {

    Logger.info(this.tag, 'initCamera')

    await this.releaseCamera()

    Logger.info(this.tag, `deviceInfo.deviceType = ${deviceInfo.deviceType}`)

    if (deviceInfo.deviceType === 'default') {

      this.videoConfig.videoSourceType = 1

    } else {

      this.videoConfig.videoSourceType = 0

    }

    this.cameraManager = await camera.getCameraManager(this.context)

    Logger.info(this.tag, 'getCameraManager')

    this.cameras = await this.cameraManager.getSupportedCameras()

    Logger.info(this.tag, `get cameras ${this.cameras.length}`)

    if (this.cameras.length === 0) {

      Logger.info(this.tag, 'cannot get cameras')

      return

    }



    let cameraDevice = this.cameras[0]

    this.cameraInput = await this.cameraManager.createCameraInput(cameraDevice)

    this.cameraInput.open()

    Logger.info(this.tag, 'createCameraInput')

    this.cameraOutputCapability = await this.cameraManager.getSupportedOutputCapability(cameraDevice)

    let previewProfile = this.cameraOutputCapability.previewProfiles[0]

    this.previewOutput = await this.cameraManager.createPreviewOutput(previewProfile, surfaceId)

    Logger.info(this.tag, 'createPreviewOutput')

    let mSurfaceId = await this.mReceiver.getReceivingSurfaceId()

    let photoProfile = this.cameraOutputCapability.photoProfiles[0]

    this.photoOutPut = await this.cameraManager.createPhotoOutput(photoProfile, mSurfaceId)

    this.captureSession = await this.cameraManager.createCaptureSession()

    Logger.info(this.tag, 'createCaptureSession')

    await this.captureSession.beginConfig()

    Logger.info(this.tag, 'beginConfig')

    await this.captureSession.addInput(this.cameraInput)

    await this.captureSession.addOutput(this.previewOutput)

    await this.captureSession.addOutput(this.photoOutPut)

    await this.captureSession.commitConfig()

    await this.captureSession.start()

    Logger.info(this.tag, 'captureSession start')

  }



  setTakePictureCallback(callback) {

    this.handleTakePicture = callback

  }



  async takePicture() {

    Logger.info(this.tag, 'takePicture')

    if (this.curMode === CameraMode.MODE_VIDEO) {

      this.curMode = CameraMode.MODE_PHOTO

    }

    let photoSettings = {

      rotation: camera.ImageRotation.ROTATION_0,

      quality: camera.QualityLevel.QUALITY_LEVEL_MEDIUM,

      location: { // 位置信息,經(jīng)緯度

        latitude: 12.9698,

        longitude: 77.7500,

        altitude: 1000

      },

      mirror: false

    }

    await this.photoOutPut.capture(photoSettings)

    Logger.info(this.tag, 'takePicture done')

    AppStorage.Set('isRefresh', true)

  }



  async startVideo() {

    Logger.info(this.tag, 'startVideo begin')

    await this.captureSession.stop()

    await this.captureSession.beginConfig()

    if (this.curMode === CameraMode.MODE_PHOTO) {

      this.curMode = CameraMode.MODE_VIDEO

      if (this.photoOutPut) {

        await this.captureSession.removeOutput(this.photoOutPut)

        this.photoOutPut.release()

      }

    } else {

      if (this.videoOutput) {

        await this.captureSession.removeOutput(this.videoOutput)

      }

    }

    if (this.videoOutput) {

      await this.captureSession.removeOutput(this.videoOutput)

      await this.videoOutput.release()

    }

    this.fileAsset = await this.mediaUtil.createAndGetUri(mediaLibrary.MediaType.VIDEO)

    this.fd = await this.mediaUtil.getFdPath(this.fileAsset)

    this.videoRecorder = await media.createVideoRecorder()

    this.videoConfig.url = `fd://${this.fd}`

    await this.videoRecorder.prepare(this.videoConfig)

    let videoId = await this.videoRecorder.getInputSurface()

    let videoProfile = this.cameraOutputCapability.videoProfiles[0];

    this.videoOutput = await this.cameraManager.createVideoOutput(videoProfile, videoId)

    await this.captureSession.addOutput(this.videoOutput)

    await this.captureSession.commitConfig()

    await this.captureSession.start()

    await this.videoOutput.start()

    await this.videoRecorder.start()

    Logger.info(this.tag, 'startVideo end')

  }



  async stopVideo() {

    Logger.info(this.tag, 'stopVideo called')

    await this.videoRecorder.stop()

    await this.videoOutput.stop()

    await this.videoRecorder.release()

    await this.fileAsset.close(this.fd)

  }



  async releaseCamera() {

    Logger.info(this.tag, 'releaseCamera')

    if (this.cameraInput) {

      await this.cameraInput.close()

    }

    if (this.previewOutput) {

      await this.previewOutput.release()

    }

    if (this.photoOutPut) {

      await this.photoOutPut.release()

    }

    if (this.videoOutput) {

      await this.videoOutput.release()

    }

    if (this.captureSession) {

      await this.captureSession.release()

    }

  }

}

image.png

約束與限制

1.rk3568底層錄像功能有問題,暫不支持錄像功能,當(dāng)前拍照功能僅支持部分機(jī)型。

2.本示例僅支持標(biāo)準(zhǔn)系統(tǒng)上運(yùn)行。

3.本示例為Stage模型,已適配API version 9版本SDK,版本號(hào):3.2.11.9;

4.本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400, built on April 7, 2023)及以上版本才可編譯運(yùn)行。

審核編輯 黃宇

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報(bào)投訴
  • 接口
    +關(guān)注

    關(guān)注

    33

    文章

    9005

    瀏覽量

    153748
  • 鴻蒙
    +關(guān)注

    關(guān)注

    60

    文章

    2620

    瀏覽量

    44054
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點(diǎn)推薦

    鴻蒙5開發(fā)寶藏案例分享---一多開發(fā)實(shí)例(音樂)

    各位開發(fā)者小伙伴們好呀!今天咱們來點(diǎn)硬核干貨!最近在鴻蒙文檔中心挖到一座“金礦”——官方竟然暗藏了100+實(shí)戰(zhàn)案例,從分布式架構(gòu)到交互動(dòng)效優(yōu)化應(yīng)有盡有!這些案例不僅藏著華為工程師的私房技巧,還直接
    的頭像 發(fā)表于 06-30 11:54 ?343次閱讀

    鴻蒙5開發(fā)寶藏案例分享---優(yōu)化應(yīng)用包體積大小問題

    ?** 鴻蒙包體積優(yōu)化實(shí)戰(zhàn):藏在官方文檔里的寶藏技巧!** 大家好呀~我是你們的鴻蒙開發(fā)小伙伴!今天在翻官方文檔時(shí),發(fā)現(xiàn)了一個(gè)超實(shí)用的「包體積優(yōu)化」案例寶藏
    發(fā)表于 06-13 10:09

    鴻蒙5開發(fā)寶藏案例分享---優(yōu)化應(yīng)用時(shí)延問題

    鴻蒙性能優(yōu)化寶藏指南:6大實(shí)戰(zhàn)案例讓你的應(yīng)用飛起來! 大家好!今天在翻鴻蒙文檔時(shí)挖到了 性能優(yōu)化寶藏 !官方竟然悄悄藏了這么多實(shí)戰(zhàn)案例,從
    發(fā)表于 06-13 10:08

    鴻蒙5開發(fā)寶藏案例分享---埋點(diǎn)開發(fā)實(shí)戰(zhàn)指南

    鴻蒙埋點(diǎn)開發(fā)寶藏指南:官方案例實(shí)戰(zhàn)解析,輕松搞定數(shù)據(jù)追蹤! 大家好呀!我是HarmonyOS開發(fā)路上的探索者。最近在折騰應(yīng)用埋點(diǎn)時(shí),意外發(fā)現(xiàn)了鴻蒙
    發(fā)表于 06-12 16:30

    鴻蒙5開發(fā)寶藏案例分享---切面編程實(shí)戰(zhàn)揭秘

    鴻蒙切面編程(AOP)實(shí)戰(zhàn)指南:隱藏的寶藏功能大揭秘! 大家好!今天在翻鴻蒙開發(fā)者文檔時(shí),意外發(fā)現(xiàn)了官方埋藏的「切面編程」寶藏案例!實(shí)際開發(fā)
    發(fā)表于 06-12 16:21

    鴻蒙5開發(fā)寶藏案例分享---應(yīng)用架構(gòu)實(shí)戰(zhàn)技巧

    大家好! 今天咱們聊聊鴻蒙開發(fā)中那些“官方文檔提了但實(shí)際開發(fā)難找”的架構(gòu)設(shè)計(jì)技巧。結(jié)合官方文檔,我會(huì)用 真實(shí)代碼案例+通俗講解 ,幫你把分層架構(gòu)和線程通信落地到項(xiàng)目里,告別“理論會(huì)了,代碼不會(huì)
    發(fā)表于 06-12 16:14

    鴻蒙5開發(fā)寶藏案例分享---一多開發(fā)實(shí)例(地圖導(dǎo)航)

    ? 鴻蒙開發(fā)隱藏寶藏大公開!手把手教你玩轉(zhuǎn)\"一多\"地圖導(dǎo)航案例 ? 大家好呀!我是你們的老朋友,今天要給大家扒一扒鴻蒙官方文檔里那些\"藏得深\"的實(shí)戰(zhàn)
    發(fā)表于 06-03 16:17

    鴻蒙5開發(fā)寶藏案例分享---折疊屏懸停態(tài)開發(fā)實(shí)踐

    ?【鴻蒙折疊屏開發(fā)寶藏指南】原來官方藏了這么多好東西!手把手教你玩轉(zhuǎn)懸停態(tài)開發(fā)**?** Hey小伙伴們!我是你們的老朋友XX,最近在肝鴻蒙折疊屏項(xiàng)目時(shí),意外挖到了官方文檔里的隱藏寶藏
    發(fā)表于 06-03 12:04

    鴻蒙Flutter實(shí)戰(zhàn):14-現(xiàn)有Flutter 項(xiàng)目支持鴻蒙 II

    ,職責(zé)分離,平臺(tái)抽象,不同平臺(tái)組合打包,有效解決平臺(tái)不一致問題 參考資料 鴻蒙Flutter實(shí)戰(zhàn):01-搭建開發(fā)環(huán)境 鴻蒙Flutter實(shí)戰(zhàn)
    發(fā)表于 12-26 14:59

    鴻蒙原生開源ViewPool在OpenHarmony社區(qū)正式上線

    近日,由伙伴參與共建的鴻蒙原生開源“ViewPool”在OpenHarmony社區(qū)正式上線。這個(gè)開發(fā)是基于OpenHarmony技術(shù)孵化的成果,充分發(fā)揮了平臺(tái)的技術(shù)特性,同時(shí)融入了
    的頭像 發(fā)表于 12-20 14:44 ?627次閱讀

    鴻蒙Flutter實(shí)戰(zhàn):11-使用 Flutter SDK 3.22.0

    # 使用 Flutter SDK 3.22.0 ## SDK 安裝 參考[鴻蒙Flutter實(shí)戰(zhàn):01-搭建開發(fā)環(huán)境]文章的說明,首先安裝 Flutter SDK 3.22.0。 目前
    發(fā)表于 11-01 15:03

    鴻蒙Flutter實(shí)戰(zhàn):08-如何調(diào)試代碼

    # 鴻蒙Flutter實(shí)戰(zhàn):如何調(diào)試代碼 ## 1.環(huán)境搭建 參考文章[鴻蒙Flutter實(shí)戰(zhàn):01-搭建開發(fā)環(huán)境](https://g
    發(fā)表于 10-23 16:29

    鴻蒙Flutter實(shí)戰(zhàn):07混合開發(fā)

    # 鴻蒙Flutter實(shí)戰(zhàn):混合開發(fā) 鴻蒙Flutter混合開發(fā)主要有兩種形式。 ## 1.基于har 將flutter module
    發(fā)表于 10-23 16:00

    鴻蒙Flutter實(shí)戰(zhàn):05-使用第三方插件

    # 鴻蒙Flutter 實(shí)戰(zhàn):使用第三方插件 在鴻蒙Flutter開發(fā)中,如果涉及到使用原生功能,就要使用插件。使用插件有兩種方式,一種是自己編寫原生ArkTS代碼,在Dart側(cè)調(diào)用
    發(fā)表于 10-22 21:54

    擺脫自建的繁瑣,EDA元件轉(zhuǎn)cadence原理圖封裝實(shí)戰(zhàn)技巧

    擺脫自建的繁瑣,EDA元件轉(zhuǎn)cadence原理圖封裝實(shí)戰(zhàn)技巧
    的頭像 發(fā)表于 08-24 12:29 ?6700次閱讀
    擺脫自建<b class='flag-5'>庫</b>的繁瑣,EDA元件<b class='flag-5'>庫</b>轉(zhuǎn)cadence原理圖封裝<b class='flag-5'>庫</b><b class='flag-5'>實(shí)戰(zhàn)</b>技巧