Adds Apple airplay/Google cast support to the app #2
+6
-9
@@ -63,11 +63,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MainPage extends StatefulWidget {
|
class MainPage extends StatefulWidget {
|
||||||
const MainPage({
|
const MainPage({super.key, required this.audio, required this.casting});
|
||||||
super.key,
|
|
||||||
required this.audio,
|
|
||||||
required this.casting,
|
|
||||||
});
|
|
||||||
|
|
||||||
final StreamingAudioBusinessObject audio;
|
final StreamingAudioBusinessObject audio;
|
||||||
final CastingBusinessObject casting;
|
final CastingBusinessObject casting;
|
||||||
@@ -94,7 +90,8 @@ class _MainPageState extends State<MainPage> {
|
|||||||
|
|
||||||
bool get _isPlaybackStopped {
|
bool get _isPlaybackStopped {
|
||||||
if (_isUsingRemotePlayback) {
|
if (_isUsingRemotePlayback) {
|
||||||
return _casting.isStopped || _casting.playbackStatus == CastingPlaybackStatus.unknown;
|
return _casting.isStopped ||
|
||||||
|
_casting.playbackStatus == CastingPlaybackStatus.unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _audio.isStopped;
|
return _audio.isStopped;
|
||||||
@@ -158,8 +155,7 @@ class _MainPageState extends State<MainPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _handleCastingStateChanged() {
|
void _handleCastingStateChanged() {
|
||||||
if (
|
if (_usesExternalCastPlayback &&
|
||||||
_usesExternalCastPlayback &&
|
|
||||||
(!_castStreamStartedForActiveSession || _pendingRemotePlay) &&
|
(!_castStreamStartedForActiveSession || _pendingRemotePlay) &&
|
||||||
!_isStartingCastStream) {
|
!_isStartingCastStream) {
|
||||||
_startCastingLiveStream();
|
_startCastingLiveStream();
|
||||||
@@ -214,7 +210,8 @@ class _MainPageState extends State<MainPage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_usesExternalCastPlayback && _casting.status == CastingStatus.connecting) {
|
if (_usesExternalCastPlayback &&
|
||||||
|
_casting.status == CastingStatus.connecting) {
|
||||||
_pendingRemotePlay = true;
|
_pendingRemotePlay = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user