当前位置:网站首页>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 ~
边栏推荐
- 电感有极性吗?
- 语音数据标注工具与平台
- Where to find capacitance parameters!?
- Voice data annotation tools and platforms
- RF Analyzer Demo搭建
- 汉源高科USB2.0光端机USB2.0光纤延长器USB2.0光纤传输器USB2.0接口转光纤
- 过采样系列三:量化误差与过采样率
- 记录
- Oversampling Series III: quantization error and oversampling rate
- ESP32-C3入门教程 问题篇⑦—— fatal error: esp_bt.h: No such file or directory 找不到esp_bt.h
猜你喜欢

Halcon原理:auto_threshold算子

Leetcode 1209. Delete all adjacent duplicates II in the string

Use monotone stack to solve problems

ROS2知识(2):网络设施

利用XtraDiagram.DiagramControl进行流程图形的绘制和控制

go-zero微服务实战系列(六、缓存一致性保证)

Common fault analysis and Countermeasures of MySQL in go language

Go 语言使用 MySQL 的常见故障分析和应对方法

@Dark horse fans, haven't you received this "high temperature subsidy"?

年薪中位数超30万,南大AI专业首届毕业生薪资曝光
随机推荐
Introduction to redis - Chapter 3 - data structures and objects - Dictionary
Use monotone stack to solve problems
[cloud based co creation] overview of the IOT of Huawei cloud HCIA IOT v2.5 training series
惊!AMD 350亿美元收购赛灵思!
Leetcode 1209. Delete all adjacent duplicates II in the string
ROS2知识(6):坐标对象TF原理和实践
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
全国进入主汛期,交通运输部:不具备安全运行条件的线路坚决停运!
ESP32-C3入门教程 问题篇⑦—— fatal error: esp_bt.h: No such file or directory 找不到esp_bt.h
How many days is the general term of financial products?
并购增资或将有望启动东软越通新动能?
哪个券商公司开户是最靠谱安全的
浅谈标注平台架构
汉源高科8路电话+1路百兆以太网RJ11电话光端机 8路PCM电话光端机
语音模块:pyttsx变声项目
WC statistics are out of date, and every line of cloc code is valid
广播级E1转AES-EBU音频编解码器 E1转立体声音频卡侬头(XLR)编解码器
[comprehensive written test questions] 30 Concatenate substrings of all words
手机证券开户交易?现在网上开户安全么?
4路电话+1路千兆以太网4路PCM电话光端机