diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 874b9d5..ba217d9 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,10 +4,6 @@ android:versionCode="12" android:versionName="1.6.0" > - - @@ -33,10 +29,6 @@ - - diff --git a/build.gradle b/build.gradle index 55243d0..81de79e 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } } @@ -18,7 +21,6 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 - buildToolsVersion "22.0.1" defaultConfig { applicationId "com.connectsdk.sampler" @@ -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.+' } diff --git a/src/com/connectsdk/sampler/MainActivity.java b/src/com/connectsdk/sampler/MainActivity.java index c30336c..20b102b 100644 --- a/src/com/connectsdk/sampler/MainActivity.java +++ b/src/com/connectsdk/sampler/MainActivity.java @@ -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; @@ -56,6 +57,8 @@ public class MainActivity extends ActionBarActivity implements ActionBar.TabList SectionsPagerAdapter mSectionsPagerAdapter; + private DiscoveryManager mDiscoveryManager; + ViewPager mViewPager; ActionBar actionBar; @@ -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) Class.forName("com.connectsdk.service.AirPlayService"), + (Class)Class.forName("com.connectsdk.discovery.provider.ZeroconfDiscoveryProvider")); + // webOS SSAP (Simple Service Access Protocol) + mDiscoveryManager.registerDeviceService((Class) Class.forName("com.connectsdk.service.WebOSTVService"), + (Class)Class.forName("com.connectsdk.discovery.provider.SSDPDiscoveryProvider")); + // DLNA + mDiscoveryManager.registerDeviceService((Class) Class.forName("com.connectsdk.service.DLNAService"), + (Class)Class.forName("com.connectsdk.discovery.provider.SSDPDiscoveryProvider")); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + */ + DiscoveryManager.getInstance().start(); } @@ -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 diff --git a/src/com/connectsdk/sampler/fragments/MediaPlayerFragment.java b/src/com/connectsdk/sampler/fragments/MediaPlayerFragment.java index d4295fd..318aacb 100644 --- a/src/com/connectsdk/sampler/fragments/MediaPlayerFragment.java +++ b/src/com/connectsdk/sampler/fragments/MediaPlayerFragment.java @@ -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; @@ -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(); @@ -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) @@ -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();