Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] Compatible getAssetAbsolutePath function on web #1327

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/src/agora_rtc_engine_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ extension RtcEngineExt on RtcEngine {
/// The actual path of the Asset.
Future<String?> getAssetAbsolutePath(String assetPath) async {
final impl = this as RtcEngineImpl;
final p = await impl.engineMethodChannel
.invokeMethod<String>('getAssetAbsolutePath', assetPath);
return p;
return impl.getAssetAbsolutePath(assetPath);
}
}

Expand Down
11 changes: 11 additions & 0 deletions lib/src/impl/agora_rtc_engine_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,17 @@ class RtcEngineImpl extends rtc_engine_ex_binding.RtcEngineExImpl
}
}

Future<String?> getAssetAbsolutePath(String assetPath) async {
if (kIsWeb) {
// The assets are located in the `assets` directory.
return 'assets/$assetPath';
}

final p = await engineMethodChannel.invokeMethod<String>(
'getAssetAbsolutePath', assetPath);
return p;
}

/////////// debug ////////

/// [type] see [VideoSourceType], only [VideoSourceType.videoSourceCamera], [VideoSourceType.videoSourceRemote] supported
Expand Down