Skip to content

Commit

Permalink
Adds Chromecast functionality (#273)
Browse files Browse the repository at this point in the history
* Chromecast support (#266)

* resolve TransactionTooLargeException on android 7

* adds chromecast support

* adds cast session manager and remote media to native player

* adds ExpandedController for cast

* resolve blank video activity on stopping cast

* adds mini controller

* adds cast notifications and change app id

* resolve crash on opening cast activity through notification

* adds cast support for audio files

* start casting only after metadata is fetched

* adds fixed image audio cast

* shift chromecast app_id in api.properties

* remove custom audio-play image

* adds cast options to image viewer (#269)
  • Loading branch information
csoni111 authored and cpg committed Aug 29, 2017
1 parent ee3ba01 commit 37c8ec2
Show file tree
Hide file tree
Showing 21 changed files with 806 additions and 73 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ android {
buildConfigField "String", "API_URL_PROXY", formatStringField(apiProperties["url.proxy"])
buildConfigField "String", "API_CLIENT_ID", formatStringField(apiProperties["client.id"])
buildConfigField "String", "API_CLIENT_SECRET", formatStringField(apiProperties["client.secret"])
buildConfigField "String", "CHROMECAST_APP_ID", formatStringField(apiProperties["chromecast.app.id"])

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -116,6 +117,8 @@ dependencies {
compile "com.android.support:preference-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:customtabs:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:leanback-v17:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:mediarouter-v7:${SUPPORT_LIBRARY_VERSION}"
compile 'com.google.android.gms:play-services-cast-framework:11.0.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
Expand Down
1 change: 1 addition & 0 deletions fakeApi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ url.amahi=https://amahi.org
url.proxy=https://amahi.org
client.id=1234567890
client.secret=abcdefghijklmnopqrstuvwxyz
chromecast.app.id=CC1AD845
17 changes: 15 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.amahi.anywhere"
android:installLocation="auto">

Expand Down Expand Up @@ -100,9 +99,19 @@
<activity
android:name=".activity.ServerFileVideoActivity"
android:theme="@style/Theme.Amahi.Fullscreen"/>
<activity
android:name=".activity.ExpandedControlsActivity"
android:theme="@style/Theme.CastVideosDark"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity
android:name=".activity.NativeVideoActivity"
android:theme="@style/Theme.Amahi.Fullscreen"/>
android:theme="@style/Theme.Amahi.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode"/>
<activity android:name=".activity.ServerFileWebActivity"/>
<activity
android:name=".activity.SettingsActivity"
Expand Down Expand Up @@ -178,6 +187,10 @@

<activity android:name=".tv.activity.TvPlaybackAudioActivity"
android:theme="@style/Theme.Leanback"/>

<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="org.amahi.anywhere.util.CastOptionsProvider" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.amahi.anywhere.activity;

import android.view.Menu;

import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;

import org.amahi.anywhere.R;

public class ExpandedControlsActivity extends ExpandedControllerActivity {

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.action_bar_expanded_controller, menu);
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item);
return true;
}
}
Loading

0 comments on commit 37c8ec2

Please sign in to comment.