Screen projection method and apparatus, storage medium and electronic device
The present disclosure discloses a screen projection method and apparatus, a storage medium and an electronic device, which relate to the technical field of Internet of Things. The method comprises: building a screen projection protocol channel corresponding to each terminal; receiving screen projection content; creating a screen projection management page and an independent window decoupler; creating a decoupled window on the basis of the independent window decoupler corresponding to each terminal; and displaying the screen projection content of the corresponding terminal in each decoupled window. The present disclosure improves the screen projection adjustability and reduces the management cost.
1 . A screen casting method, comprising:
in response to screen casting requests sent by a plurality of terminals, establishing a screen casting protocol channel corresponding to each terminal;
receiving, through the screen casting protocol channel corresponding to each terminal, a screen casting content sent by each terminal;
creating a screen casting management page and an independent window decoupler corresponding to each terminal;
creating a window interface component inherited from a window class in the independent window decoupler corresponding to each terminal to generate a decoupling window corresponding to each terminal in the screen casting management page; and
displaying the screen casting content sent by the terminal corresponding to each decoupling window in each decoupling window, so as to display the screen casting contents of the terminals in the screen casting management page.
2 . The method of claim 1 , wherein creating the screen casting management page and the independent window decoupler corresponding to each terminal comprises:
creating a screen casting management page;
creating an independent window control carrier corresponding to each terminal in the screen casting management page; and
using the independent window control carrier corresponding to each terminal as the independent window decoupler corresponding to each terminal.
3 . The method of claim 2 , wherein a layout manager is preset in the screen casting screen management page; and creating the independent window control carrier corresponding to each terminal in the screen casting management page comprising:
in the screen casting management page, creating a window extension class object inherited from an interface layout component for each terminal separately;
loading the window extension class object for each terminal into the screen casting management page through the layout manager to display the independent window control carrier corresponding to each terminal within the screen casting management page.
4 . The method of claim 2 , wherein creating the screen casting management page comprises:
creating a globally unique page extension class object inherited from a page component;
launching the page extension class object to display the screen casting management page.
5 . The method of claim 1 , wherein displaying the screen casting content sent by the terminal corresponding to each decoupling window in each decoupling window comprises:
determining the number of the screen casting requests;
adjusting a display state of the independent window decoupler corresponding to each terminal according to the number so that the independent window decoupler corresponding to each terminal adjusts a display state of the decoupling window corresponding to each terminal;
displaying, in each decoupling window after adjustment of the display state, the screen casting content sent by the terminal corresponding to each decoupling window.
6 . The method of claim 1 , wherein establishing the screen casting protocol channel corresponding to each terminal in response to the screen casting requests sent by the terminals comprises:
receiving the screen casting requests sent by the terminals;
identifying a screen casting protocol corresponding to each terminal based on the screen casting request of each terminal;
establishing the screen casting protocol channel corresponding to each terminal based on the screen casting protocol corresponding to each terminal.
7 . The method of claim 4 , wherein the page component comprises an Activity standard UI component, and the screen casting management page comprises an Activity page.
8 . The method of claim 3 , wherein the screen casting management page comprises an Activity page, the preset layout manager is a FragmentManager class object inside the Activity page, the interface layout component is a Fragment standard UI component, and the independent window control carrier corresponding to each terminal is an extension class inherited from the Fragment standard UI component.
9 . The method of claim 1 , wherein the window class comprises a View class, and the window interface component is a standard UI component inherited from the View class.
10 . The method of claim 5 , wherein adjusting the display state of the independent window decoupler corresponding to each terminal according to the number comprises one of the following methods:
displaying the independent window decoupler corresponding to each terminal in equal parts in a tiled manner within the screen casting management page;
highlighting the independent window decoupler corresponding to the terminal according to weight information in the screen casting request corresponding to the terminal.
11 . An electronic device, comprising:
a memory storing computer-readable instructions; and
a processor reading the computer-readable instructions stored in the memory to perform operations comprising:
in response to screen casting requests sent by a plurality of terminals, establishing a screen casting protocol channel corresponding to each terminal;
receiving, through the screen casting protocol channel corresponding to each terminal, a screen casting content sent by each terminal;
creating a screen casting management page and an independent window decoupler corresponding to each terminal;
creating a window interface component inherited from a window class in the independent window decoupler corresponding to each terminal to generate a decoupling window corresponding to each terminal in the screen casting management page; and
displaying the screen casting content sent by the terminal corresponding to each decoupling window in each decoupling window, so as to display the screen casting contents of the terminals in the screen casting management page.
12 . The electronic device of claim 11 , wherein the creating the screen casting management page and the independent window decoupler corresponding to each terminal comprises:
creating a screen casting management page;
creating an independent window control carrier corresponding to each terminal in the screen casting management page; and
using the independent window control carrier corresponding to each terminal as the independent window decoupler corresponding to each terminal.
13 . The electronic device of claim 12 , wherein a layout manager is preset in the screen casting screen management page; and creating the independent window control carrier corresponding to each terminal in the screen casting management page comprising:
in the screen casting management page, creating a window extension class object inherited from an interface layout component for each terminal separately;
loading the window extension class object for each terminal into the screen casting management page through the layout manager to display the independent window control carrier corresponding to each terminal within the screen casting management page.
14 . The electronic device of claim 12 , wherein the creating the screen casting management page comprises:
creating a globally unique page extension class object inherited from a page component;
launching the page extension class object to display the screen casting management page.
15 . The electronic device of claim 11 , wherein displaying the screen casting content sent by the terminal corresponding to each decoupling window in each decoupling window comprises:
determining the number of the screen casting requests;
adjusting a display state of the independent window decoupler corresponding to each terminal according to the number so that the independent window decoupler corresponding to each terminal adjusts a display state of the decoupling window corresponding to each terminal;
displaying, in each decoupling window after adjustment of the display state, the screen casting content sent by the terminal corresponding to each decoupling window.
16 . The electronic device of claim 11 , wherein establishing the screen casting protocol channel corresponding to each terminal in response to the screen casting requests sent by the terminals comprises:
receiving the screen casting requests sent by the terminals;
identifying a screen casting protocol corresponding to each terminal based on the screen casting request of each terminal;
establishing the screen casting protocol channel corresponding to each terminal based on the screen casting protocol corresponding to each terminal.
17 . The electronic device of claim 14 , wherein the page component comprises an Activity standard UI component, and the screen casting management page comprises an Activity page.