Skip to content
Open
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
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

def banubaSdkVersion = '1.39.0'
def banubaSdkVersion = '1.35.9.0.3'
implementation "com.banuba.sdk:ffmpeg:5.1.3"
implementation "com.banuba.sdk:camera-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:camera-ui-sdk:${banubaSdkVersion}"
Expand All @@ -152,6 +152,9 @@ dependencies {
implementation "com.banuba.sdk:ve-playback-sdk:${banubaSdkVersion}"

if (ENABLE_FACE_AR){
print("!!! BANUBA FACE AR IS ENABLED !!!")
implementation "com.banuba.sdk:effect-player-adapter:${banubaSdkVersion}"
} else {
print("!!! BANUBA FACE AR IS DISABLED !!!")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ internal const val EXPORTED_VIDEO_SOURCES = "exportedVideoSources"
internal const val EXPORTED_PREVIEW = "exportedPreview"
internal const val EXPORTED_META = "exportedMeta"

// New UI Config
internal const val FEATURES_CONFIG_EXPERIMENTAL_ENABLE_NEW_UI = "experimentalEnableNewUI"
internal const val FEATURES_CONFIG_EXTRA_USE_NEW_UI = "EXTRA_USE_NEW_UI"

// Features config params
internal const val FEATURES_CONFIG_AI_CAPTIONS = "aiCaptions"
internal const val FEATURES_CONFIG_AI_CAPTIONS_UPLOAD_URL = "uploadUrl"
Expand All @@ -40,7 +44,7 @@ internal const val FEATURES_CONFIG_AUDIO_BROWSER_PARAMS = "params"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_LOCAL = "local"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_MUBERT = "mubert"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_SOUNDSTRIPE = "soundstripe"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_BANUBA_MUSIC = "banubaMusic"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_DISABLED = "disabled"

internal const val FEATURES_CONFIG_AUDIO_BROWSER_PARAMS_MUBERT_LICENCE = "mubertLicence"
internal const val FEATURES_CONFIG_AUDIO_BROWSER_PARAMS_MUBERT_TOKEN = "mubertToken"
Expand Down Expand Up @@ -146,6 +150,7 @@ internal fun prepareExtras(featuresConfig: FeaturesConfig): Bundle {
bundle.putString(CaptionsApiService.ARG_CAPTIONS_TRANSCRIBE_URL, params.transcribeUrl)
bundle.putString(CaptionsApiService.ARG_API_KEY, params.apiKey)
}
bundle.putBoolean(FEATURES_CONFIG_EXTRA_USE_NEW_UI, featuresConfig.experimentalEnableNewUI)
return bundle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.banuba.ve.sdk.flutter.plugin.ve_sdk_flutter
import com.banuba.sdk.core.data.TrackData
import androidx.fragment.app.Fragment
import com.banuba.sdk.audiobrowser.domain.AudioBrowserMusicProvider
import com.banuba.sdk.audiobrowser.soundstripe.SoundstripeProvider
import com.banuba.sdk.audiobrowser.feedfm.BanubaMusicProvider
import com.banuba.sdk.audiobrowser.domain.SoundstripeProvider
import com.banuba.sdk.core.ui.SimpleMusicTrackProvider
import com.banuba.sdk.core.ui.ContentFeatureProvider
import com.banuba.sdk.core.domain.DraftConfig
import org.json.JSONObject
Expand All @@ -16,6 +16,7 @@ internal data class FeaturesConfig(
val editorConfig: EditorConfig = defaultEditorConfig,
val draftsConfig: DraftsConfig = defaultDraftsConfig,
val gifPickerConfig: GifPickerConfig? = null,
val experimentalEnableNewUI: Boolean = false
)

internal data class AiClipping(
Expand All @@ -36,7 +37,7 @@ internal data class AudioBrowser(
internal fun value(): ContentFeatureProvider<TrackData, Fragment> {
return when (this.source) {
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_SOUNDSTRIPE -> SoundstripeProvider()
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_BANUBA_MUSIC -> BanubaMusicProvider()
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_DISABLED -> SimpleMusicTrackProvider()
else -> {
AudioBrowserMusicProvider()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ internal fun parseFeaturesConfig(rawConfigParams: String?): FeaturesConfig =
featuresConfigObject.extractAudioBrowser(),
featuresConfigObject.extractEditorConfig(),
featuresConfigObject.extractDraftsConfig(),
featuresConfigObject.extractGifPickerConfig()
featuresConfigObject.extractGifPickerConfig(),
featuresConfigObject.optBoolean(FEATURES_CONFIG_EXPERIMENTAL_ENABLE_NEW_UI),
)
} catch (e: JSONException) {
defaultFeaturesConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import com.banuba.sdk.core.ui.ContentFeatureProvider
import com.banuba.sdk.playback.PlayerScaleType
import com.banuba.sdk.core.data.autocut.AutoCutTrackLoader
import com.banuba.sdk.ve.data.autocut.AutoCutConfig
import com.banuba.sdk.audiobrowser.autocut.AutoCutTrackLoaderSoundstripe
import com.banuba.sdk.ve.effects.watermark.WatermarkProvider
import com.banuba.sdk.audiobrowser.soundstripe.AutoCutSoundstripeTrackLoader
import com.banuba.sdk.audiobrowser.feedfm.AutoCutBanubaTrackLoader
import com.banuba.sdk.audiobrowser.domain.SoundstripeProvider
import com.banuba.sdk.core.domain.DraftConfig
import com.banuba.sdk.veui.data.stickers.GifPickerConfigurations
import com.banuba.sdk.audiobrowser.data.MubertApiConfig
import com.banuba.sdk.veui.data.music.MusicEditorConfig
import com.banuba.sdk.cameraui.data.CameraConfig
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import org.koin.core.qualifier.named
Expand Down Expand Up @@ -125,6 +127,11 @@ private class SampleIntegrationVeKoinModule(featuresConfig: FeaturesConfig, expo
featuresConfig.audioBrowser.value()
}

when (featuresConfig.audioBrowser.source){
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_MUBERT -> this.addMubertParams(featuresConfig)
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_DISABLED -> this.applyDisabledMusicConfig(featuresConfig)
}

if (featuresConfig.audioBrowser.source == FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_MUBERT) {
this.addMubertParams(featuresConfig)
}
Expand All @@ -137,18 +144,9 @@ private class SampleIntegrationVeKoinModule(featuresConfig: FeaturesConfig, expo
)
}
this.single<AutoCutTrackLoader> {
when (featuresConfig.audioBrowser.source) {
FEATURES_CONFIG_AUDIO_BROWSER_SOURCE_BANUBA_MUSIC -> {
AutoCutBanubaTrackLoader(
contentProvider = get()
)
}
else -> {
AutoCutSoundstripeTrackLoader(
soundstripeApi = get()
)
}
}
AutoCutTrackLoaderSoundstripe(
soundstripeApi = get()
)
}
}

Expand Down Expand Up @@ -206,6 +204,16 @@ private class SampleIntegrationVeKoinModule(featuresConfig: FeaturesConfig, expo
}
}

private fun Module.applyDisabledMusicConfig(featuresConfig: FeaturesConfig) {
this.single<MusicEditorConfig>{
MusicEditorConfig(supportsExternalMusic = false)
}

this.single <CameraConfig>{
CameraConfig(supportsExternalMusic = false)
}
}

private fun Module.addExportData(exportData: ExportData?) {
if (exportData == null) {
Log.d(TAG, MESSAGE_MISSING_EXPORT_DATA)
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.9.0"
version: "0.7.2"
vector_math:
dependency: transitive
description:
Expand Down
8 changes: 6 additions & 2 deletions ios/Classes/ContractConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ extension VeSdkFlutterPlugin {
draftsConfig: DraftsConfig(
option: "enable"
),
gifPickerConfig: nil
gifPickerConfig: nil,
experimentalEnableNewUI: false
)
}

Expand All @@ -100,7 +101,7 @@ extension VideoEditorConfig {
static let featuresConfigAudioBrowserSourceSoundstripe = "soundstripe"
static let featuresConfigAudioBrowserSourceMubert = "mubert"
static let featuresConfigAudioBrowserSourceLocal = "local"
static let featuresConfigAudioBrowserSourceBanubaMusic = "banubaMusic"
static let featuresConfigAudioBrowserSourceDisabled = "disabled"

// Draft Configs
static let featuresConfigDraftConfigOptionAskToSave = "askToSave"
Expand All @@ -113,6 +114,9 @@ extension VideoEditorConfig {

// Unknown params
static let featuresConfigUnknownParams = "Undefined"

// New UI Config
static let featuresConfigEnableNewUI = "ENABLE_NEW_UI"
}

extension ExportData {
Expand Down
3 changes: 1 addition & 2 deletions ios/Classes/FeaturesConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct FeaturesConfig: Codable {
let editorConfig: EditorConfig
let draftsConfig: DraftsConfig
let gifPickerConfig: GifPickerConfig?
let experimentalEnableNewUI: Bool
}

struct AiClipping: Codable {
Expand All @@ -32,8 +33,6 @@ struct AudioBrowser: Codable {
return .soundstripe
case VideoEditorConfig.featuresConfigAudioBrowserSourceLocal:
return .localStorageWithMyFiles
case VideoEditorConfig.featuresConfigAudioBrowserSourceBanubaMusic:
return .banubaMusic
default:
return .allSources
}
Expand Down
38 changes: 30 additions & 8 deletions ios/Classes/VideoEditorModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class VideoEditorModule: VideoEditor {

videoEditorSDK = BanubaVideoEditor(
token: token,
arguments: [VideoEditorConfig.featuresConfigEnableNewUI : featuresConfig.experimentalEnableNewUI],
configuration: config,
externalViewControllerFactory: provideCustomViewFactory(featuresConfig: featuresConfig)
)
Expand Down Expand Up @@ -292,7 +293,15 @@ extension VideoEditorConfig {

print("Add Features Config with params: \(featuresConfig)")

AudioBrowserConfig.shared.musicSource = featuresConfig.audioBrowser.value()
if featuresConfig.audioBrowser.source != VideoEditorConfig.featuresConfigAudioBrowserSourceDisabled {
AudioBrowserConfig.shared.musicSource = featuresConfig.audioBrowser.value()
}

switch featuresConfig.audioBrowser.source {
case VideoEditorConfig.featuresConfigAudioBrowserSourceMubert: addMubertParams(featuresConfig)
case VideoEditorConfig.featuresConfigAudioBrowserSourceDisabled: applyDisabledMusicConfig(featuresConfig)
default: return
}

if featuresConfig.audioBrowser.source == VideoEditorConfig.featuresConfigAudioBrowserSourceMubert {
guard let audioBrowserParams = featuresConfig.audioBrowser.params else { return }
Expand All @@ -304,6 +313,11 @@ extension VideoEditorConfig {
)
}

if featuresConfig.experimentalEnableNewUI {
self.videoEditorViewConfiguration.timelineConfiguration.isAddAudioEnabled = false
self.combinedGalleryConfiguration.visibleTabsInGallery = GalleryMediaType.allCases
}

if let aiCaptions = featuresConfig.aiCaptions {
self.captionsConfiguration.captionsUploadUrl = aiCaptions.uploadUrl
self.captionsConfiguration.captionsTranscribeUrl = aiCaptions.transcribeUrl
Expand All @@ -313,13 +327,7 @@ extension VideoEditorConfig {

if let aiClipping = featuresConfig.aiClipping, let audioTracksUrl = URL(string: aiClipping.audioTracksUrl) {
self.autoCutConfiguration.embeddingsDownloadUrl = aiClipping.audioDataUrl
self.autoCutConfiguration.musicProvider =
switch featuresConfig.audioBrowser.value() {
case .banubaMusic:
.banubaMusic(tracksURL: audioTracksUrl)
default:
.soundstripe(tracksURL: audioTracksUrl)
}
self.autoCutConfiguration.musicProvider = .soundstripe(tracksURL: audioTracksUrl)
}

self.editorConfiguration.isVideoAspectFillEnabled = featuresConfig.editorConfig.enableVideoAspectFill
Expand All @@ -339,4 +347,18 @@ extension VideoEditorConfig {
featureConfiguration.isMuteCameraAudioEnabled = true
self.updateFeatureConfiguration(featureConfiguration: featureConfiguration)
}

private func addMubertParams(_ featuresConfig: FeaturesConfig){
guard let audioBrowserParams = featuresConfig.audioBrowser.params else { return }
guard let mubertLicence = audioBrowserParams.mubertLicence, let mubertToken = audioBrowserParams.mubertToken else { return }

BanubaAudioBrowser.setMubertKeys(
license: mubertLicence,
token: mubertToken
)
}

private mutating func applyDisabledMusicConfig(_ featuresConfig: FeaturesConfig){
self.recorderConfiguration.additionalEffectsButtons = self.recorderConfiguration.additionalEffectsButtons.filter{$0.identifier != .sound}
}
}
9 changes: 7 additions & 2 deletions ios/ve_sdk_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ A new Flutter project.
s.dependency 'Flutter'
s.platform = :ios, '15.0'

sdk_version = '1.39.0'
sdk_version = '0.40.1'

ENABLE_FACE_AR = ENV['ENABLE_FACE_AR'] == 'true' || ENV['ENABLE_FACE_AR'].nil?

s.dependency 'BanubaARCloudSDK', sdk_version #optional
s.dependency 'BanubaVideoEditorSDK', sdk_version
s.dependency 'BanubaAudioBrowserSDK', sdk_version #optional
s.dependency 'BanubaSDK', sdk_version if ENABLE_FACE_AR
if ENABLE_FACE_AR
puts "!!! BANUBA FACE AR IS ENABLED !!!"
s.dependency 'BanubaSDK', sdk_version
else
puts "!!! BANUBA FACE AR IS DISABLED !!!"
end
s.dependency 'BanubaSDKSimple', sdk_version
s.dependency 'BanubaSDKServicing', sdk_version
s.dependency 'VideoEditor', sdk_version
Expand Down
12 changes: 10 additions & 2 deletions lib/features_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ class FeaturesConfig {
final EditorConfig editorConfig;
final DraftsConfig draftsConfig;
final GifPickerConfig? gifPickerConfig;
final bool experimentalEnableNewUI;

FeaturesConfig._builder(FeaturesConfigBuilder builder)
: aiClipping = builder._aiClipping,
aiCaptions = builder._aiCaptions,
audioBrowser = builder._audioBrowser,
editorConfig = builder._editorConfig,
draftsConfig = builder._draftsConfig,
gifPickerConfig = builder._gifPickerConfig;
gifPickerConfig = builder._gifPickerConfig,
experimentalEnableNewUI = builder._experimentalEnableNewUI;
}

class FeaturesConfigBuilder {
Expand All @@ -27,6 +29,7 @@ class FeaturesConfigBuilder {
DraftsConfig _draftsConfig =
DraftsConfig.fromOption(DraftsOption.askToSave);
GifPickerConfig? _gifPickerConfig;
bool _experimentalEnableNewUI = false;

FeaturesConfigBuilder setAiClipping(aiClipping) {
_aiClipping = aiClipping;
Expand Down Expand Up @@ -58,12 +61,17 @@ class FeaturesConfigBuilder {
return this;
}

FeaturesConfigBuilder setExperimentalEnableNewUI(experimentalEnableNewUI) {
_experimentalEnableNewUI = experimentalEnableNewUI;
return this;
}

FeaturesConfig build() {
return FeaturesConfig._builder(this);
}
}

enum AudioBrowserSource { soundstripe, local, mubert, banubaMusic }
enum AudioBrowserSource { soundstripe, local, mubert, disabled }

@immutable
class AudioBrowser {
Expand Down
3 changes: 2 additions & 1 deletion lib/features_config_serializer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ extension FeatureConfigSerializer on FeaturesConfig {
'audioBrowser': audioBrowser._serialize(),
'editorConfig': editorConfig._serialize(),
'draftsConfig': draftsConfig._serialize(),
'gifPickerConfig': gifPickerConfig?._serialize()
'gifPickerConfig': gifPickerConfig?._serialize(),
'experimentalEnableNewUI': experimentalEnableNewUI,
};
return jsonEncode(configMap);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/ve_sdk_flutter_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ class MethodChannelVeSdkFlutter extends VeSdkFlutterPlatform {
List<String> sourceVideoPathList,
{ExportData? exportData}
) async {
if (featuresConfig.experimentalEnableNewUI && screen == _screenTrimmer){
debugPrint("New UI is not available from Trimmer screen");
return null;
}
final inputParams = {
_inputParamToken: token,
_inputParamFeaturesConfig: featuresConfig.serialize(),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ve_sdk_flutter
description: Banuba Video Editor Flutter plugin.
version: 0.9.0
version: 0.7.2
homepage: https://github.com/Banuba/ve-sdk-flutter

environment:
Expand Down