MrJai / flutter_to_airplay

Flutter plugin that offers two widgets, one to play a video for a given URL or file path using native AVPlayer and second with an option to airplay it on available Apple devices.
MIT License
30 stars 24 forks source link

Change AirPlayRoutePickerView icon? #10

Closed nimisis closed 4 years ago

nimisis commented 4 years ago

This is excellent! Would it be possible to have the ability to set the icon. At the moment the default seems to be the 'airplayaudio' icon. Thanks.

MrJai commented 4 years ago

@nimisis Thank you for using this package.

It's not a custom icon, but it is something that Apple provides with the AVRoutePickerView. I was looking into some native solution but looks like Apple doesn't let you customize this icon. As discussed in this thread, Setting AVRoutePickerView icon

I will keep looking for some possibility, otherwise I will implement some workaround over the weekend.

MrJai commented 4 years ago

I did check it out. As I confirmed Apple doesn't let you change the AVRoutePickerView Icon, but what you can do is, you can use the Stack widget to place any Icon on AVRoutePickerView and set AVRoutePickerView colors to transparent. Please see the example,

Container(
              width: 44.0,
              height: 44.0,
              child: Stack(
                alignment: Alignment.center,
                children: [
                  Icon(
                    Icons.play_circle_filled,
                  ),
                  AirPlayRoutePickerView(
                    tintColor: Colors.transparent,
                    activeTintColor: Colors.transparent,
                    backgroundColor: Colors.transparent,
                  ),
                ],
              ),
            ),

It will change Airplay Icon to Play Icon, but will still perform the required functionality.

SR5 Simulator Screen Shot - iPhone 11 Pro Max - 2020-09-09 at 08 22 03

Please feel free to comment if this is what you were looking for or if you need something else?

nimisis commented 4 years ago

This is a very helpful solution. Thanks!