提交测试711音频播放成功
This commit is contained in:
parent
a9dfd3f847
commit
3d0dc3074f
1
star_lock/assets/s10-g711.bin
Normal file
1
star_lock/assets/s10-g711.bin
Normal file
File diff suppressed because one or more lines are too long
@ -38,6 +38,13 @@ PODS:
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- EMASRest (11.1.1.2)
|
||||
- ffmpeg-kit-ios-https (5.1.LTS)
|
||||
- ffmpeg_kit_flutter (5.1.0.LTS):
|
||||
- ffmpeg_kit_flutter/https-lts (= 5.1.0.LTS)
|
||||
- Flutter
|
||||
- ffmpeg_kit_flutter/https-lts (5.1.0.LTS):
|
||||
- ffmpeg-kit-ios-https (= 5.1.LTS)
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- flutter_native_contact_picker (0.0.1):
|
||||
- Flutter
|
||||
@ -107,6 +114,7 @@ DEPENDENCIES:
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- ffmpeg_kit_flutter (from `.symlinks/plugins/ffmpeg_kit_flutter/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||
- flutter_sound (from `.symlinks/plugins/flutter_sound/ios`)
|
||||
@ -139,6 +147,7 @@ SPEC REPOS:
|
||||
- AMap3DMap
|
||||
- AMapFoundation
|
||||
- AMapLocation
|
||||
- ffmpeg-kit-ios-https
|
||||
- flutter_sound_core
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
@ -165,6 +174,8 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
ffmpeg_kit_flutter:
|
||||
:path: ".symlinks/plugins/ffmpeg_kit_flutter/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_native_contact_picker:
|
||||
@ -223,6 +234,8 @@ SPEC CHECKSUMS:
|
||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
|
||||
ffmpeg-kit-ios-https: 9e50ffa7eaa6272a0021829e054ef241f2ecffb2
|
||||
ffmpeg_kit_flutter: fb5bee3a6038231463ee99e30f97a5763e0ae40f
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
|
||||
@ -249,6 +262,6 @@ SPEC CHECKSUMS:
|
||||
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
|
||||
PODFILE CHECKSUM: adf6d8caf5faa9ea4ee2a2ea37f5aea37a6520d7
|
||||
PODFILE CHECKSUM: 42aa7ffc6134b996f93caa6a9b6a2b5b580ff28a
|
||||
|
||||
COCOAPODS: 1.12.1
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3364C3F42B0C902100AA5ABC /* lcokStarMain.png in Resources */ = {isa = PBXBuildFile; fileRef = 3364C3F32B0C902100AA5ABC /* lcokStarMain.png */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
3EF1E85D6F1EE0C0DCF8449F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */; };
|
||||
8297E4102AE75AC500E886FA /* XSFlutterManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8297E40E2AE75AC500E886FA /* XSFlutterManager.m */; };
|
||||
8297E43A2AE75BEE00E886FA /* Msg.m in Sources */ = {isa = PBXBuildFile; fileRef = 8297E4132AE75BEE00E886FA /* Msg.m */; };
|
||||
8297E43B2AE75BEE00E886FA /* udp_data_class.m in Sources */ = {isa = PBXBuildFile; fileRef = 8297E4172AE75BEE00E886FA /* udp_data_class.m */; };
|
||||
@ -125,6 +124,7 @@
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
CD1142BE3A076363977FB03C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED1F1A04428235FB1B6FD471 /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -141,9 +141,10 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0BEB3ADCCEC961E2916B9004 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
265F8968B3CDB02494B21491 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3364C3F32B0C902100AA5ABC /* lcokStarMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lcokStarMain.png; sourceTree = "<group>"; };
|
||||
33BF41252A96174D009D92E2 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
@ -303,9 +304,8 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
99F6494C6B1A24363CCC6D32 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
BDB5B400176768766E85D5EB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
DC20461C9C4624BEB2DCD779 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
DAD8EE71BE7C05B99667C256 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
ED1F1A04428235FB1B6FD471 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -313,7 +313,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3EF1E85D6F1EE0C0DCF8449F /* Pods_Runner.framework in Frameworks */,
|
||||
CD1142BE3A076363977FB03C /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -323,9 +323,9 @@
|
||||
780FAA17A040B9755AD6154A /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DC20461C9C4624BEB2DCD779 /* Pods-Runner.debug.xcconfig */,
|
||||
99F6494C6B1A24363CCC6D32 /* Pods-Runner.release.xcconfig */,
|
||||
BDB5B400176768766E85D5EB /* Pods-Runner.profile.xcconfig */,
|
||||
0BEB3ADCCEC961E2916B9004 /* Pods-Runner.debug.xcconfig */,
|
||||
265F8968B3CDB02494B21491 /* Pods-Runner.release.xcconfig */,
|
||||
DAD8EE71BE7C05B99667C256 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
@ -565,14 +565,6 @@
|
||||
path = img;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9304F75C378DB3447BB2408C /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -591,7 +583,7 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
780FAA17A040B9755AD6154A /* Pods */,
|
||||
9304F75C378DB3447BB2408C /* Frameworks */,
|
||||
B8F749EDCB3FB55CC9253F00 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@ -635,6 +627,14 @@
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B8F749EDCB3FB55CC9253F00 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ED1F1A04428235FB1B6FD471 /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -642,14 +642,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
03BC065FC3064C0B6EE97546 /* [CP] Check Pods Manifest.lock */,
|
||||
818C8F3353996877C27F8ACC /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
D9B107A6B141D5F15BC356F2 /* [CP] Copy Pods Resources */,
|
||||
8AC988DFB36B18C3A52624A8 /* [CP] Embed Pods Frameworks */,
|
||||
C87CD71185302EE14BA1323E /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -783,7 +784,23 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
03BC065FC3064C0B6EE97546 /* [CP] Check Pods Manifest.lock */ = {
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
|
||||
};
|
||||
818C8F3353996877C27F8ACC /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@ -805,21 +822,22 @@
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
8AC988DFB36B18C3A52624A8 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
@ -836,7 +854,7 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
|
||||
};
|
||||
D9B107A6B141D5F15BC356F2 /* [CP] Copy Pods Resources */ = {
|
||||
C87CD71185302EE14BA1323E /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@ -1106,6 +1124,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
@ -1355,6 +1374,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
@ -1498,6 +1518,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
|
||||
@ -5,8 +5,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
import 'package:star_lock/talk/call/g711.dart';
|
||||
import 'package:star_lock/tools/app_manager.dart';
|
||||
import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||
import 'package:star_lock/tools/device_info_service.dart';
|
||||
@ -52,6 +54,8 @@ final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
final _aliyunPush = AliyunPush();
|
||||
var _deviceId = "";
|
||||
// final audioPlayer = AudioPlayer();
|
||||
final FlutterSoundPlayer _audioPlayer = FlutterSoundPlayer();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -130,6 +134,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
// Uint8List uint8List = Uint8List.fromList([]);
|
||||
// CallTalk talkClass = CallTalk();
|
||||
// talkClass.getAVData(uint8List, 90);
|
||||
|
||||
_initializeAudioPlayer();
|
||||
}
|
||||
|
||||
//初始化阿里云推送
|
||||
@ -158,6 +164,54 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
// });
|
||||
}
|
||||
|
||||
Uint8List convertToInt8ListLittleEndian(List<int> intList) {
|
||||
List<int> int8List = [];
|
||||
|
||||
for (int intValue in intList) {
|
||||
intValue = intValue * 2;
|
||||
// 将 int 拆分为两个字节,采用小端序
|
||||
int8List.add(intValue & 0xFF); // 低 8 位
|
||||
int8List.add((intValue & 0xFF00) >> 8); // 高 8 位
|
||||
}
|
||||
|
||||
return Uint8List.fromList(int8List);
|
||||
}
|
||||
|
||||
//音频相关处理
|
||||
Future<void> _initializeAudioPlayer() async {
|
||||
await _audioPlayer.closePlayer();
|
||||
await _audioPlayer.openPlayer();
|
||||
await _audioPlayer.setSubscriptionDuration(Duration(milliseconds: 10));
|
||||
|
||||
List<int> pcmBytes;
|
||||
|
||||
String filePath = 'assets/s10-g711.bin';
|
||||
|
||||
List<int> audioData = await G711().readAssetFile(filePath);
|
||||
// print('读取711文件数据长度为:${audioData.length} 数据为:$audioData');
|
||||
if (audioData.isNotEmpty) {
|
||||
// 在这里处理你的音频数据
|
||||
pcmBytes = G711().convertList(audioData);
|
||||
print('转换pcmBytes数据长度为:${pcmBytes.length}');
|
||||
_playRawData(pcmBytes);
|
||||
} else {
|
||||
print('Failed to read audio data.');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _playRawData(List<int> rawData) async {
|
||||
print(
|
||||
'啊啦啦啦啦啦数据长度为:${convertToInt8ListLittleEndian(rawData).length}, 数据为 ${convertToInt8ListLittleEndian(rawData)}');
|
||||
|
||||
await _audioPlayer.startPlayer(
|
||||
fromURI: null,
|
||||
fromDataBuffer: convertToInt8ListLittleEndian(rawData),
|
||||
codec: Codec.pcm16, //_codec,
|
||||
sampleRate: 8000, //tSAMPLERATE,
|
||||
numChannels: 1,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance?.removeObserver(this);
|
||||
@ -189,4 +243,3 @@ Future _setCommonServices() async {
|
||||
await Get.putAsync(() => DeviceInfoService().init());
|
||||
// Get.log(PlatformInfoService.to.info.version);
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,6 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
|
||||
import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||
import 'package:star_lock/talk/call/g711.dart';
|
||||
import 'package:star_lock/talk/call/iFrameInfo.dart';
|
||||
|
||||
@ -46,7 +40,14 @@ class CallTalk {
|
||||
if (bb[61] == 1) {
|
||||
Uint8List g711Data = bb.sublist(77, bb.length);
|
||||
print('dinglingling bb.length:${g711Data.length} 音频数据来:$g711Data ');
|
||||
Uint8List? pcmBytes = await G711().decodeG711ToPCM(g711Data.toList());
|
||||
|
||||
List<int> pcmBytes = Uint8List.fromList([]);
|
||||
try {
|
||||
// 将 ALaw 转为 Linear
|
||||
pcmBytes = G711().convertList(g711Data);
|
||||
} catch (e) {
|
||||
print('Error decoding G.711 to PCM: $e');
|
||||
}
|
||||
|
||||
print('PCM decoded data: $pcmBytes');
|
||||
|
||||
@ -56,7 +57,6 @@ class CallTalk {
|
||||
} else {
|
||||
print('Error decoding G.711 to PCM');
|
||||
}
|
||||
// 在这里处理你的 PCM 数据
|
||||
}
|
||||
// 视频数据
|
||||
else {
|
||||
@ -142,15 +142,14 @@ class CallTalk {
|
||||
await _audioPlayer.openPlayer();
|
||||
}
|
||||
|
||||
Future<void> _playRawData(Uint8List rawData) async {
|
||||
Future<void> _playRawData(List<int> rawData) async {
|
||||
await _audioPlayer.startPlayer(
|
||||
fromDataBuffer: rawData,
|
||||
fromDataBuffer: Uint8List.fromList(rawData),
|
||||
codec: Codec.pcm16,
|
||||
numChannels: 1,
|
||||
sampleRate: 8000,
|
||||
whenFinished: () {
|
||||
// 播放完成时的回调
|
||||
print("Playback finished");
|
||||
print('Finished playing');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,89 +1,111 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi' as ffi;
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
|
||||
import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart';
|
||||
import 'package:ffmpeg_kit_flutter/return_code.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class G711 {
|
||||
Future<List<int>> readAssetFile(String assetPath) async {
|
||||
ByteData data = await rootBundle.load(assetPath);
|
||||
List<int> bytes = data.buffer.asUint8List();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int ALawToLinear(int aVal) {
|
||||
// 取反
|
||||
aVal = ~aVal;
|
||||
|
||||
// 计算偏移
|
||||
int t = ((aVal & 0x0F) << 3) + 0x84;
|
||||
t <<= (aVal & 0x70) >> 4;
|
||||
|
||||
// 根据符号位决定返回值的正负
|
||||
return (aVal & 0x80) != 0 ? 0x84 - t : t - 0x84;
|
||||
}
|
||||
|
||||
List<int> convertList(List<int> aLawList) {
|
||||
// 将 ALawToLinear 函数应用于 List<int>
|
||||
List<int> linearList = aLawList.map(ALawToLinear).toList();
|
||||
return linearList;
|
||||
}
|
||||
|
||||
Future<Uint8List?> decodeG711ToPCM(List<int> g711Data) async {
|
||||
// FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg();
|
||||
|
||||
// Save G.711 data to a temporary file
|
||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
String g711FilePath = '${appDocDir.path}/input.g711';
|
||||
await File(g711FilePath).writeAsBytes(g711Data);
|
||||
|
||||
// Replace with the desired output PCM file path
|
||||
String pcmFilePath = '${appDocDir.path}/output.pcm';
|
||||
|
||||
// Run FFmpeg command to decode G.711 to PCM
|
||||
// String command =
|
||||
// '-y -f u8 -ar 8000 -ac 1 -i $g711FilePath -f s16le -ar 8000 -ac 1 $pcmFilePath';
|
||||
try {
|
||||
FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg();
|
||||
final session = await FFmpegKit.execute(
|
||||
'-y -f u8 -ar 8000 -ac 1 -i $g711FilePath -f s16le -ar 8000 -ac 1 $pcmFilePath',
|
||||
);
|
||||
|
||||
// Save G.711 data to a temporary file
|
||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
String g711FilePath = '${appDocDir.path}/input.g711';
|
||||
await File(g711FilePath).writeAsBytes(g711Data);
|
||||
final returnCode = await session.getReturnCode();
|
||||
|
||||
// Replace with the desired output PCM file path
|
||||
String pcmFilePath = '${appDocDir.path}/output.pcm';
|
||||
|
||||
// Run FFmpeg command to decode G.711 to PCM
|
||||
String command =
|
||||
'-y -f u8 -ar 8000 -ac 1 -i $g711FilePath -f s16le -ar 8000 -ac 1 $pcmFilePath';
|
||||
int result = await flutterFFmpeg.execute(command);
|
||||
|
||||
if (result == 0) {
|
||||
print('G.711 decoding successful! PCM file saved at: $pcmFilePath');
|
||||
|
||||
// Read PCM data from file
|
||||
if (ReturnCode.isSuccess(returnCode)) {
|
||||
Uint8List pcmBytes = await File(pcmFilePath).readAsBytes();
|
||||
|
||||
// Delete the temporary G.711 file
|
||||
await File(g711FilePath).delete();
|
||||
|
||||
// Delete the temporary PCM file
|
||||
await File(pcmFilePath).delete();
|
||||
|
||||
return pcmBytes;
|
||||
} else {
|
||||
print('Error during G.711 decoding: $result');
|
||||
return null;
|
||||
print('FFmpeg execution failed with rc=$returnCode');
|
||||
// 处理执行失败的情况
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
return null;
|
||||
print('Error executing FFmpeg command: $e');
|
||||
// 处理异常情况
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<Uint8List?> encodePCMToG711(Uint8List pcmData) async {
|
||||
try {
|
||||
FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg();
|
||||
// Future<Uint8List?> encodePCMToG711(Uint8List pcmData) async {
|
||||
// try {
|
||||
// // FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg();
|
||||
|
||||
// Save PCM data to a temporary file
|
||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
String pcmFilePath = '${appDocDir.path}/input.pcm';
|
||||
await File(pcmFilePath).writeAsBytes(pcmData);
|
||||
// // Save PCM data to a temporary file
|
||||
// Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
// String pcmFilePath = '${appDocDir.path}/input.pcm';
|
||||
// await File(pcmFilePath).writeAsBytes(pcmData);
|
||||
|
||||
// Replace with the desired output G.711 file path
|
||||
String g711FilePath = '${appDocDir.path}/output.g711';
|
||||
// // Replace with the desired output G.711 file path
|
||||
// String g711FilePath = '${appDocDir.path}/output.g711';
|
||||
|
||||
// Run FFmpeg command to encode PCM to G.711
|
||||
String command =
|
||||
'-y -f s16le -ar 8000 -ac 1 -i $pcmFilePath -f g711 -ar 8000 -ac 1 $g711FilePath';
|
||||
int result = await flutterFFmpeg.execute(command);
|
||||
// // Run FFmpeg command to encode PCM to G.711
|
||||
// String command =
|
||||
// '-y -f s16le -ar 8000 -ac 1 -i $pcmFilePath -f g711 -ar 8000 -ac 1 $g711FilePath';
|
||||
// int result = await flutterFFmpeg.execute(command);
|
||||
|
||||
if (result == 0) {
|
||||
print(
|
||||
'PCM encoding to G.711 successful! G.711 file saved at: $g711FilePath');
|
||||
// if (result == 0) {
|
||||
// print(
|
||||
// 'PCM encoding to G.711 successful! G.711 file saved at: $g711FilePath');
|
||||
|
||||
// Read G.711 data from file
|
||||
Uint8List g711Bytes = await File(g711FilePath).readAsBytes();
|
||||
// // Read G.711 data from file
|
||||
// Uint8List g711Bytes = await File(g711FilePath).readAsBytes();
|
||||
|
||||
// Delete the temporary PCM file
|
||||
await File(pcmFilePath).delete();
|
||||
// // Delete the temporary PCM file
|
||||
// await File(pcmFilePath).delete();
|
||||
|
||||
// Delete the temporary G.711 file
|
||||
await File(g711FilePath).delete();
|
||||
// // Delete the temporary G.711 file
|
||||
// await File(g711FilePath).delete();
|
||||
|
||||
return g711Bytes;
|
||||
} else {
|
||||
print('Error during PCM encoding to G.711: $result');
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// return g711Bytes;
|
||||
// } else {
|
||||
// print('Error during PCM encoding to G.711: $result');
|
||||
// return null;
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print('Error: $e');
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import aj_captcha_flutter
|
||||
import audio_session
|
||||
import audioplayers_darwin
|
||||
import device_info_plus
|
||||
import ffmpeg_kit_flutter
|
||||
import file_selector_macos
|
||||
import just_audio
|
||||
import network_info_plus
|
||||
@ -23,6 +24,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FFmpegKitFlutterPlugin.register(with: registry.registrar(forPlugin: "FFmpegKitFlutterPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||
NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin"))
|
||||
|
||||
@ -125,7 +125,7 @@ dependencies:
|
||||
convert: ^3.1.1
|
||||
just_audio: ^0.9.36
|
||||
flutter_sound: ^9.2.13
|
||||
flutter_ffmpeg: ^0.4.2
|
||||
ffmpeg_kit_flutter: 5.1.0-LTS
|
||||
fast_gbk: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user