当前位置:网站首页>HMS core video editing service has the ability to open templates, helping users get the same cool video with one click
HMS core video editing service has the ability to open templates, helping users get the same cool video with one click
2022-06-23 11:57:00 【HMS Core】
Preface
Short video template , It is a quick way to create short videos , Generally, it is made by professional designers or template creators , The user only needs to replace part of the material in the video template , You can generate a creative video just like the template . This saves time and effort 、 There is no need to “ Burn brain ” Conceived creatively “ Set of templates ” Video creation methods , Popular with users .
Application scenarios
Short video template in short video APP、 Video editing tools 、 Photo beautification tools 、 Tourism travel 、 Online retailers 、 News and other vertical areas are widely used . for example :
In the video clip tool 、 Take a picture of the beautification tool vertical , Short video template function can reduce the threshold of video editing 、 Inspire users to create , So as to improve the user activity of the application ;
In the travel application , The user can go through “ Set of templates ” By video recording the local conditions and customs during the journey ;
In e-commerce applications , Merchants can apply the commodity display template , Quickly make commodity display video ;
In the application of news information , Users can apply the news template , Quickly release news messages .
Huawei HMS Core Video editing service template capability
HMS Core Video editing services Recently, the template function has been opened , And preset some video templates for different scenarios for developers to test , In the future, the category and quantity of templates will be enriched .
Easy access 、 Time saving and labor saving
HMS Core Video editing services A list of columns covering the template is provided 、 Template details 、 Formwork works 、 Import / export and other detailed development interfaces 、 Interface description and access steps , The code is simple 、 Clear , Development saves time and effort .
Cloud management 、 Efficient operation
HMS Core Video editing services stay AGC The background provides the background for developers to arrange materials , The operating personnel can web Complete the template column arrangement at the end 、 Label management 、 Country / Regional settings 、 Contents of upper and lower formwork 、 Quickly retrieve query information, etc .

Integration code
1. The development of preparation
For detailed preparation steps, please refer to Official website of Huawei developer Alliance
2. Edit project integration
2.1 Set the authentication information of the application
Can pass api_key perhaps Access Token To set the application authentication information .
adopt setAccessToken Method setting Access Token, You can initialize the settings once when the application starts , There is no need to set it more than once .
MediaApplication.getInstance().setAccessToken("your access token");adopt setApiKey Method setting api_key, You can initialize the settings once when the application starts , There is no need to set it more than once .
MediaApplication.getInstance().setApiKey("your ApiKey");2.2 Set a unique identity ID, namely License ID.
License ID It is a valid voucher for control , You need to ensure that the settings License ID Uniqueness .
MediaApplication.getInstance().setLicenseId("License ID");2.2.1 initialization Editor Running environment
Create edit project , You need to create it first Editor Object and initialize its running environment . When you leave editing a project , Should be released Editor example .
(1) establish Editor object
HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());(2) Specifies the layout location of the preview window
The preview window is responsible for the rendering of video images , Atomic power by video editing SDK Create inside SurfaceView To achieve . Before creating the window , Need to be in your App Specify the layout location of the preview window in .
<LinearLayout android:id="@+id/video_content_layout" android:layout_width="0dp" android:layout_height="0dp" android:background="@color/video_edit_main_bg_color" android:gravity="center" android:orientation="vertical" />// Specify the preview window LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);// Set the layout hosted by the preview window editor.setDisplay(mSdkPreviewContainer);(3) Initialize the running environment , If License Authentication failure , Will throw out LicenseException.
When Editor After the object is created , At this time, the actual system resources have not been occupied , You need to manually select the timing of its environment initialization , At this point, the atomic power of video editing SDK Necessary threads and timers will be created internally .
try { editor.initEnvironment(); } catch (LicenseException error) { SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg()); finish(); return; }3. Template capability integration
// Get the template column list final HVEColumnInfo[] column = new HVEColumnInfo[1];HVETemplateManager.getInstance().getColumnInfos(new HVETemplateManager.HVETemplateColumnsCallback() { @Override public void onSuccess(List<HVEColumnInfo> result) { // Get template column list successfully column[0] = result.get(0); } @Override public void onFail(int error) { // Failed to get template column list }});// Get template details final String[] templateIds = new String[1];// size For the amount of data that needs to be requested > 0,offset To request the offset of the data ≥ 0,true On behalf of mandatory access to network data HVETemplateManager.getInstance().getTemplateInfos(column[0].getColumnId(), size, offset, true, new HVETemplateManager.HVETemplateInfosCallback() { @Override public void onSuccess(List<HVETemplateInfo> result, boolean hasMore) { // Successfully obtained template details HVETemplateInfo templateInfo = result.get(0); // Access to the template ID templateIds[0] = templateInfo.getId(); } @Override public void onFail(int errorCode) { // Failed to get template details }});// After the template details are obtained successfully , Access to the template IDString templateId = templateIds[0];// Get template project final List<HVETemplateElement>[] editableElementList = new ArrayList[1];;HVETemplateManager.getInstance().getTemplateProject(templateId, new HVETemplateManager.HVETemplateProjectCallback() { @Override public void onSuccess(List<HVETemplateElement> editableElements) { // After successful acquisition, jump to the select resources interface , Update the selected local resource path to editableElements editableElementList[0] = editableElements; } @Override public void onProgress(int progress) { // Get progress } @Override public void onFail(int errorCode) { // Acquisition failure }});// Prepare formwork works HVETemplateManager.getInstance().prepareTemplateProject(templateId, new HVETemplateManager.HVETemplateProjectPrepareCallback() { @Override public void onSuccess() { // The template project is successfully prepared , Can generate HuaweiVideoEditor Instance to play 、 preview 、 Export and other operations } @Override public void onProgress(int progress) { // Preparation progress } @Override public void onFail(int errorCode) { // Preparation failed }});// After the template is successfully prepared , Generate HuaweiVideoEditor example // Have editor Then you can play or export , See playback timeline and export for details HuaweiVideoEditor editor = HuaweiVideoEditor.create(templateId, editableElementList[0]);try { editor.initEnvironment();} catch (LicenseException e) { SmartLog.e(TAG, "editor initEnvironment ERROR.");} Demo demonstration

Learn more >>
visit Official website of Huawei developer Alliance
obtain Development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
边栏推荐
猜你喜欢

杜邦分析法解读:安阳钢铁股份有限公司企业投资价值何在?

广播级E1转AES-EBU音频编解码器 E1转立体声音频卡侬头(XLR)编解码器

得物多活架构设计之路由服务设计

mysql,如何在使用存储过程计算最大值

Introduction to redis - Chapter 3 - data structures and objects - Dictionary

并购增资或将有望启动东软越通新动能?

Redis 入门-第四篇-数据结构与对象-跳跃表

凭借32量子比特!Rigetti Computing打入英国量子计算市场

汉源高科新一代绿色节能以太网接入工业交换机高效节能型千兆工业以太网交换机

Use xtradiagram Diagramcontrol for drawing and controlling process graphics
随机推荐
Qt知识:视图框架QGraphicsWidget详解
@Dark horse fans, haven't you received this "high temperature subsidy"?
惊!AMD 350亿美元收购赛灵思!
如何使用笔记软件 FlowUs、Notion 进行间隔重复?基于公式模版
语音模块:pyttsx变声项目
电感有极性吗?
电容参数哪里找!?
2022施工员-装饰方向-岗位技能(施工员)操作证考试题库模拟考试平台操作
16路HD-SDI光端机多路HD-SDI高清视频光端机16路3G-SDI高清音视频光端机
10-- 根据中序遍历和后序遍历,构造二叉树
记录
Redis 入门-第四篇-数据结构与对象-跳跃表
Open classes are short videos! Tonight, I will teach you how to realize accurately!
halcon知识:dyn_threshold的用法(划痕检测)
Gradienttape of tensorflow2
1路百兆光纤收发器1百兆光1百兆电桌面式以太网光纤收发器内置电源
Blue Bridge Cup single chip microcomputer (I) -- turn off peripherals and turn off led
Getting started with redis - Chapter 4 - data structures and objects - jump table
【综合笔试题】30. 串联所有单词的子串
The computer broke down. I changed the computer. There was a problem installing the node environment. The URL is not defined