[+] 混音
This commit is contained in:
@@ -2,6 +2,7 @@ package com.acgist.taoyao.client;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -134,9 +135,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
this.mainHandler = new MainHandler();
|
||||
final Context context = this.getApplicationContext();
|
||||
final Resources resources = this.getResources();
|
||||
MediaManager.getInstance().initContext(
|
||||
this.mainHandler, this.getApplicationContext(),
|
||||
final MediaManager mediaManager = MediaManager.getInstance();
|
||||
mediaManager.initContext(
|
||||
this.mainHandler, context,
|
||||
resources.getInteger(R.integer.imageQuantity),
|
||||
resources.getString(R.string.audioQuantity),
|
||||
resources.getString(R.string.videoQuantity),
|
||||
@@ -147,6 +150,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
resources.getString(R.string.watermark),
|
||||
VideoSourceType.valueOf(resources.getString(R.string.videoSourceType))
|
||||
);
|
||||
if(resources.getBoolean(R.bool.broadcaster)) {
|
||||
mediaManager.initTTS(context);
|
||||
}
|
||||
// 注意:不能使用intent传递
|
||||
MediaService.mainHandler = this.mainHandler;
|
||||
Log.i(MainActivity.class.getSimpleName(), "拉起媒体服务");
|
||||
|
||||
@@ -76,8 +76,9 @@ public class MediaService extends Service {
|
||||
:: https://gitee.com/acgist/taoyao
|
||||
""");
|
||||
super.onCreate();
|
||||
this.mkdir(R.string.storagePathImage);
|
||||
this.mkdir(R.string.storagePathVideo);
|
||||
final Resources resources = this.getResources();
|
||||
this.mkdir(resources.getString(R.string.storagePathImage), Environment.DIRECTORY_PICTURES);
|
||||
this.mkdir(resources.getString(R.string.storagePathVideo), Environment.DIRECTORY_MOVIES);
|
||||
this.buildNotificationChannel();
|
||||
}
|
||||
|
||||
@@ -192,13 +193,16 @@ public class MediaService extends Service {
|
||||
MediaManager.getInstance().initScreen(intent.getParcelableExtra("data"));
|
||||
}
|
||||
|
||||
private void mkdir(int id) {
|
||||
private void mkdir(String path, String type) {
|
||||
final Path imagePath = Paths.get(
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath(),
|
||||
this.getResources().getString(id)
|
||||
Environment.getExternalStoragePublicDirectory(type).getAbsolutePath(),
|
||||
path
|
||||
);
|
||||
final File file = imagePath.toFile();
|
||||
if(!file.exists()) {
|
||||
if(file.exists()) {
|
||||
Log.d(MediaService.class.getSimpleName(), "目录已经存在:" + imagePath);
|
||||
} else {
|
||||
Log.d(MediaService.class.getSimpleName(), "新建文件目录:" + imagePath);
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<!-- 信令加密密钥 -->
|
||||
<string name="encryptSecret">2SPWy+TF1zM=</string>
|
||||
<!-- 图片存储目录 -->
|
||||
<string name="storagePathImage">/taoyao/image</string>
|
||||
<string name="storagePathImage">/taoyao</string>
|
||||
<!-- 视频存储目录 -->
|
||||
<string name="storagePathVideo">/taoyao/video</string>
|
||||
<string name="storagePathVideo">/taoyao</string>
|
||||
<!-- 视频来源:FILE|BACK|FRONT|SCREEN -->
|
||||
<string name="videoSourceType">BACK</string>
|
||||
<!-- 媒体配置:是否消费数据 -->
|
||||
@@ -34,6 +34,8 @@
|
||||
<bool name="audioProduce">true</bool>
|
||||
<!-- 媒体配置:是否生产视频 -->
|
||||
<bool name="videoProduce">true</bool>
|
||||
<!-- 语音播报 -->
|
||||
<bool name="broadcaster">false</bool>
|
||||
<!-- 图片质量 -->
|
||||
<integer name="imageQuantity">100</integer>
|
||||
<!-- 音频质量 -->
|
||||
|
||||
Reference in New Issue
Block a user