This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
.... | |
CastContext.getSharedInstance(this) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation 'com.google.android.exoplayer:extension-cast:2.9.6' | |
implementation 'com.android.support:mediarouter-v7:28.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<item | |
android:id="@+id/media_route_menu_item" | |
android:title="cast" | |
app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" | |
app:showAsAction="always"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.android.gms.cast.framework.CastButtonFactory; | |
override fun onCreateOptionsMenu(menu: Menu): Boolean { | |
super.onCreateOptionsMenu(menu) | |
menuInflater.inflate(R.menu.cast, menu) | |
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item) | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.android.gms.cast.framework.CastButtonFactory; | |
override fun onCreateOptionsMenu(menu: Menu): Boolean { | |
super.onCreateOptionsMenu(menu) | |
menuInflater.inflate(R.menu.cast, menu) | |
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item) | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta-data | |
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" | |
android:value="com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.android.exoplayer2.ext.cast.CastPlayer | |
... | |
private lateinit var castPlayer: CastPlayer | |
val videoString = "http://cbsnewshd-lh.akamaihd.net/i/CBSNHD_7@199302/index_700_av-p.m3u8" | |
..... | |
castPlayer = CastPlayer(CastContext.getSharedInstance(this)) | |
castPlayer.setSessionAvailabilityListener(object : CastPlayer.SessionAvailabilityListener { | |
override fun onCastSessionAvailable() { |