Skip to content

Commit

Permalink
Fix errors and update build.gradle for JitPack
Browse files Browse the repository at this point in the history
The following changes are updated:
- Use JitPack for Connect-SDK to apply the latest update in master
- Fix build error with the latest Connect-SDK
- Broke links for media sharing with contents in connectsdk.com
- Show each services as separated items in the device picker (the
default setting in the lastest Connect-SDK library)
  • Loading branch information
seokhee-lee committed Sep 9, 2020
1 parent 9090ee7 commit db4e662
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 34 deletions.
8 changes: 0 additions & 8 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
android:versionCode="12"
android:versionName="1.6.0" >

<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Expand All @@ -33,10 +29,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>

</manifest>
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

Expand All @@ -18,7 +21,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.connectsdk.sampler"
Expand Down Expand Up @@ -49,7 +51,8 @@ android {

}


dependencies {
compile 'com.connectsdk:connect-sdk-android:1.6.0'
implementation 'com.github.ConnectSDK:Connect-SDK-Android-Lite:master-SNAPSHOT'
implementation 'com.android.support:support-v4:22.2.1'
implementation 'com.android.support:appcompat-v7:22.+'
}
36 changes: 32 additions & 4 deletions src/com/connectsdk/sampler/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.connectsdk.device.DevicePicker;
import com.connectsdk.discovery.DiscoveryManager;
import com.connectsdk.discovery.DiscoveryManager.PairingLevel;
import com.connectsdk.discovery.DiscoveryProvider;
import com.connectsdk.sampler.fragments.BaseFragment;
import com.connectsdk.service.DeviceService;
import com.connectsdk.service.DeviceService.PairingType;
Expand All @@ -56,6 +57,8 @@ public class MainActivity extends ActionBarActivity implements ActionBar.TabList

SectionsPagerAdapter mSectionsPagerAdapter;

private DiscoveryManager mDiscoveryManager;

ViewPager mViewPager;
ActionBar actionBar;

Expand Down Expand Up @@ -157,8 +160,30 @@ public void onPageSelected(int position) {

setupPicker();

DiscoveryManager.getInstance().registerDefaultDeviceTypes();
DiscoveryManager.getInstance().setPairingLevel(PairingLevel.ON);
mDiscoveryManager = DiscoveryManager.getInstance();
mDiscoveryManager.registerDefaultDeviceTypes();
mDiscoveryManager.setPairingLevel(PairingLevel.ON);

// To show all services in a device, a device item in DevicePickerList
// mDiscoveryManager.setServiceIntegration(true);

// To search devices with specific service types
/*
try {
// AirPlay
mDiscoveryManager.registerDeviceService((Class<DeviceService>) Class.forName("com.connectsdk.service.AirPlayService"),
(Class<DiscoveryProvider>)Class.forName("com.connectsdk.discovery.provider.ZeroconfDiscoveryProvider"));
// webOS SSAP (Simple Service Access Protocol)
mDiscoveryManager.registerDeviceService((Class<DeviceService>) Class.forName("com.connectsdk.service.WebOSTVService"),
(Class<DiscoveryProvider>)Class.forName("com.connectsdk.discovery.provider.SSDPDiscoveryProvider"));
// DLNA
mDiscoveryManager.registerDeviceService((Class<DeviceService>) Class.forName("com.connectsdk.service.DLNAService"),
(Class<DiscoveryProvider>)Class.forName("com.connectsdk.discovery.provider.SSDPDiscoveryProvider"));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
*/

DiscoveryManager.getInstance().start();
}

Expand Down Expand Up @@ -305,8 +330,11 @@ void connectEnded(ConnectableDevice device) {
if (pairingCodeDialog.isShowing()) {
pairingCodeDialog.dismiss();
}
mTV.removeListener(deviceListener);
mTV = null;

if (mTV.isConnecting == false) {
mTV.removeListener(deviceListener);
mTV = null;
}
}

@Override
Expand Down
32 changes: 14 additions & 18 deletions src/com/connectsdk/sampler/fragments/MediaPlayerFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@
import java.util.concurrent.TimeUnit;

public class MediaPlayerFragment extends BaseFragment {
public static final String URL_SUBTITLES_WEBVTT =
"http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/sintel_en.vtt";
public static final String URL_SUBTITLE_SRT =
"http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/sintel_en.srt";
public static final String URL_VIDEO_MP4 =
"http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/video.mp4";
public static final String URL_IMAGE_ICON =
"http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/videoIcon.jpg";
public static final String URL_SUBTITLES_WEBVTT = "http://connectsdk.com/ConnectSDK.vtt";
public static final String URL_SUBTITLE_SRT = "http://connectsdk.com/ConnectSDK.srt";
public static final String URL_VIDEO_MP4 = "http://connectsdk.com/ConnectSDK.mp4";
public static final String URL_IMAGE_ICON = "http://connectsdk.com/ConnectSDK_Logo.jpg";

public Button photoButton;
public Button videoButton;
Expand Down Expand Up @@ -311,10 +307,10 @@ else if (isPlayingImage) {
}

private void playAudio() {
String mediaURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/audio.mp3";
String iconURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/audioIcon.jpg";
String title = "The Song that Doesn't End";
String description = "Lamb Chop's Play Along";
String mediaURL = "http://connectsdk.com/ConnectSDK.mp3";
String iconURL = "http://connectsdk.com/ConnectSDK_Logo.jpg";
String title = "Connect SDK";
String description = "One SDK Eight Media Platforms";
String mimeType = "audio/mp3";
boolean shouldLoop = loopingButton.isChecked();

Expand Down Expand Up @@ -385,11 +381,11 @@ public void onSuccess(MediaLaunchObject object) {
private void showImage() {
disableMedia();

String imagePath = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/photo.jpg";
String imagePath = "http://connectsdk.com/ConnectSDK.jpg";
String mimeType = "image/jpeg";
String title = "Sintel Character Design";
String description = "Blender Open Movie Project";
String icon = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/photoIcon.jpg";
String title = "Connect SDK";
String description = "One SDK Eight Media Platforms";
String icon = "http://connectsdk.com/ConnectSDK_Logo.jpg";

MediaInfo mediaInfo = new MediaInfo.Builder(imagePath, mimeType)
.setTitle(title)
Expand Down Expand Up @@ -430,8 +426,8 @@ private void playVideo() {
}

MediaInfo mediaInfo = new MediaInfo.Builder(URL_VIDEO_MP4, "video/mp4")
.setTitle("Sintel Trailer")
.setDescription("Blender Open Movie Project")
.setTitle("Connect SDK")
.setDescription("One SDK Eight Media Platforms")
.setIcon(URL_IMAGE_ICON)
.setSubtitleInfo(subtitleBuilder == null ? null : subtitleBuilder.build())
.build();
Expand Down

0 comments on commit db4e662

Please sign in to comment.