예제 #1
0
        public CastOptions GetCastOptions(Context appContext)
        {
            var notificationOptions = new NotificationOptions.Builder()
                                      .SetActions(new List <string>()
            {
                MediaIntentReceiver.ActionSkipNext, MediaIntentReceiver.ActionTogglePlayback, MediaIntentReceiver.ActionStopCasting
            }, new int[] { 1, 2 })
                                      .SetTargetActivityClassName("com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity")
                                      .Build();

            var mediaOptions = new CastMediaOptions.Builder()
                               .SetImagePicker(new ImagePickerImpl())
                               .SetNotificationOptions(notificationOptions)
                               .SetExpandedControllerActivityClassName("com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity")
                               .Build();

            var launchOptions = new LaunchOptions.Builder()
                                .Build();


            var castOptions = new CastOptions.Builder()
                              .SetLaunchOptions(launchOptions)
                              .SetReceiverApplicationId("0A6928D1")
                              .SetCastMediaOptions(mediaOptions)
                              .Build();

            return(castOptions);
        }
예제 #2
0
파일: CastProvider.cs 프로젝트: pictos/Opus
        public CastOptions GetCastOptions(Context appContext)
        {
            NotificationOptions notification = new NotificationOptions.Builder()
                                               .SetActions(new List <string> {
                MediaIntentReceiver.ActionSkipPrev, MediaIntentReceiver.ActionTogglePlayback, MediaIntentReceiver.ActionSkipNext
            }, new int[] { 1 })
                                               .SetTargetActivityClassName(Java.Lang.Class.FromType(typeof(MainActivity)).Name)
                                               .SetSmallIconDrawableResId(Resource.Drawable.NotificationIcon)
                                               .SetSkipPrevDrawableResId(Resource.Drawable.SkipPrevious)
                                               .SetPauseDrawableResId(Resource.Drawable.Pause)
                                               .SetPlayDrawableResId(Resource.Drawable.Play)
                                               .SetSkipNextDrawableResId(Resource.Drawable.SkipNext)
                                               .Build();

            CastMediaOptions media = new CastMediaOptions.Builder()
                                     .SetNotificationOptions(notification)
                                     .Build();

            CastOptions options = new CastOptions.Builder()
                                  .SetReceiverApplicationId(CastMediaControlIntent.DefaultMediaReceiverApplicationId)
                                  .SetCastMediaOptions(media)
                                  .SetStopReceiverApplicationWhenEndingSession(true)
                                  .Build();

            return(options);
        }