diff --git a/Demo/app/build.gradle b/Demo/app/build.gradle index aa87bff1..57bddc2b 100644 --- a/Demo/app/build.gradle +++ b/Demo/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.tencent.liteav.demo" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 9 - versionName "7.8.588" + versionCode 10 + versionName "7.9.607" multiDexEnabled true ndk { diff --git a/Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java b/Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java index 3f03d22b..dbdfcdc4 100644 --- a/Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java +++ b/Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java @@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); mTvVersion = (TextView) findViewById(R.id.main_tv_version); - mTvVersion.setText("视频云工具包 v" + TXLiveBase.getSDKVersionStr()+"(7.8.588)"); + mTvVersion.setText("视频云工具包 v" + TXLiveBase.getSDKVersionStr()+"(7.9.607)"); mMainTitle = (TextView) findViewById(R.id.main_title); mMainTitle.setOnLongClickListener(new View.OnLongClickListener() { diff --git a/Demo/beautysettingkit/src/main/assets/default_beauty_data.json b/Demo/beautysettingkit/src/main/assets/default_beauty_data.json index 024b1a46..653b03df 100644 --- a/Demo/beautysettingkit/src/main/assets/default_beauty_data.json +++ b/Demo/beautysettingkit/src/main/assets/default_beauty_data.json @@ -21,6 +21,7 @@ "tab_item_level_value_size": 14, "tab_item_level_progress_drawable": "@beauty_progress_drawable", "tab_item_level_progress_thumb": "@beauty_thumb", + "tab_item_list_default_selected_index": 2, "tab_item_list": [ { "item_id": 1, @@ -255,6 +256,7 @@ "tab_item_level_value_size": 14, "tab_item_level_progress_drawable": "@beauty_progress_drawable", "tab_item_level_progress_thumb": "@beauty_thumb", + "tab_item_list_default_selected_index": 1, "tab_item_list": [ { "item_id": 1, diff --git a/Demo/app/src/main/assets/green_1.mp4 b/Demo/beautysettingkit/src/main/assets/green_1.mp4 similarity index 100% rename from Demo/app/src/main/assets/green_1.mp4 rename to Demo/beautysettingkit/src/main/assets/green_1.mp4 diff --git a/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/model/TabInfo.java b/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/model/TabInfo.java index c37a56fa..c9881fd4 100644 --- a/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/model/TabInfo.java +++ b/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/model/TabInfo.java @@ -25,6 +25,8 @@ public class TabInfo { private String tab_item_level_progress_drawable;// string, 进度条背景颜色 private String tab_item_level_progress_thumb; // string, 进度条 bar 颜色 + private int tab_item_list_default_selected_index; // int, 默认选中的item + private List tab_item_list; public long getTabId() { @@ -83,6 +85,10 @@ public String getTabItemLevelProgressThumb() { return tab_item_level_progress_thumb; } + public int getTabItemListDefaultSelectedIndex() { + return tab_item_list_default_selected_index; + } + public List getTabItemList() { return tab_item_list; } @@ -103,6 +109,7 @@ public String toString() { ", tab_item_level_value_size=" + tab_item_level_value_size + ", tab_item_level_progress_drawable='" + tab_item_level_progress_drawable + '\'' + ", tab_item_level_progress_thumb='" + tab_item_level_progress_thumb + '\'' + + ", tab_item_list_default_selected_index='" + tab_item_list_default_selected_index + '\'' + ", tab_item_list=" + tab_item_list + '}'; } diff --git a/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/view/BeautyPanel.java b/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/view/BeautyPanel.java index c00de7e1..80edb8ed 100644 --- a/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/view/BeautyPanel.java +++ b/Demo/beautysettingkit/src/main/java/com/tencent/liteav/demo/beauty/view/BeautyPanel.java @@ -124,9 +124,10 @@ public void setVisibility(int visibility) { */ public void setBeautyInfo(@NonNull BeautyInfo beautyInfo) { mBeautyInfo = beautyInfo; - int tabSize = beautyInfo.getBeautyTabList().size(); - mCurrentItemPosition = new int[tabSize]; - mCurrentItemInfo = new ItemInfo[tabSize]; + + //根据配置文件选择默认选中项 + setCurrentBeautyInfo(beautyInfo); + mBeauty.fillingMaterialPath(beautyInfo); setBackground(ResourceUtils.getLinearDrawable(ResourceUtils.getColor(beautyInfo.getBeautyBg()))); refresh(); @@ -156,9 +157,11 @@ public BeautyInfo getDefaultBeautyInfo() { public void setBeautyManager(TXBeautyManager beautyManager) { mBeauty.setBeautyManager(beautyManager); clear(); - // 滤镜默认选中白皙 - setCurrentFilterIndex(1); - setCurrentBeautyIndex(2); + + if (mBeautyInfo != null) { + //根据配置文件选择默认选中项 + setCurrentBeautyInfo(mBeautyInfo); + } } public void setMotionTmplEnable(boolean enable) { @@ -221,6 +224,19 @@ private void initData() { setBeautyInfo(getDefaultBeautyInfo()); } + private void setCurrentBeautyInfo(@NonNull BeautyInfo beautyInfo) { + int tabSize = beautyInfo.getBeautyTabList().size(); + mCurrentItemPosition = new int[tabSize]; + mCurrentItemInfo = new ItemInfo[tabSize]; + + for (int i = 0; i < tabSize; i++) { + TabInfo tabInfo = beautyInfo.getBeautyTabList().get(i); + mCurrentItemPosition[i] = tabInfo.getTabItemListDefaultSelectedIndex(); + mCurrentItemInfo[i] = tabInfo.getTabItemList().get(tabInfo.getTabItemListDefaultSelectedIndex()); + mBeauty.setBeautySpecialEffects(tabInfo, i, mCurrentItemInfo[i], mCurrentItemPosition[i]); + } + } + private void refresh() { createTabList(); } @@ -248,15 +264,7 @@ public void onTabChange(TabInfo tabInfo, int position) { private void createItemList(@NonNull final TabInfo tabInfo, @NonNull final int tabPosition) { setBeautyTitle(tabInfo.getTabName()); ItemAdapter itemAdapter = new ItemAdapter(mContext); - if (tabInfo.getTabType() == BeautyConstants.TAB_TYPE_FILTER) { - // 滤镜默认选中白皙 - itemAdapter.setData(tabInfo, mCurrentItemPosition[1]); - } else if(tabInfo.getTabType() == BeautyConstants.TAB_TYPE_BEAUTY) { - // 美颜默认选中P图 - itemAdapter.setData(tabInfo, mCurrentItemPosition[0]); - } else { - itemAdapter.setData(tabInfo); - } + itemAdapter.setData(tabInfo, mCurrentItemPosition[tabPosition]); mScrollItemView.setAdapter(itemAdapter); mScrollItemView.setClicked(mCurrentItemPosition[tabPosition]); itemAdapter.setOnItemClickListener(new ItemAdapter.OnItemClickListener() { diff --git a/Demo/livepusherdemo/src/main/java/com/tencent/liteav/demo/livepusher/camerapush/model/CameraPushImpl.java b/Demo/livepusherdemo/src/main/java/com/tencent/liteav/demo/livepusher/camerapush/model/CameraPushImpl.java index 91e09796..179c5c63 100644 --- a/Demo/livepusherdemo/src/main/java/com/tencent/liteav/demo/livepusher/camerapush/model/CameraPushImpl.java +++ b/Demo/livepusherdemo/src/main/java/com/tencent/liteav/demo/livepusher/camerapush/model/CameraPushImpl.java @@ -142,9 +142,6 @@ public void startPush() { // 设置推流分辨率 mLivePushConfig.setVideoResolution(mVideoResolution); - // 设置美颜 - mLivePusher.setBeautyFilter(mBeautyStyle, mBeautyLevel, mWhiteningLevel, mRuddyLevel); - // 如果当前Activity可以自动旋转的话,那么需要进行设置 if (isActivityCanRotation(mContext)) { setRotationForActivity(); @@ -474,6 +471,8 @@ private void initialize(Context context, TXCloudVideoView pusherView) { mLivePushConfig = new TXLivePushConfig(); mLivePushConfig.setVideoEncodeGop(5); mLivePusher.setConfig(mLivePushConfig); + // 设置美颜 + mLivePusher.setBeautyFilter(mBeautyStyle, mBeautyLevel, mWhiteningLevel, mRuddyLevel); mWaterMarkBitmap = decodeResource(mContext.getResources(), R.drawable.livepusher_watermark); initListener(); } diff --git a/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/controller/TCControllerFullScreen.java b/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/controller/TCControllerFullScreen.java index f69f57bb..bd4f3b7b 100644 --- a/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/controller/TCControllerFullScreen.java +++ b/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/controller/TCControllerFullScreen.java @@ -185,6 +185,7 @@ public boolean onDown(MotionEvent e) { public void onBrightnessGesture(float newBrightness) { if (mGestureVolumeBrightnessProgressLayout != null) { mGestureVolumeBrightnessProgressLayout.setProgress((int) (newBrightness * 100)); + mVodMoreView.setBrightProgress((int) (newBrightness * 100)); mGestureVolumeBrightnessProgressLayout.setImageResource(R.drawable.superplayer_ic_light_max); mGestureVolumeBrightnessProgressLayout.show(); } diff --git a/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/view/TCVodMoreView.java b/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/view/TCVodMoreView.java index 3bdd84b2..0eafe039 100644 --- a/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/view/TCVodMoreView.java +++ b/Demo/superplayerkit/src/main/java/com/tencent/liteav/demo/play/view/TCVodMoreView.java @@ -1,7 +1,10 @@ package com.tencent.liteav.demo.play.view; import android.app.Activity; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.media.AudioManager; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -35,6 +38,10 @@ */ public class TCVodMoreView extends RelativeLayout implements RadioGroup.OnCheckedChangeListener, CompoundButton.OnCheckedChangeListener { + + private static final String VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION"; + private static final String EXTRA_VOLUME_STREAM_TYPE = "android.media.EXTRA_VOLUME_STREAM_TYPE"; + private Context mContext; private SeekBar mSeekBarVolume; // 音量seekBar @@ -51,6 +58,8 @@ public class TCVodMoreView extends RelativeLayout implements RadioGroup.OnChecke private LinearLayout mLayoutSpeed; // 倍速按钮所在布局 private LinearLayout mLayoutMirror; // 镜像按钮所在布局 + private VolumeBroadcastReceiver mVolumeBroadcastReceiver; + public TCVodMoreView(Context context) { super(context); init(context); @@ -114,15 +123,13 @@ private void updateCurrentLight() { Window window = activity.getWindow(); WindowManager.LayoutParams params = window.getAttributes(); - if (params.screenBrightness == WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE) { - params.screenBrightness = getActivityBrightness((Activity) mContext); - window.setAttributes(params); - if (params.screenBrightness == -1) { - mSeekBarLight.setProgress(100); - return; - } - mSeekBarLight.setProgress((int) (params.screenBrightness * 100)); + params.screenBrightness = getActivityBrightness((Activity) mContext); + window.setAttributes(params); + if (params.screenBrightness == -1) { + mSeekBarLight.setProgress(100); + return; } + mSeekBarLight.setProgress((int) (params.screenBrightness * 100)); } /** @@ -139,8 +146,10 @@ public static float getActivityBrightness(Activity activity) { private SeekBar.OnSeekBarChangeListener mVolumeChangeListener = new SeekBar.OnSeekBarChangeListener() { @Override - public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { - updateVolumeProgress(progress); + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (fromUser) { + updateVolumeProgress(progress); + } } @Override @@ -169,8 +178,10 @@ private void updateVolumeProgress(int progress) { private SeekBar.OnSeekBarChangeListener mLightChangeListener = new SeekBar.OnSeekBarChangeListener() { @Override - public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { - updateBrightProgress(progress); + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (fromUser) { + updateBrightProgress(progress); + } } @Override @@ -266,6 +277,27 @@ public void onCheckedChanged(RadioGroup radioGroup, int checkedId) { } } + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + } + + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + if (visibility == View.VISIBLE) { + updateCurrentVolume(); + updateCurrentLight(); + registerReceiver(); + }else { + unregisterReceiver(); + } + } + + public void setBrightProgress(int progress) { + updateBrightProgress(progress); + } + /** * 更新播放视频类型 * @@ -281,6 +313,39 @@ public void updatePlayType(int playType) { } } + private class VolumeBroadcastReceiver extends BroadcastReceiver { + + public void onReceive(Context context, Intent intent) { + //媒体音量改变才通知 + if (VOLUME_CHANGED_ACTION.equals(intent.getAction()) + && (intent.getIntExtra(EXTRA_VOLUME_STREAM_TYPE, -1) == AudioManager.STREAM_MUSIC)) { + updateCurrentVolume(); + } + } + } + + /** + * 注册音量广播接收器 + * @return + */ + public void registerReceiver() { + mVolumeBroadcastReceiver = new VolumeBroadcastReceiver(); + IntentFilter filter = new IntentFilter(); + filter.addAction(VOLUME_CHANGED_ACTION); + mContext.registerReceiver(mVolumeBroadcastReceiver, filter); + } + + /** + * 反注册音量广播监听器,需要与 registerReceiver 成对使用 + */ + public void unregisterReceiver() { + try { + mContext.unregisterReceiver(mVolumeBroadcastReceiver); + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * 回调 */ diff --git a/Demo/trtccallingdemo/src/main/java/com/tencent/liteav/trtccalling/model/impl/TRTCCallingImpl.java b/Demo/trtccallingdemo/src/main/java/com/tencent/liteav/trtccalling/model/impl/TRTCCallingImpl.java index b7bf75a5..11a3b946 100644 --- a/Demo/trtccallingdemo/src/main/java/com/tencent/liteav/trtccalling/model/impl/TRTCCallingImpl.java +++ b/Demo/trtccallingdemo/src/main/java/com/tencent/liteav/trtccalling/model/impl/TRTCCallingImpl.java @@ -238,8 +238,6 @@ private boolean isCallingData(String data) { } private void processInvite(String inviteID, String inviter, String groupID, List inviteeList, String data) { - // 收到来电,开始监听 trtc 的消息 - mTRTCCloud.setListener(mTRTCCloudListener); CallModel callModel = new CallModel(); callModel.callId = inviteID; callModel.groupId = groupID; @@ -575,8 +573,6 @@ public void groupCall(final List userIdList, int type, String groupId) { * @param groupId 群组通话的group id,如果是C2C需要传 "" */ private void internalCall(final List userIdList, int type, String groupId) { - // 主动拨打电话,开始监听trtc的消息 - mTRTCCloud.setListener(mTRTCCloudListener); final boolean isGroupCall = !TextUtils.isEmpty(groupId); if (!isOnCalling) { // 首次拨打电话,生成id,并进入trtc房间 @@ -689,6 +685,8 @@ private void enterTRTCRoom() { mTRTCCloud.enableAudioVolumeEvaluation(300); mTRTCCloud.setAudioRoute(TRTCCloudDef.TRTC_AUDIO_ROUTE_SPEAKER); mTRTCCloud.startLocalAudio(); + // 收到来电,开始监听 trtc 的消息 + mTRTCCloud.setListener(mTRTCCloudListener); mTRTCCloud.enterRoom(TRTCParams, mCurCallType == TRTCCalling.TYPE_VIDEO_CALL ? TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL : TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL); } diff --git a/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/model/impl/av/trtc/TXTRTCLiveRoom.java b/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/model/impl/av/trtc/TXTRTCLiveRoom.java index 1e19d1db..937fcc53 100644 --- a/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/model/impl/av/trtc/TXTRTCLiveRoom.java +++ b/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/model/impl/av/trtc/TXTRTCLiveRoom.java @@ -148,9 +148,10 @@ public void startPublish(String streamId, TXCallback callback) { } else if (mOriginRole == TRTCCloudDef.TRTCRoleAnchor) { // 大主播的时候切换分辨率 TRTCCloudDef.TRTCVideoEncParam param = new TRTCCloudDef.TRTCVideoEncParam(); - param.videoResolution = TRTCCloudDef.TRTC_VIDEO_RESOLUTION_960_540; - param.videoBitrate = 1200; + param.videoResolution = TRTCCloudDef.TRTC_VIDEO_RESOLUTION_1280_720; + param.videoBitrate = 1800; param.videoFps = 15; + param.enableAdjustRes = true; param.videoResolutionMode = TRTCCloudDef.TRTC_VIDEO_RESOLUTION_MODE_PORTRAIT; mTRTCCloud.setVideoEncoderParam(param); } diff --git a/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/ui/anchor/TCCameraAnchorActivity.java b/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/ui/anchor/TCCameraAnchorActivity.java index 736b8c27..1d3ab3ea 100644 --- a/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/ui/anchor/TCCameraAnchorActivity.java +++ b/Demo/trtcliveroomdemo/src/main/java/com/tencent/liteav/liveroom/ui/anchor/TCCameraAnchorActivity.java @@ -230,6 +230,7 @@ protected void onDestroy() { mVideoViewMgr.recycleVideoView(); mVideoViewMgr = null; if (mPanelAudioControl != null) { + mPanelAudioControl.reset(); mPanelAudioControl.unInit(); mPanelAudioControl = null; } diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/TRTCMeeting.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/TRTCMeeting.java index e68da577..bd478f19 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/TRTCMeeting.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/TRTCMeeting.java @@ -234,6 +234,12 @@ public static void destroySharedInstance() { */ public abstract void setLocalViewMirror(int type); + /** + * 设置网络qos参数 + * @param qosParam + */ + public abstract void setNetworkQosParam(TRTCCloudDef.TRTCNetworkQosParam qosParam); + ////////////////////////////////////////////////////////// // // 本地音频操作接口 diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/TRTCMeetingImpl.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/TRTCMeetingImpl.java index ba603362..599a7ec3 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/TRTCMeetingImpl.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/TRTCMeetingImpl.java @@ -580,6 +580,16 @@ public void run() { }); } + @Override + public void setNetworkQosParam(final TRTCCloudDef.TRTCNetworkQosParam qosParam) { + runOnMainThread(new Runnable() { + @Override + public void run() { + TXTRTCMeeting.getInstance().setNetworkQosParam(qosParam); + } + }); + } + @Override public void startMicrophone() { runOnMainThread(new Runnable() { diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/trtc/TXTRTCMeeting.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/trtc/TXTRTCMeeting.java index 67ce5617..ab5591a3 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/trtc/TXTRTCMeeting.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/model/impl/trtc/TXTRTCMeeting.java @@ -113,7 +113,7 @@ private void internalEnterRoom() { return; } mTRTCCloud.setListener(this); - mTRTCCloud.enterRoom(mTRTCParams, TRTCCloudDef.TRTC_APP_SCENE_LIVE); + mTRTCCloud.enterRoom(mTRTCParams, TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL); } @@ -122,6 +122,7 @@ private void setVideoEncoderParam() { param.videoResolution = mMeetingConfig.resolution; param.videoBitrate = mMeetingConfig.bitrate; param.videoFps = mMeetingConfig.fps; + param.enableAdjustRes = true; param.videoResolutionMode = TRTCCloudDef.TRTC_VIDEO_RESOLUTION_MODE_PORTRAIT; mTRTCCloud.setVideoEncoderParam(param); } @@ -557,6 +558,10 @@ public void setLocalViewMirror(int type) { mTRTCCloud.setLocalViewMirror(type); } + public void setNetworkQosParam(TRTCCloudDef.TRTCNetworkQosParam qosParam) { + mTRTCCloud.setNetworkQosParam(qosParam); + } + public void setAudioQuality(int quality) { mTRTCCloud.setAudioQuality(quality); } diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/CreateMeetingActivity.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/CreateMeetingActivity.java index ae4e8462..272b0b18 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/CreateMeetingActivity.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/CreateMeetingActivity.java @@ -32,7 +32,10 @@ * @author guanyifeng */ public class CreateMeetingActivity extends AppCompatActivity { - private TextView mTitleMain; + public static final int VIDEO_QUALITY_HD = 1; + public static final int VIDEO_QUALITY_FAST = 0; + + private TextView mTitleMain; private Toolbar mToolbar; private EditText mRoomIdEt; private EditText mUserNameEt; @@ -41,8 +44,11 @@ public class CreateMeetingActivity extends AppCompatActivity { private RadioButton mVoiceRb; private RadioButton mNormalRb; private RadioButton mMusicRb; + private RadioButton mVideoFastRb; + private RadioButton mVideoHDRb; private ArrayList mSettingItemList; + private int mVideoQuality; private int mAudioQuality; private boolean mOpenCamera; private boolean mOpenAudio; @@ -113,7 +119,14 @@ private void enterMeeting(final String roomId, final String userName) { } else { mAudioQuality = TRTCCloudDef.TRTC_AUDIO_QUALITY_SPEECH; } - MeetingMainActivity.enterRoom(this, tempRoomId, userId, userName, userAvatar, mOpenCamera, mOpenAudio, mAudioQuality); + + if (mVideoHDRb.isChecked()) { + mVideoQuality = VIDEO_QUALITY_HD; + } else { + mVideoQuality = VIDEO_QUALITY_FAST; + } + + MeetingMainActivity.enterRoom(this, tempRoomId, userId, userName, userAvatar, mOpenCamera, mOpenAudio, mAudioQuality, mVideoQuality); } private void initView() { @@ -153,10 +166,14 @@ public void onSwitchChecked(boolean isChecked) { mVoiceRb = (RadioButton) findViewById(R.id.rb_voice); mNormalRb = (RadioButton) findViewById(R.id.rb_normal); mMusicRb = (RadioButton) findViewById(R.id.rb_music); + mVideoFastRb = findViewById(R.id.rb_video_fast); + mVideoHDRb = findViewById(R.id.rb_video_hd); setStyle(mVoiceRb); setStyle(mNormalRb); setStyle(mMusicRb); + setStyle(mVideoFastRb); + setStyle(mVideoHDRb); } private void setStyle(RadioButton rb) { diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/MeetingMainActivity.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/MeetingMainActivity.java index c96c6faf..0fad4b8b 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/MeetingMainActivity.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/MeetingMainActivity.java @@ -31,8 +31,8 @@ import com.blankj.utilcode.util.PermissionUtils; import com.blankj.utilcode.util.ToastUtils; -import com.tencent.liteav.demo.beauty.view.BeautyPanel; import com.tencent.liteav.demo.beauty.BeautyParams; +import com.tencent.liteav.demo.beauty.view.BeautyPanel; import com.tencent.liteav.demo.trtc.R; import com.tencent.liteav.login.model.ProfileManager; import com.tencent.liteav.meeting.model.TRTCMeeting; @@ -44,6 +44,7 @@ import com.tencent.liteav.meeting.ui.widget.feature.FeatureSettingFragmentDialog; import com.tencent.liteav.meeting.ui.widget.page.MeetingPageLayoutManager; import com.tencent.liteav.meeting.ui.widget.page.PagerSnapHelper; +import com.tencent.trtc.TRTCCloud; import com.tencent.trtc.TRTCCloudDef; import java.util.ArrayList; @@ -63,6 +64,7 @@ public class MeetingMainActivity extends AppCompatActivity implements TRTCMeetin public static final String KEY_OPEN_CAMERA = "open_camera"; public static final String KEY_OPEN_AUDIO = "open_audio"; public static final String KEY_AUDIO_QUALITY = "audio_quality"; + public static final String KEY_VIDEO_QUALITY = "video_quality"; // public static final String TYPE_CREATE = "create"; // private static final String KEY_ENTER_TYPE = "start_type"; // private static final String TYPE_ENTER = "enter"; @@ -73,6 +75,7 @@ public class MeetingMainActivity extends AppCompatActivity implements TRTCMeetin private boolean mOpenCamera; private boolean mOpenAudio; private int mAudioQuality; + private int mVideoQuality; private String mUserName; private boolean isCreating = false; private boolean mIsUserEnterMuteAudio = false; //后续人员进入都进入静音模式 @@ -103,6 +106,7 @@ public class MeetingMainActivity extends AppCompatActivity implements TRTCMeetin private View mFloatingWindow; private List mVisibleVideoStreams; private String mShowUserId = ""; + private boolean isScreenCapture; private Handler mHandler = new Handler(); @@ -113,7 +117,8 @@ public static void enterRoom(Context context, String userAvatar, boolean openCamera, boolean openAudio, - int audioQuality) { + int audioQuality, + int videoQuality) { Intent starter = new Intent(context, MeetingMainActivity.class); starter.putExtra(KEY_ROOM_ID, roomId); starter.putExtra(KEY_USER_ID, userId); @@ -122,6 +127,7 @@ public static void enterRoom(Context context, starter.putExtra(KEY_OPEN_CAMERA, openCamera); starter.putExtra(KEY_OPEN_AUDIO, openAudio); starter.putExtra(KEY_AUDIO_QUALITY, audioQuality); + starter.putExtra(KEY_VIDEO_QUALITY, videoQuality); context.startActivity(starter); } @@ -194,6 +200,7 @@ public void onCallback(int code, String msg) { isCreating = true; ToastUtils.showLong("会议创建成功"); mMeetingHeadBarView.setTitle(String.valueOf(mRoomId)); + changeResolution(); return; } isCreating = false; @@ -206,6 +213,7 @@ public void onCallback(int code, String msg) { ToastUtils.showShort(msg); finish(); } + changeResolution(); mMeetingHeadBarView.setTitle(String.valueOf(mRoomId)); } }); @@ -258,10 +266,11 @@ private void initData() { mOpenCamera = starter.getBooleanExtra(KEY_OPEN_CAMERA, true); mOpenAudio = starter.getBooleanExtra(KEY_OPEN_AUDIO, true); mAudioQuality = starter.getIntExtra(KEY_AUDIO_QUALITY, TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT); + mVideoQuality = starter.getIntExtra(KEY_VIDEO_QUALITY, CreateMeetingActivity.VIDEO_QUALITY_FAST); //创建自己的 MemberEntity - MemberEntity entity = new MemberEntity(); - MeetingVideoView meetingVideoView = new MeetingVideoView(this); + MemberEntity entity = new MemberEntity(); + MeetingVideoView meetingVideoView = new MeetingVideoView(this); meetingVideoView.setSelfView(true); meetingVideoView.setMeetingUserId(mUserId); meetingVideoView.setListener(mMeetingViewClick); @@ -564,6 +573,7 @@ public void onUserEnterRoom(final String userId) { entity.setAudioAvailable(false); entity.setShowAudioEvaluation(FeatureConfig.getInstance().isAudioVolumeEvaluation()); addMemberEntity(entity); + changeResolution(); mMemberListAdapter.notifyItemInserted(insertIndex); if (mRemoteUserView != null) { mRemoteUserView.notifyDataSetChanged(); @@ -581,6 +591,44 @@ public void onCallback(int code, String msg, List list) }); } + private void changeResolution() { + if (isScreenCapture) { + return; + } + if (mVideoQuality == CreateMeetingActivity.VIDEO_QUALITY_HD) { + TRTCCloudDef.TRTCNetworkQosParam qosParam = new TRTCCloudDef.TRTCNetworkQosParam(); + qosParam.preference = TRTCCloudDef.TRTC_VIDEO_QOS_PREFERENCE_CLEAR; + mTRTCMeeting.setNetworkQosParam(qosParam); + if (mMemberEntityList.size() <= 2) { + mTRTCMeeting.setVideoResolution(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_960_540); + mTRTCMeeting.setVideoFps(15); + mTRTCMeeting.setVideoBitrate(1300); + } else if (mMemberEntityList.size() < 4) { + mTRTCMeeting.setVideoResolution(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_640_360); + mTRTCMeeting.setVideoFps(15); + mTRTCMeeting.setVideoBitrate(800); + } else { + mTRTCMeeting.setVideoResolution(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_480_270); + mTRTCMeeting.setVideoFps(15); + mTRTCMeeting.setVideoBitrate(400); + } + } else { + TRTCCloudDef.TRTCNetworkQosParam qosParam = new TRTCCloudDef.TRTCNetworkQosParam(); + qosParam.preference = TRTCCloudDef.TRTC_VIDEO_QOS_PREFERENCE_SMOOTH; + mTRTCMeeting.setNetworkQosParam(qosParam); + if (mMemberEntityList.size() < 5) { + // 包括自己,一共四个人,选择360p分辨率 + mTRTCMeeting.setVideoResolution(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_640_360); + mTRTCMeeting.setVideoFps(15); + mTRTCMeeting.setVideoBitrate(700); + } else { + mTRTCMeeting.setVideoResolution(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_480_270); + mTRTCMeeting.setVideoFps(15); + mTRTCMeeting.setVideoBitrate(350); + } + } + } + @Override public void onUserLeaveRoom(String userId) { if (mShowUserId.equals(userId)) { @@ -589,6 +637,7 @@ public void onUserLeaveRoom(String userId) { mContainerFl.setVisibility(View.GONE); } int index = removeMemberEntity(userId); + changeResolution(); if (index >= 0) { mMemberListAdapter.notifyItemRemoved(index); } @@ -636,7 +685,7 @@ public void onRecvRoomCustomMsg(String cmd, String message, TRTCMeetingDef.UserI @Override public void onScreenCaptureStarted() { - + isScreenCapture = true; } @Override @@ -651,7 +700,8 @@ public void onScreenCaptureResumed() { @Override public void onScreenCaptureStopped(int reason) { - + isScreenCapture = false; + changeResolution(); } @Override @@ -736,7 +786,7 @@ public void onClick(View v) { encParams.videoResolutionMode = TRTCCloudDef.TRTC_VIDEO_RESOLUTION_MODE_PORTRAIT; encParams.videoFps = 10; encParams.enableAdjustRes = false; - encParams.videoBitrate = 1200; + encParams.videoBitrate = 1500; TRTCCloudDef.TRTCScreenShareParams params = new TRTCCloudDef.TRTCScreenShareParams(); mTRTCMeeting.stopCameraPreview(); diff --git a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/widget/feature/VideoSettingFragment.java b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/widget/feature/VideoSettingFragment.java index 5d1e90da..2a224e04 100644 --- a/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/widget/feature/VideoSettingFragment.java +++ b/Demo/trtcmeetingdemo/src/main/java/com/tencent/liteav/meeting/ui/widget/feature/VideoSettingFragment.java @@ -50,15 +50,11 @@ public void onCreate(@Nullable Bundle savedInstanceState) { private void initData() { boolean isVideoCall = mAppScene == TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL; paramArray = new ArrayList<>(); - paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_160_160, isVideoCall ? 250 : 300, 40, 300, 10)); paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_320_180, isVideoCall ? 350 : 350, 80, 350, 10)); - paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_320_240, isVideoCall ? 400 : 400, 100, 400, 10)); - paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_480_480, isVideoCall ? 500 : 750, 200, 1000, 10)); + paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_480_270, isVideoCall ? 500 : 750, 200, 1000, 10)); paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_640_360, isVideoCall ? 600 : 900, 200, 1000, 10)); - paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_640_480, isVideoCall ? 700 : 1000, 250, 1000, 50)); paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_960_540, isVideoCall ? 900 : 1350, 400, 1600, 50)); paramArray.add(new TRTCSettingBitrateTable(TRTCCloudDef.TRTC_VIDEO_RESOLUTION_1280_720, isVideoCall ? 1250 : 1850, 500, 2000, 50)); - paramArray.add(new TRTCSettingBitrateTable(114, isVideoCall ? 1900 : 1900, 800, 3000, 50)); } @Override diff --git a/Demo/trtcmeetingdemo/src/main/res/layout/activity_create_meeting.xml b/Demo/trtcmeetingdemo/src/main/res/layout/activity_create_meeting.xml index b83b7f3f..819611b5 100644 --- a/Demo/trtcmeetingdemo/src/main/res/layout/activity_create_meeting.xml +++ b/Demo/trtcmeetingdemo/src/main/res/layout/activity_create_meeting.xml @@ -149,6 +149,38 @@ android:text="@string/meeting_rb_music" /> + + + + + + + + + + - 160 * 160 180 * 320 - 240 * 320 - 480 * 480 + 270 * 480 360 * 640 - 480 * 640 540 * 960 720 * 1280 - 1080 * 1920 diff --git a/Demo/trtcmeetingdemo/src/main/res/values/strings.xml b/Demo/trtcmeetingdemo/src/main/res/values/strings.xml index 3b21996b..42891683 100644 --- a/Demo/trtcmeetingdemo/src/main/res/values/strings.xml +++ b/Demo/trtcmeetingdemo/src/main/res/values/strings.xml @@ -6,4 +6,7 @@ 标准 音乐 音质选择 + 流畅 + 清晰 + 画质选择 diff --git a/Demo/trtcvoiceroomdemo/src/main/java/com/tencent/liteav/trtcvoiceroom/model/impl/room/impl/TXRoomService.java b/Demo/trtcvoiceroomdemo/src/main/java/com/tencent/liteav/trtcvoiceroom/model/impl/room/impl/TXRoomService.java index 5027d64c..38f2a769 100644 --- a/Demo/trtcvoiceroomdemo/src/main/java/com/tencent/liteav/trtcvoiceroom/model/impl/room/impl/TXRoomService.java +++ b/Demo/trtcvoiceroomdemo/src/main/java/com/tencent/liteav/trtcvoiceroom/model/impl/room/impl/TXRoomService.java @@ -1039,7 +1039,7 @@ public void onRecvGroupCustomMessage(String msgID, String groupID, V2TIMGroupMem if (!groupID.equals(mRoomId)) { return; } - String customStr = ""; + String customStr = new String(customData); if (!TextUtils.isEmpty(customStr)) { // 一定会有自定义消息的头 try { diff --git a/Demo/ugckit/src/main/assets/green_1.mp4 b/Demo/ugckit/src/main/assets/green_1.mp4 deleted file mode 100644 index a59ced0a..00000000 Binary files a/Demo/ugckit/src/main/assets/green_1.mp4 and /dev/null differ diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/UGCKitPicturePicker.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/UGCKitPicturePicker.java index d8cf324f..a61d9d79 100755 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/UGCKitPicturePicker.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/UGCKitPicturePicker.java @@ -29,6 +29,7 @@ * 1、加载本地了本地相册所有图片
*/ public class UGCKitPicturePicker extends AbsPickerUI implements ActivityCompat.OnRequestPermissionsResultCallback { + private static final int MIN_SELECTED_PIC_COUNT = 3; private Activity mActivity; @NonNull private Handler mHandlder = new Handler(); @@ -62,6 +63,7 @@ public void onAdd(TCVideoFileInfo fileInfo) { }); // 加载图片 loadPictureList(); + getPickedLayout().setMinSelectedItemCount(MIN_SELECTED_PIC_COUNT); } /** diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/dialogfragment/VideoWorkProgressFragment.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/dialogfragment/VideoWorkProgressFragment.java index e0fe9957..d1a64817 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/dialogfragment/VideoWorkProgressFragment.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/dialogfragment/VideoWorkProgressFragment.java @@ -132,7 +132,9 @@ public void dismiss() { if (getFragmentManager() != null && isAdded()) { getFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); } - mProgressLoading.setProgress(0); + if (mProgressLoading != null) { + mProgressLoading.setProgress(0); + } } public void setCanCancel(boolean canCancel) { diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/timeline/ColorfulProgress.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/timeline/ColorfulProgress.java index 7ddcaaba..0679c0a2 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/timeline/ColorfulProgress.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/component/timeline/ColorfulProgress.java @@ -7,6 +7,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; +import android.util.Log; import android.view.View; @@ -102,6 +103,19 @@ public void endMark() { info.right = mCurPositioin; } + public void startMark(int color, float position) { + MarkInfo info = new MarkInfo(); + info.startTimeMs = mVideoProgressController.getCurrentTimeMs(); + info.left = position; + info.color = color; + mMarkInfoList.add(info); + } + + public void endMark(float position) { + MarkInfo info = mMarkInfoList.get(mMarkInfoList.size() - 1); + info.right = position; + } + @Nullable public MarkInfo deleteLastMark() { MarkInfo info = null; diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/cut/VideoCutLayout.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/cut/VideoCutLayout.java index 8222e7d0..d32f73cf 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/cut/VideoCutLayout.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/cut/VideoCutLayout.java @@ -88,8 +88,8 @@ public void onCutChangeKeyUp(long startTime, long endTime, int type) { String str = getResources().getString(R.string.ugckit_video_cutter_activity_load_video_success_already_picked) + duration + "s"; mTextDuration.setText(str); - PlayerManagerKit.getInstance().startPlay(); VideoEditerSDK.getInstance().setCutterStartTime(startTime, endTime); + PlayerManagerKit.getInstance().startPlay(); TXLog.d(TAG, "startTime:" + startTime + ",endTime:" + endTime + ",duration:" + duration); } diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/bgm/TCMusicSettingFragment.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/bgm/TCMusicSettingFragment.java index 3bae38db..a3016367 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/bgm/TCMusicSettingFragment.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/bgm/TCMusicSettingFragment.java @@ -1,5 +1,7 @@ package com.tencent.qcloud.ugckit.module.effect.bgm; +import android.app.AlertDialog; +import android.content.DialogInterface; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; @@ -13,6 +15,7 @@ import com.tencent.qcloud.ugckit.module.effect.VideoEditerSDK; +import com.tencent.qcloud.ugckit.module.effect.utils.EffectEditer; import com.tencent.qcloud.ugckit.utils.DialogUtil; import com.tencent.qcloud.ugckit.UGCKitConstants; import com.tencent.qcloud.ugckit.R; @@ -151,12 +154,33 @@ public void onMusicReplace() { @Override public void onMusicDelete() { - mEditerDraft.setBgmPath(null); - - TXVideoEditer editer = VideoEditerSDK.getInstance().getEditer(); - editer.setBGM(null); + showDeleteMusicDialog(); } }); } + private void showDeleteMusicDialog() { + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + AlertDialog alertDialog = builder.setTitle(getResources().getString(R.string.ugckit_tips)).setCancelable(false).setMessage(R.string.ugckit_delete_bgm_or_not) + .setPositiveButton(R.string.ugckit_confirm_delete, new DialogInterface.OnClickListener() { + @Override + public void onClick(@NonNull DialogInterface dialog, int which) { + DraftEditer.getInstance().setBgmPath(null); + EffectEditer.getInstance().setBgmPath(null); + VideoEditerSDK.getInstance().getEditer().setBGM(null); + + getActivity().onBackPressed(); + dialog.dismiss(); + } + }) + .setNegativeButton(getResources().getString(R.string.ugckit_btn_cancel), new DialogInterface.OnClickListener() { + @Override + public void onClick(@NonNull DialogInterface dialog, int which) { + dialog.dismiss(); + } + }).create(); + alertDialog.show(); + } + + } diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/motion/TCMotionFragment.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/motion/TCMotionFragment.java index a219a977..a0d0fb13 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/motion/TCMotionFragment.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/effect/motion/TCMotionFragment.java @@ -33,16 +33,17 @@ /** * 动态滤镜特效的设置Fragment */ -public class TCMotionFragment extends AbsMotionFragment implements View.OnClickListener, View.OnTouchListener { +public class TCMotionFragment extends AbsMotionFragment implements View.OnClickListener, View.OnTouchListener, PlayerManagerKit.OnPreviewListener { private static final String TAG = "TCMotionFragment"; - private boolean mIsOnTouch; // 是否已经有按下的 + private boolean mIsOnTouch; // 是否已经有按下的 private TXVideoEditer mTXVideoEditer; private ColorfulProgress mColorfulProgress; private ImageView mImageUndo; private VideoProgressController mVideoProgressController; private boolean mStartMark; private Map mMotionMap; + private int mEffectType = -1; // 当前的动作特效类型 @Nullable @Override @@ -91,6 +92,8 @@ private void initViews(@NonNull View view) { mColorfulProgress.setWidthHeight(mVideoProgressController.getThumbnailPicListDisplayWidth(), getResources().getDimensionPixelOffset(R.dimen.ugckit_video_progress_height)); mColorfulProgress.setMarkInfoList(TCMotionViewInfoManager.getInstance().getMarkInfoList()); mVideoProgressController.addColorfulProgress(mColorfulProgress); + + PlayerManagerKit.getInstance().addOnPreviewLitener(this); } private void setDefaultValue(Context context, View view) { @@ -175,15 +178,16 @@ public boolean onTouch(@NonNull View view, @NonNull MotionEvent motionEvent) { TCMotionItem item = mMotionMap.get(view.getId()); if (item != null) { + mEffectType = item.effectID; RelativeLayout rlSelect = (RelativeLayout) getActivity().findViewById(item.rlSelectID); if (action == MotionEvent.ACTION_DOWN) { rlSelect.setVisibility(View.VISIBLE); - pressMotion(item.effectID); + pressMotion(mEffectType); mIsOnTouch = true; } if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { rlSelect.setVisibility(View.INVISIBLE); - upMotion(item.effectID); + upMotion(mEffectType); mIsOnTouch = false; } return false; @@ -262,4 +266,55 @@ private void upMotion(int type) { mImageUndo.setVisibility(View.VISIBLE); } } + + @Override + public void onPreviewProgress(int time) { + + } + + @Override + public void onPreviewFinish() { + if(mIsOnTouch && mEffectType >= 0){ + mColorfulProgress.endMark(mVideoProgressController.getThumbnailPicListDisplayWidth()); + mTXVideoEditer.stopEffect(mEffectType, mVideoProgressController.getTotalDurationMs()); + + mTXVideoEditer.startEffect(mEffectType, 0); + switch (mEffectType) { + case TXVideoEditConstants.TXEffectType_SOUL_OUT: + // 进度条开始变颜色 + mColorfulProgress.startMark(soulOutColor, 0); + break; + case TXVideoEditConstants.TXEffectType_SPLIT_SCREEN: + mColorfulProgress.startMark(splitScreenColor, 0); + break; + case TXVideoEditConstants.TXEffectType_ROCK_LIGHT: + mColorfulProgress.startMark(rockLightColor, 0); + break; + case TXVideoEditConstants.TXEffectType_DARK_DRAEM: + mColorfulProgress.startMark(darkDreamColor, 0); + break; + case TXVideoEditConstants.TXEffectType_WIN_SHADDOW: + mColorfulProgress.startMark(winShadowColor, 0); + break; + case TXVideoEditConstants.TXEffectType_GHOST_SHADDOW: + mColorfulProgress.startMark(ghostShadowColor, 0); + break; + case TXVideoEditConstants.TXEffectType_PHANTOM_SHADDOW: + mColorfulProgress.startMark(phantomShadowColor, 0); + break; + case TXVideoEditConstants.TXEffectType_GHOST: + mColorfulProgress.startMark(ghostColor, 0); + break; + case TXVideoEditConstants.TXEffectType_LIGHTNING: + mColorfulProgress.startMark(lightningColor, 0); + break; + case TXVideoEditConstants.TXEffectType_MIRROR: + mColorfulProgress.startMark(mirrorColor, 0); + break; + case TXVideoEditConstants.TXEffectType_ILLUSION: + mColorfulProgress.startMark(illusionColor, 0); + break; + } + } + } } diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/IPickedLayout.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/IPickedLayout.java index 73969ab6..3ad24199 100755 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/IPickedLayout.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/IPickedLayout.java @@ -84,4 +84,11 @@ public interface IPickedLayout { * @param bitmapHeight */ void setBitmapHeight(int bitmapHeight); + + /** + * 设置最少选中的item数量 (少于此数量,下一步按钮将置灰) + * + * @param minSelectedItemCount + */ + void setMinSelectedItemCount(int minSelectedItemCount); } diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/PickedLayout.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/PickedLayout.java index 90b540e4..48a5eaec 100755 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/PickedLayout.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/picker/view/PickedLayout.java @@ -39,6 +39,7 @@ public class PickedLayout extends RelativeLayout implements ItemView.OnDeleteLis private ArrayList mTCVideoFileInfoList; private OnNextStepListener mOnNextStepListener; private String mDragText; + private int mMinSelectedItemCount = 1; public PickedLayout(Context context) { super(context); @@ -83,7 +84,7 @@ public void addItem(TCVideoFileInfo fileInfo) { if (!mMenuAdapter.contains(fileInfo)) { mMenuAdapter.addItem(fileInfo); } - if (mMenuAdapter.getItemCount() > 0) { + if (mMenuAdapter.getItemCount() >= mMinSelectedItemCount) { mButtonNext.setEnabled(true); } } @@ -94,7 +95,7 @@ public void onDelete(int position) { return; } mMenuAdapter.removeIndex(position); - if (mMenuAdapter.getItemCount() == 0) { + if (mMenuAdapter.getItemCount() < mMinSelectedItemCount) { mButtonNext.setEnabled(false); } } @@ -185,6 +186,11 @@ public void setBitmapHeight(int bitmapHeight) { mMenuAdapter.setBitmapHeight(bitmapHeight); } + @Override + public void setMinSelectedItemCount(int minSelectedItemCount) { + mMinSelectedItemCount = minSelectedItemCount; + } + @Override public void setOnNextStepListener(OnNextStepListener listener) { diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/record/RecordButton.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/record/RecordButton.java index 7dcca025..684c66e4 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/record/RecordButton.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/record/RecordButton.java @@ -5,6 +5,7 @@ import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; +import android.graphics.drawable.GradientDrawable; import android.support.annotation.NonNull; import android.util.AttributeSet; import android.view.MotionEvent; @@ -17,6 +18,7 @@ import com.tencent.qcloud.ugckit.R; import com.tencent.qcloud.ugckit.module.record.interfaces.IRecordButton; +import com.tencent.qcloud.ugckit.utils.UIAttributeUtil; /** * 多种拍摄模式的按钮 @@ -78,6 +80,26 @@ private void initViews() { mViewPressModeOutter.setVisibility(GONE); mViewPressModeInner.setVisibility(GONE); + + //兼容android5.0以下不能从drawable文件中读取主题颜色 + int photoModeOuterColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonPhotoModeOutterBackground, R.color.ugckit_record_button_take_photo_background_color); + mViewPhotoModeOutter.setBackground(createCircleGradientDrawable(photoModeOuterColor)); + int photoModeInnerColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonPhotoModeInnerBackground, R.color.color_text_white); + mViewPhotoModeInner.setBackground(createCircleGradientDrawable(photoModeInnerColor)); + int tapModeOuterColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonTapModeOutterBackground, R.color.ugckit_record_button_click_shot_background_color); + mViewTapModeOutter.setBackground(createCircleGradientDrawable(tapModeOuterColor)); + int tapModeInnerColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonTapModeInnerBackground, R.color.ugckit_record_button_click_shotInner_color); + mViewTapModeInner.setBackground(createCircleGradientDrawable(tapModeInnerColor)); + int pressModeOuterColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonPressModeOutterBackground, R.color.ugckit_record_button_touch_shot_background_color); + mViewPressModeOutter.setBackground(createCircleGradientDrawable(pressModeOuterColor)); + int pressModeInnerColor = UIAttributeUtil.getColorRes(getContext(), + R.attr.recordButtonPressModeInnerBackground, R.color.ugckit_record_button_touch_shot_inner_color); + mViewPressModeInner.setBackground(createCircleGradientDrawable(pressModeInnerColor)); } @Override @@ -408,6 +430,14 @@ public void onAnimationRepeat(Animator animation) { mImageRecordPause.setVisibility(View.GONE); } + private GradientDrawable createCircleGradientDrawable(int color) { + GradientDrawable normalDrawable = new GradientDrawable(); + normalDrawable.setShape(GradientDrawable.OVAL); + normalDrawable.setColor(color); + normalDrawable.setUseLevel(false); + return normalDrawable; + } + @Override public void setOnRecordButtonListener(OnRecordButtonListener listener) { mOnRecordButtonListener = listener; diff --git a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/upload/impl/TVCConstants.java b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/upload/impl/TVCConstants.java index c1479e8e..3ef63010 100644 --- a/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/upload/impl/TVCConstants.java +++ b/Demo/ugckit/src/main/java/com/tencent/qcloud/ugckit/module/upload/impl/TVCConstants.java @@ -4,7 +4,7 @@ * 视频上传常量定义 */ public class TVCConstants { - public static final String TVCVERSION = "7.8.9518"; + public static final String TVCVERSION = "7.9.9568"; public static String VOD_SERVER_HOST = "vod2.qcloud.com"; public static String VOD_SERVER_HOST_BAK = "vod2.dnsv1.com"; diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_inner.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_inner.xml deleted file mode 100755 index 7ec468cb..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_inner.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_outter.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_outter.xml deleted file mode 100755 index e5eb7be8..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_photo_outter.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_inner.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_inner.xml deleted file mode 100755 index b79c7604..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_inner.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_outter.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_outter.xml deleted file mode 100755 index 6de0749c..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_press_outter.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_inner.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_inner.xml deleted file mode 100755 index 54900e7a..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_inner.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_outter.xml b/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_outter.xml deleted file mode 100755 index 9e0dbb8b..00000000 --- a/Demo/ugckit/src/main/res/drawable-xxhdpi/ugckit_record_btn_tap_outter.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Demo/ugckit/src/main/res/layout/ugckit_record_button.xml b/Demo/ugckit/src/main/res/layout/ugckit_record_button.xml index 6cfd9a55..8ca4d504 100644 --- a/Demo/ugckit/src/main/res/layout/ugckit_record_button.xml +++ b/Demo/ugckit/src/main/res/layout/ugckit_record_button.xml @@ -10,7 +10,6 @@ android:layout_width="65dp" android:layout_height="65dp" android:layout_centerInParent="true" - android:background="@drawable/ugckit_record_btn_photo_outter" android:visibility="gone" /> + android:layout_centerInParent="true"/> + android:layout_centerInParent="true" /> diff --git a/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/model/impl/TVCConstants.java b/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/model/impl/TVCConstants.java index f6daff1a..07155fdc 100644 --- a/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/model/impl/TVCConstants.java +++ b/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/model/impl/TVCConstants.java @@ -4,7 +4,7 @@ * 视频上传常量定义 */ public class TVCConstants { - public static final String TVCVERSION = "7.8.9518"; + public static final String TVCVERSION = "7.9.9568"; public static String VOD_SERVER_HOST = "vod2.qcloud.com"; public static String VOD_SERVER_HOST_BAK = "vod2.dnsv1.com"; diff --git a/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/ui/TCCompressActivity.java b/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/ui/TCCompressActivity.java index ff55f361..be677c85 100644 --- a/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/ui/TCCompressActivity.java +++ b/Demo/ugcvideouploaddemo/src/main/java/com/tencent/liteav/demo/videouploader/ui/TCCompressActivity.java @@ -103,6 +103,16 @@ public void onClick(View v) { return; } mTXVideoInfo = TXVideoInfoReader.getInstance(this).getVideoFileInfo(mInputSource); + + // 部分机型上会产生00:00时长的视频文件,导致此处VideoInfo为空 + if (mTXVideoInfo == null) { + showDialog(R.string.ugcupload_error_handle_video, R.string.ugcupload_error_invalid_format, new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + } initListener(); }