首页
工具
隐私协议
作品
更多
关于我们
Search
1
proguard-rules出现unresolved class name
897 阅读
2
onActivityResult过时了,registerForActivityResult使用方法
866 阅读
3
FlexboxLayout+recyclerView实现自动换行
817 阅读
4
android5遇到INSTALL_FAILED_DEXOPT 解决办法
629 阅读
5
Room数据库Schema export Error
560 阅读
默认分类
mysql
android
android深入
Jetpack Compose
Android传感器
php
Yii2
windows
webrtc
登录
Search
标签搜索
android
kotlin
webrtc
kurento
nginx
flutter
adb
rsa
微信
git
mysql
Yii2
md5
加密
dart
aes
wechat
windows
小程序
dexopt
Kornan
累计撰写
72
篇文章
累计收到
3
条评论
首页
栏目
默认分类
mysql
android
android深入
Jetpack Compose
Android传感器
php
Yii2
windows
webrtc
页面
工具
隐私协议
作品
关于我们
搜索到
68
篇与
默认分类
的结果
2022-11-06
搭建Kurento服务
在Centos7上搭建Kurento官方网址:https://github.com/Kurento/kurento-media-server官网教程:https://doc-kurento.readthedocs.io/en/latest/user/installation.htmlKurento是一个WebRTC媒体服务器,同时提供了一系列的客户端API,可以简化供浏览器、移动平台使用的视频类应用程序的开发。Kurento支持:群组通信(group communications)媒体流的转码(transcoding)、录制(recording)、广播(broadcasting)、路由(routing)高级媒体处理特性,包括:机器视觉(CV)、视频索引、增强现实(AR)、语音分析Kurento的模块化架构使其与第三方媒体处理算法 —— 语音识别、人脸识别 —— 很容易集成。和大部分多媒体通信技术一样,Kurento应用的整体架构包含两个层(layer)或者叫平面(plane)信号平面(Signaling Plane):负责通信的管理,例如媒体协商、QoS、呼叫建立、身份验证等媒体平面(Media Plane):负责媒体传输、编解码等WebRTC让浏览器能够进行实时的点对点通信(在没有服务器的情况下)。但是要想实现群组通信、媒体流录制、媒体广播、转码等高级特性,没有媒体服务器是很难实现的。Kurento的核心是一个媒体服务器(Kurento Media Server,KMS),负责媒体的传输、处理、加载、录制,主要基于 GStreamer实现。此媒体服务器的特性包括:网络流协议处理,包括HTTP、RTP、WebRTC支持媒体混合(mixing)、路由和分发的群组通信(MCU、SFU功能)对机器视觉和增强现实过滤器的一般性支持媒体存储支持,支持对WebM、MP4进行录像操作,可以播放任何GStreamer支持的视频格式对于GStreamer支持的编码格式,可以进行任意的转码,例如VP8, H.264, H.263, AMR, OPUS, Speex, G.711安装coturnGithub:https://github.com/coturn/coturnyum install -y openssl-devel libevent-devel git #clone 源码 git clone https://github.com/coturn/coturn.git cd coturn ./configure make sudo make install # 启动turnserver nohup turnserver -L 0.0.0.0 -a -u kurento:kurento -v -f -r psvmc.cn & #然后查看相应的端口号3478是否存在进程 sudo lsof -i:3478这样就说明已经可以启动了,接下来我们先停掉turnserver,重新配置turnserver 默认加载配置文件/usr/local/etc/turnserver.conf.cp /usr/local/etc/turnserver.conf.default /usr/local/etc/turnserver.conf #生成证书 openssl req -x509 -newkey rsa:2048 -keyout /usr/local/etc/turn_server_pkey.pem -out /usr/local/etc/turn_server_cert.pem -days 99999 -nodes修改turnserver.conf:vi /usr/local/etc/turnserver.conf内容:# 设置转发的ip(局域网ip),如果不设置,他会自己选择默认的 relay-ip=****** # 转发的外网ip(本机外网ip),用于NAT 地址映射 external-ip=****** # 转发的线程数,其实默认不设置最好 relay-threads=5 #UDP 最小端口和最大端口 min-port=40000 max-port=60000 # WebRTC 的消息里会用到 fingerprint # WebRTC 认证需要 lt-cred-mech #中继服务器的监听器IP地址 listening-ip=0.0.0.0 #静态账号 user=kurento:kurento # 统计状态信息的redis db # redis-statsdb="ip=xx.xx.xxx.xx dbname=3 password=xxxx port=6379 connect_timeout=30" # 用户登录域(例如:dev.com) realm=**** # 证书 cert=/usr/local/etc/turn_server_cert.pem pkey=/usr/local/etc/turn_server_pkey.pem # 输出log log-file=stdout mobility重新启动turnserver:nohup turnserver -c /usr/local/etc/turnserver.conf -v | ts '[%Y-%m-%d %H:%M:%S]' >> /usr/local/etc/turn.log 2>&1 &注意:这个ts命令,是openssl的一个指令,用来打印日期yum install moreutils man ts echo -e "hello world" | ts '[%Y-%m-%d %H:%M:%S]'打开服务器端口:firewall-cmd --zone=public --add-port=3478/tcp --permanent firewall-cmd --zone=public --add-port=3478/udp --permanent firewall-cmd --reload测试stunhttps://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/remove掉默认的stunstun:stun.l.google.com:19302测试stun不需要账号密码,添加上stun:YOUR__IP:3478,然后点击Gather candidates只要出现Done即为成功,下面提示的fail不用在意测试turn添加turn:YOUR__IP:3478,username/password填配置文件里的kurento/kurento同样只要出现Done即为成功用docker安装kurentodocker pull kurento/kurento-media-server:latest运行docker run -d --name kms -p:8888:8888/tcp kurento/kurento-media-server:latest查看一下docker ps -aede4f883c11d kurento/kurento-media-server:latest “/entrypoint.sh” 5 seconds ago Up 4 seconds (health: starting) 0.0.0.0:8888->8888/tcp进入Dockersudo docker exec -it 704d3ed68a49 bash测试服务是否正常curl \ --include \ --header "Connection: Upgrade" \ --header "Upgrade: websocket" \ --header "Host: 127.0.0.1:8888" \ --header "Origin: 127.0.0.1" \ http://127.0.0.1:8888/kurento正常启动会显示{card-describe title="提示"}HTTP/1.1 500 Internal Server ErrorServer: WebSocket++/0.7.0{/card-describe}退出容器exit该Kurento媒体服务器的端口(KMS)过程中默认监听8888客户端WebSocket连接ws://YOUR_IP:8888/kurento配置kurento服务器进入kurento的镜像编辑kurento的配置文件:#进入镜像 docker exec -it kms /bin/bash #安装vim apt-get update apt-get install vim #进入配置文件夹 cd /etc/kurento/modules/kurento/ #编辑配置文件 vim WebRtcEndpoint.conf.ini修改stun和turn信息stunServerAddress=YOUR_IP stunServerPort=3478 turnURL=kurento:
[email protected]
_IP:3478?transport=udp退出容器,重启kurentoexit docker restart kms测试git clone https://gitee.com/psvmc/kurento-tutorial-java.git cd kurento-tutorial-java/kurento-hello-world vi src/main/resources/static/js/index.js在函数function uiStart()里,增加一个叫iceservers的变量,格式如下:let iceservers={ "iceServers":[ { urls:"stun:YOUR_IP:3478" }, { urls:["turn:YOUR_IP:3478"], username:"kurento", credential: "kurento" } ] }修改option:const options = { localVideo: uiLocalVideo, remoteVideo: uiRemoteVideo, mediaConstraints: { audio: true, video: true }, onicecandidate: (candidate) => sendMessage({ id: 'ADD_ICE_CANDIDATE', candidate: candidate, }), configuration: iceservers //这里增加了一个configuration的key };启动项目mvn -U clean spring-boot:run -Dkms.url=ws://your_ip:8888/kurento启动完之后用浏览器打开demo页面https://your_ip:8443/
2022年11月06日
7 阅读
0 评论
0 点赞
2022-10-18
Android传感器说明
名称说明TYPE_ACCELEROMETER加速度传感器TYPE_MAGNETIC_FIELD磁场传感器TYPE_GYROSCOPE陀螺仪传感器TYPE_LIGHT光照传感器TYPE_PRESSURE气压传感器TYPE_TEMPERATURE手机内部温度传感器TYPE_PROXIMITY距离传感器TYPE_GRAVITY重力传感器TYPE_LINEAR_ACCELERATION线性加速度传感器TYPE_ROTATION_VECTOR旋转矢量传感器TYPE_RELATIVE_HUMIDITY湿度传感器TYPE_AMBIENT_TEMPERATURE手机外部温度传感器TYPE_STEP_DETECTOR累计步数传感器TYPE_STEP_COUNTER单次步数传感器TYPE_ORIENTATION方向传感器检查传感器服务//获取传感器服务 sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager //获取当前手机支持的感应器并打印 sensorManager.getSensorList(Sensor.TYPE_ALL).forEach { Log.e(TGA, "Sensor:${it.name} ${it.stringType}") }
2022年10月18日
22 阅读
0 评论
0 点赞
2021-09-03
Mac OS X 下查看和设置JAVA_HOME
打开终端,输入:/usr/libexec/java_home -V参数区分大小写(必须是-V)
2021年09月03日
296 阅读
0 评论
0 点赞
2021-07-10
kotlin-android-extensions 已被弃用,如何使用 @Parcelize?
第 1 步。更新到最新的 kotlin 版本 -1.4.20并替换apply plugin: 'kotlin-android-extensions'toapply plugin: 'kotlin-parcelize'或者plugins { .. id 'kotlin-parcelize' }第 2 步。从 android {} 中删除以下代码androidExtensions { experimental = true }第 3 步。最后,替换旧的 import ->import kotlinx.android.parcel.Parcelizetoimport kotlinx.parcelize.Parcelize新插件:https : //plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.parcelize
2021年07月10日
338 阅读
0 评论
0 点赞
2021-07-09
迁移已弃用的 Kotlin Android Extension 使用ViewBinding
最近出现在了一个这样的警告:The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.kotlinx.android.synthetic 不再是推荐的做法,删除支持显式findViewById,用ViewBinding替代ViewBinding与 Kotlin Extensions相比,它增加了视图查找和类型安全的编译时检查。但视图绑定后,可让您更轻松地编写与视图交互的代码。启用视图绑定后,它会为该模块中存在的每个 XML 布局文件生成一个绑定类。如何启用视图ViewBinding?在build.gradle中添加:android { .. buildFeatures { viewBinding true } }如何使用ViewBinding?如果为模块启用了视图绑定,则会为模块包含的每个 XML 布局文件生成一个绑定类。每个绑定类都包含对根视图和所有具有 ID 的视图的引用。绑定类的名称是通过将 XML 文件的名称转换为 Pascal 大小写并Binding在末尾添加单词来生成的。在Activity中使用ViewBindingprivate lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) }使用binding对象访问Viewbinding.name.text = "this is ViewBinding"在Fragment中使用ViewBinding在Fragment中使用ViewBinding需要注意,因为ViewBinding不能很好地与Fragment一起使用,如果不在OnDestroy清除,则它不会从内存中清除,导致内存泄漏。private var _binding: FragmentMainBinding? = null private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { _binding = FragmentMainBinding.inflate(inflater, container, false) return binding.root } override fun onDestroyView() { super.onDestroyView() _binding = null }像在activity中一样使用对象访问视图binding.name.text = "this is ViewBinding"备注ViewBinding将为模块中的每个XML布局生成一个绑定对象,例如:activity_main.xml<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout>ViewBinding将生成 ActivityMainBinding.javapublic final class ActivityMainBinding implements ViewBinding { @NonNull private final ConstraintLayout rootView; @NonNull public final TextView textView; ... }ViewBinding将为每个具有指定id. 在ActivityMainBinding.java中,ViewBinding生成一个公共inflate方法。它调用bind将绑定属性的位置,并进行一些错误检查。
2021年07月09日
366 阅读
0 评论
0 点赞
2021-07-09
Git添加多个远程仓库命令
方法一:默认只能从config中的第一个仓库pull代码git remote set-url --add gitee https://git.gitee.com/xxxx(仓库地址) // 此时只需要一次push就能同步到多个远程仓库 git push方法二:可以选择任一仓库pull// 添加github git remote add origin https://github.com/xxx(仓库地址) // 添加gitee git remote add gitee https://git.gitee.com/xxxx(仓库地址) // 删除origin仓库 git remote rm origin // 提交到github git push origin // 提交到gitee git push gitee // 从github更新 git pull origin master // 从gitee更新 git pull gitee master
2021年07月09日
146 阅读
0 评论
0 点赞
2021-07-01
抓包工具charles破解版
下载地址:https://www.charlesproxy.com/latest-release/download.do安装完之后打开:https://www.zzzmode.com/mytools/charles/按照下方的说明操作即可
2021年07月01日
369 阅读
0 评论
0 点赞
2021-06-23
GIT忽略而不提交文件的3种情形
1:从未提交过的文件可以用.gitignore 也就是添加之后从来没有提交(commit)过的文件,可以使用.gitignore忽略该文件;2:已经推送(push)过的文件,想从git远程库中删除,并在以后的提交中忽略,但是却还想在本地保留这个文件,执行:git rm --cached log/config.xmllog/config.xml要从远程库中删除的文件的路径,支持通配符*3:已经推送(push)过的文件,想在以后的提交时忽略此文件,即使本地已经修改过,而且不删除git远程库中相应文件 执行:git update-index --assume-unchanged log/config.xmllog/config.xml 是要忽略的文件的路径。如果要忽略一个目录,打开 git bash,cd到 目标目录下,执行: git update-index --assume-unchanged $(git ls-files | tr 'n' ' ') 比如有一个配置文件记录数据库的链接信息,每个人的链接信息肯定不一样,但是又要提供一个标准的模板,用来告知如何填写链接信息,那么就需要在git远程库上有一个标准配置文件,然后每个人根据自己的具体情况,修改一份链接信息自用,而且不会将该配置文件提交到库。
2021年06月23日
247 阅读
0 评论
0 点赞
2021-06-04
typecho服务器重启后出现502问题
重新启动php-fpm就好了systemctl restart php-fpm
2021年06月04日
321 阅读
0 评论
0 点赞
2021-04-02
Room数据库Schema export Error
在使用Android Room数据库的时候报错了:Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.如果您不需要检查架构并且想要摆脱警告,只需将exportSchema = false添加到RoomDatabase中,如下所示:@Database(entities = { YourEntity.class }, version = 1, exportSchema = false) public abstract class AppDatabase extends RoomDatabase { //... }另一种方法是在应用模块的build.gradle文件中,将此文件添加到defaultConfig部分(在android部分下面)。这会将架构写到项目文件夹的schemas子文件夹中。android { // ... (compileSdkVersion, buildToolsVersion, etc) defaultConfig { // ... (applicationId, miSdkVersion, etc) kapt { arguments { arg("room.schemaLocation","$projectDir/schemas".toString()) } } } buildTypes { // ... (buildTypes, compileOptions, etc) } } //...以上是Kotlin,如果是Java:android { // ... (compileSdkVersion, buildToolsVersion, etc) defaultConfig { // ... (applicationId, miSdkVersion, etc) javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation":"$projectDir/schemas".toString()] } } } // ... (buildTypes, compileOptions, etc) }当执行项目后,在Android Studio 的Project视图下,查看项目,会发现Module生成了一个schemas的文件夹,打开.json文件看起来像这样:{ "formatVersion": 1, "database": { "version": 1, "identityHash":"6240057b6178b803a0bf9915edf969e3", "entities": [ { "tableName":"sms_table", "createSql":"CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `message` TEXT, `date` INTEGER, `client_id` INTEGER)", "fields": [ { "fieldPath":"id", "columnName":"id", "affinity":"INTEGER" }, { "fieldPath":"message", "columnName":"message", "affinity":"TEXT" }, { "fieldPath":"date", "columnName":"date", "affinity":"INTEGER" }, { "fieldPath":"clientId", "columnName":"client_id", "affinity":"INTEGER" } ], "primaryKey": { "columnNames": [ "id" ], "autoGenerate": true }, "indices": [], "foreignKeys": [] } ], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, "6240057b6178b803a0bf9915edf969e3")" ] } }
2021年04月02日
560 阅读
0 评论
0 点赞
1
2
3
...
7