当前位置:网站首页>Hongmeng version of "Tiktok" is a great experience
Hongmeng version of "Tiktok" is a great experience
2022-06-21 19:18:00 【Hongmeng developer Lao Wang】
Hello everyone , I'm Lao Wang ~
Speaking of Tiktok, no one is strange , It can be said that it is now a short video that everyone loves to brush APP, Brush before going to bed , Get up early and brush for a while .
Today Lao Wang is going to use JS Write a simple Tiktok video , You can practice with me .
One 、 Effect demonstration
This case is based on JS Language to write a simple video player , Includes video slideshow 、 Comment on 、 Distributed circulation and other functions , The effect of the project is as follows :
1、 Video slide : The project can adapt to horizontal and vertical


2、 Comment function : Comments with avatars , Can add comments

3、 Distributed : Mobile phones and mobile phones can be realized 、 Mobile phones and tablets 、 Distributed flow between mobile phones and large screens



4、 I made a video of an astronaut spinning , Ha ha ha .

Two 、 Project introduction
This project uses JS Write a distributed video player , Project UI The style is referred to in the following blog :
#HarmonyOS Challenge phase II # Hongmeng Java UI Distributed Tiktok like video https://developer.huawei.com/consumer/cn/forum/topic/0201695357049060855?fid=0101303901040230869
You can compare the codes of our two projects , Let's see Java and JS The difference between the implementation of , Feel which of the two languages is easier to understand .
PS: I used to write Java UI, Then I got in touch JS UI, Find out JS Write HarmonyOS The amount of application code is much less , Easier, huh .
3、 ... and 、 The code analysis
1、 First , We need to write one that slides up and down , Experience a video playing page similar to Tiktok , The page also needs to add three simple buttons ( give the thumbs-up 、 Comment on 、 Share ), And add a video introduction at the bottom of the page :

Reading : It's used here swiper Sliding components , To slide up and down ; Yes video Components , To achieve video playback ; Yes stack Stack layout , To implement the button ( give the thumbs-up 、 Comment on 、 Share )、 The effect that the copy is stacked on top of the video .
The effect is as follows :

2、 after , We implement a simple comment list :

Reading : It's used here if="{ { showCommentFlag }}", To pop up and hide the comment pop-up window . The user's Avatar is added to the pop-up list 、 Nicknames and comments .
The effect is as follows :

3、 Last , We realize a sharing ( Distributed ) The function of :
JS Distributed code is very simple , Just the following lines of code can realize the distributed function , It's simple .

The effect is as follows :

remarks : This code will pop up a system default pop-up window , Let the user choose the device . If you want to implement a custom pop-up window, you can , I will write the custom pop-up window for you when I am free .
Four 、 Code reference
https://gitee.com/teachers-philosophy/HarmonyOSLearning/tree/master/VideoDemo
——————
original : Lao Wang 【 official account : Hongmeng developer Lao Wang 】 Huawei certified lecturer / Tencent certified lecturer / Hongmeng development takes the lead
边栏推荐
- Unity3D-后期处理 Post-process Volume Profile
- Cookies and sessions
- 两种圆点垂直进度样式
- 一次 MySQL 误操作导致的事故,「高可用」都顶不住了!
- 中国两颗风云气象“新星”主要数据产品将向全球用户开放共享
- el-table分页全选功能讲解
- A test tool for recording and playback interface based on mitmproxy
- R language bug? report errors? As for the outcome of sub variables 0 and 1, the original content of the outcome variable is changed through the process of factor and numeric?
- 6月22日直播 | 华南理工詹志辉: 面向昂贵优化的进化计算
- Three.js 3d粒子动画js特效代码
猜你喜欢
![[Shangshui Shuo series] day one](/img/09/ab31cc494d726e896799d21fa02502.png)
[Shangshui Shuo series] day one

Cache design issues

Notes on writing questions in C language -- find s=a+aa+aaa+aaaa+aa Value of a

一次 MySQL 误操作导致的事故,「高可用」都顶不住了!

MarkDown高级语法,兼容MarkText

【Go语言】Go语言我们应该这样学~全网较全的学习教程

Niuke: merging two ordered arrays

Product graphic list description layout style

11 Beautiful Soup 解析庫的簡介及安裝

MySQL的MVCC实现原理
随机推荐
什么是SSL证书,拥有一个SSL证书有什么好处?
Svg+canvas particle dynamic effect
GOF mode-03-behavioral mode (bottom)
Internet communication process
缓存设计问题
vivo 容器集群监控系统架构与实践
JDBC 笔记
[HCTF 2018]WarmUp
Cache design issues
Fpga/cpld final examination paper for the first semester of Nanjing University of information technology 2020-2021
11 Beautiful Soup 解析库的简介及安装
恒泰证券VIP低佣金开户链接安全的吗?
从“村办企业”到“百亿集团”,红星实业何以完成“蝶变”?
VsCode自定义模板,用模板记笔记?!
Three.js 3d粒子动画js特效代码
Full screen menu animation effect expansion in the upper left corner of SVG
两种圆点垂直进度样式
挖财学堂属于证券公司吗?开户安全吗?
JDBC基础知识
图像分类、AI 与全自动性能测试