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

feat:update meetingkit android version 3.17.0 #220

Merged
merged 7 commits into from
Nov 3, 2023
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
28 changes: 28 additions & 0 deletions SampleCode/Android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# NEMeetingKit ChangeLog
## v3.17.0 (Oct 31, 2023)

### New Features

- 新增屏幕共享服务接口 `NEScreenSharingService`
- 开启屏幕共享 `startScreenShare`
- 停止屏幕共享 `stopScreenShare`
- 添加监听 `addScreenSharingStatusListener`
- 移除监听 `removeScreenSharingStatusListener`
- 屏幕状态变更回调 `onScreenSharingStatusChanged`
- 新增屏幕共享状态变更模型 `NEScreenSharingEvent`
- 当前共享状态 `NEScreenSharingStatus`
- 额外附带参数 `arg`
- 额外附带数据对象 `obj`
- 新增屏幕共享时配置信息类 `NEScreenSharingOptions`
- 开启/关闭音频功能 `enableAudioShare`
- 新增屏幕共享时基本参数类 `NEScreenSharingParams`
- 用户昵称 `displayName`
- 共享码 `sharingCode`
- `NEMeetingKit` 新增获取共享屏幕服务接口 `getScreenSharingService`

### Compatibility

* 兼容 `NERoom` 1.21.0 版本
* 兼容 `NIM` 9.12.0 版本
* 兼容 `NERtcSDK_Special` 5.5.203 版本

## v3.16.1(SEP 8, 2023)

- 适配Android 版本低于8.0无法使用画中画功能,默认以最小化

## v3.16.0(SEP 6, 2023)
Expand Down
4 changes: 2 additions & 2 deletions SampleCode/Android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
* Kotlin
```
dependencies {
val meetingkit_version = "3.16.0"
val meetingkit_version = "3.17.0"
implementation("com.netease.yunxin.kit.meeting:meeting:$meetingkit_version")
}
```

* Groovy
```
dependencies {
def meetingkit_version = "3.16.0"
def meetingkit_version = "3.17.0"
implementation "com.netease.yunxin.kit.meeting:meeting:$meetingkit_version"
}
```
6 changes: 3 additions & 3 deletions SampleCode/Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.netease.yunxin.kit.meeting.sampleapp"
minSdkVersion 21
targetSdkVersion 31
versionCode 31600
versionName "3.16.0"
versionCode 31700
versionName "3.17.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -43,7 +43,7 @@ repositories {
}
dependencies {
// meeting
implementation 'com.netease.yunxin.kit.meeting:meeting:3.16.1'
implementation 'com.netease.yunxin.kit.meeting:meeting:3.17.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package com.netease.yunxin.kit.meeting.sampleapp.data;

import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.netease.yunxin.kit.meeting.sdk.NECallback;
Expand All @@ -19,6 +20,9 @@
import com.netease.yunxin.kit.meeting.sdk.NEMeetingStatus;
import com.netease.yunxin.kit.meeting.sdk.NEMeetingStatusListener;
import com.netease.yunxin.kit.meeting.sdk.NEScheduleMeetingStatusListener;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingOptions;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingParams;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingStatusListener;
import com.netease.yunxin.kit.meeting.sdk.NEStartMeetingOptions;
import com.netease.yunxin.kit.meeting.sdk.NEStartMeetingParams;
import java.util.List;
Expand Down Expand Up @@ -176,6 +180,25 @@ public void setBeautyFaceValue(int beautyFaceValue) {
// NEMeetingKit.getInstance().getSettingsService().setBeautyFaceValue(beautyFaceValue);
}

public void startScreenSharing(
Context context,
Intent data,
@NonNull NEScreenSharingParams param,
@Nullable NEScreenSharingOptions opts,
NECallback<Void> callback) {
NEMeetingKit.getInstance()
.getScreenSharingService()
.startScreenShare(context, data, param, opts, callback);
}

public void stopScreenShare(Context context, NECallback<Void> callback) {
NEMeetingKit.getInstance().getScreenSharingService().stopScreenShare(callback);
}

public void addScreenSharingStatusListener(NEScreenSharingStatusListener listener) {
NEMeetingKit.getInstance().getScreenSharingService().addScreenSharingStatusListener(listener);
}

/////////////////////////////////////////////////
/** * SettingsService end * */
/////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ private void initListener() {
v ->
Navigation.findNavController(getView())
.navigate(R.id.action_homeFragment_to_scheduleMeetingFragment));
binding.btnScreenSharing.setOnClickListener(
v ->
Navigation.findNavController(getView())
.navigate(R.id.action_homeFragment_to_screenSharingFragment));
binding.btnSetting.setOnClickListener(
v ->
Navigation.findNavController(getView())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
// Use of this source code is governed by a MIT license that can be
// found in the LICENSE file.

package com.netease.yunxin.kit.meeting.sampleapp.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.projection.MediaProjectionManager;
import android.text.Editable;
import android.widget.Toast;
import androidx.lifecycle.ViewModelProviders;
import com.netease.yunxin.kit.meeting.sampleapp.base.BaseFragment;
import com.netease.yunxin.kit.meeting.sampleapp.databinding.FragmentScreenShareBinding;
import com.netease.yunxin.kit.meeting.sampleapp.log.LogUtil;
import com.netease.yunxin.kit.meeting.sampleapp.viewmodel.ScreenSharingViewModel;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingOptions;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingParams;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingStatus;
import java.util.Objects;

public class ScreenSharingFragment extends BaseFragment<FragmentScreenShareBinding> {

private static final String TAG = ScreenSharingFragment.class.getSimpleName();
private ScreenSharingViewModel mViewModel;
private int screenShareRequestCode = 1002;

@Override
protected FragmentScreenShareBinding getViewBinding() {
return FragmentScreenShareBinding.inflate(getLayoutInflater());
}

@Override
protected void initView() {
mViewModel = ViewModelProviders.of(this).get(ScreenSharingViewModel.class);
mViewModel.addScreenSharingStatusListener();
binding.btnScreenSharing.setOnClickListener(
view -> {
if (Objects.equals(
NEScreenSharingStatus.SCREEN_SHARING_STATUS_IDLE,
mViewModel.screenStatus.getValue())) {

MediaProjectionManager mediaProjectionManager =
(MediaProjectionManager)
getActivity().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
Intent captureIntent = mediaProjectionManager.createScreenCaptureIntent();
startActivityForResult(captureIntent, screenShareRequestCode);
} else if (Objects.equals(
NEScreenSharingStatus.SCREEN_SHARING_STATUS_STARTED,
mViewModel.screenStatus.getValue())
|| Objects.equals(
NEScreenSharingStatus.SCREEN_SHARING_STATUS_WAITING,
mViewModel.screenStatus.getValue())) {
mViewModel.stopScreenShare(
(resultCode, resultMsg, resultData) -> {
LogUtil.log(TAG, "stopScreenShare resultCode" + resultCode);
});
}
});
mViewModel.observeScreenStatus(
this,
status -> {
// boolean isScreenSharingStarted = Objects.equals(NEScreenSharingStatus.SCREEN_SHARING_STATUS_STARTED, );
binding.btnScreenSharing.setText(mViewModel.screenStatus.getValue().name());
});
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
LogUtil.log(TAG, "onActivityResult resultCode" + resultCode + "requestCode" + requestCode);
if (requestCode == screenShareRequestCode && resultCode == Activity.RESULT_OK && data != null) {

NEScreenSharingParams params = new NEScreenSharingParams();
Editable editableName = binding.edtScreenSharingName.getText();
Editable editableCode = binding.edtScreenSharingCode.getText();
if (editableName != null && editableCode != null) {
params.displayName = editableName.toString();
params.sharingCode = editableCode.toString();
}
NEScreenSharingOptions options = new NEScreenSharingOptions();
options.enableAudioShare = binding.checkboxScreenShareAudio.isChecked();
mViewModel.startScreenSharing(
data,
params,
options,
(code, msg, resultData) -> {
if (msg != null) {
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
}
});
}
}

@Override
protected void initData() {}

@Override
public void onDestroyView() {
super.onDestroyView();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
// Use of this source code is governed by a MIT license that can be
// found in the LICENSE file.

package com.netease.yunxin.kit.meeting.sampleapp.viewmodel;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.netease.yunxin.kit.meeting.sampleapp.data.MeetingDataRepository;
import com.netease.yunxin.kit.meeting.sdk.NECallback;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingOptions;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingParams;
import com.netease.yunxin.kit.meeting.sdk.NEScreenSharingStatus;

public class ScreenSharingViewModel extends AndroidViewModel {
private Context context;

public ScreenSharingViewModel(Application application) {
super(application);
this.context = application.getApplicationContext();
}

public MutableLiveData<NEScreenSharingStatus> screenStatus =
new MutableLiveData<>(NEScreenSharingStatus.SCREEN_SHARING_STATUS_IDLE);

private MeetingDataRepository mRepository = MeetingDataRepository.getInstance();

public void startScreenSharing(
Intent data,
@NonNull NEScreenSharingParams param,
@Nullable NEScreenSharingOptions opts,
NECallback<Void> callback) {
mRepository.startScreenSharing(context, data, param, opts, callback);
}

public void stopScreenShare(NECallback<Void> callback) {
mRepository.stopScreenShare(context, callback);
}

public void observeScreenStatus(LifecycleOwner owner, Observer<NEScreenSharingStatus> observer) {
screenStatus.observe(owner, observer);
}

public void addScreenSharingStatusListener() {
mRepository.addScreenSharingStatusListener(
event -> {
screenStatus.setValue(event.status);
Toast.makeText(context, "屏幕共享状态变更: " + event.status.name(), Toast.LENGTH_SHORT).show();
});
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion SampleCode/Android/app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,25 @@
app:itb_text_size="14sp"
app:layout_constraintBottom_toBottomOf="@id/btn_start_meeting"
app:layout_constraintLeft_toRightOf="@+id/btn_join_meeting"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btn_screen_sharing"
app:layout_constraintTop_toTopOf="@+id/btn_start_meeting" />

<com.netease.yunxin.kit.meeting.sampleapp.widget.ImageTextButton
android:id="@+id/btn_screen_sharing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:itb_bg="@color/white"
app:itb_icon="@drawable/share_screen"
app:itb_icon_position="bottom"
app:itb_icon_size="74dp"
app:itb_radius="3dp"
app:itb_text="屏幕共享"
app:itb_text_color="@color/black"
app:itb_text_size="14sp"
app:layout_constraintBottom_toBottomOf="@id/btn_start_meeting"
app:layout_constraintLeft_toRightOf="@+id/btn_schedule_meeting"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_start_meeting" />

<com.netease.yunxin.kit.meeting.sampleapp.widget.ImageTextButton
android:id="@+id/btn_start_meeting"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 NetEase, Inc. All rights reserved. -->
<!-- Use of this source code is governed by a MIT license that can be -->
<!-- found in the LICENSE file. -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/screenSharingFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.netease.meeting.demo.com.netease.meeting.sampleapp.view.ScheduleMeetingFragment">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF2F3F5"
tools:context=".MainActivity">
<EditText
android:id="@+id/edt_screen_sharing_code"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="22dp"
android:gravity="left|center"
android:hint="请输入投屏码"
android:textSize="14sp"
android:singleLine="true"
android:textColor="#FF999999"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/edt_screen_sharing_name"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="22dp"
android:gravity="left|center"
android:hint="请输入投屏昵称"
android:textSize="14sp"
android:singleLine="true"
android:textColor="#FF999999"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/edt_screen_sharing_code" />
<CheckBox
android:id="@+id/checkbox_screen_share_audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/edt_screen_sharing_name"
android:text="音频共享" />
<Button
android:id="@+id/btn_screen_sharing"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="18dp"
android:background="@drawable/button_circle_shape"
android:text="投屏共享"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
Loading
Loading