Screen projection processing method and device and storage medium
By monitoring the real-time streaming data reception of terminal devices, dynamically adjusting playback latency and disabling Wi-Fi scanning, the problem of screen mirroring stuttering was solved, achieving the best balance between video smoothness and real-time operation, and improving the user experience.
Patent Information
- Application Number
- CN202511572733.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-02-27
AI Technical Summary
In screen mirroring scenarios on terminal devices, video stuttering is caused by the delay in receiving real-time data streams. Existing fixed-delay buffering strategies cannot dynamically adapt to network conditions, affecting video smoothness and real-time operation.
By monitoring the real-time streaming data reception of terminal devices, the playback latency of the screen mirroring player is dynamically adjusted. Combined with a cache array and cooldown mechanism, the playback latency value is adaptively adjusted, and the Wi-Fi scanning function is disabled when necessary to optimize network resource management.
It effectively eliminates screen jitter and stuttering, improves the stability and continuity of smooth video playback, and ensures real-time responsiveness and user experience.
Smart Images

Figure CN121585847A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of screen mirroring technology, and in particular to a screen mirroring processing method, device and storage medium. Background Technology
[0002] In screen mirroring scenarios on terminal devices, the real-time video data stream can be affected by various factors, resulting in stuttering and significantly impacting the user's viewing experience. The root cause of this stuttering is not data packet loss, but rather the receiving delay generated during real-time data stream transmission. This receiving delay can easily cause video frames to accumulate momentarily on the screen mirroring player's side. To maintain real-time playback, the screen mirroring player will then rapidly render and skip these accumulated video frames. This processing mechanism visually manifests as noticeable screen jumps, pauses, or ghosting, creating an unpleasant stuttering experience. Summary of the Invention
[0003] This application provides a screen mirroring method, device, and storage medium, aiming to solve the problem of screen mirroring lag. The specific technical solution is as follows: A screen mirroring method includes: The system monitors the reception of real-time streaming data during screen mirroring to detect a first stuttering event; wherein, the first stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds a first threshold. In response to the detected first stuttering event, a target latency value is determined based on at least one stuttering duration in a cache array, wherein the cache array records the stuttering duration of the first stuttering events detected in the past. Adjust the playback delay of the screen mirroring player on the terminal device to the target delay value, where the target delay value is greater than the initial delay value of the screen mirroring player before adjustment.
[0004] Optionally, determining the target latency value based on at least one stutter duration in the cache array includes: determining the average of all stutter durations in the cache array; determining whether the stutter duration of the first stutter event exceeds a preset multiple of the average; if it does not exceed, adding the stutter duration of the first stutter event to the cache array, and determining the target latency value based on all stutter durations in the updated cache array; if it exceeds, directly determining the target latency value based on all stutter durations in the cache array. This technical solution, by introducing a dynamic evaluation mechanism based on historical stutter data, can effectively distinguish between occasional, severe network spikes (such as a single severe packet loss) and continuous network fluctuations. By filtering out these abnormal spike values, it can prevent overreaction due to individual extreme stutters, thereby avoiding setting unnecessary large delays and making the determined target latency value closer to the real and general conditions of the current network environment.
[0005] Optionally, determining the target latency value based on at least one stutter duration in the cache array includes: determining the 75th percentile of all stutter durations in the cache array as the target latency value. This technical solution, by employing the 75th percentile as a statistical metric, intelligently balances the smoothness of the video stream with the real-time requirements of the control operation. Compared to directly using the maximum value, the 75th percentile effectively covers the vast majority of common stutter durations, providing sufficient buffering for smooth playback and avoiding excessively large buffering due to excessively long delays in a few extreme cases, thus preventing excessively sluggish response from the control operation. Compared to using the average value, the 75th percentile more adequately addresses the mainstream level of network fluctuations, avoiding underestimating latency requirements due to averaging, which could lead to insufficient buffering and stuttering again. This method makes the final determined target latency value more statistically representative and robust, adaptively adapting to the mainstream fluctuation level of the current network conditions, thereby achieving a better balance between eliminating stuttering and maintaining operational responsiveness.
[0006] Optionally, after adjusting the playback delay of the screen mirroring player on the terminal device to the target delay value, the method further includes: activating a first preset cooling-off period; during the cooling-off period, prohibiting further adjustment of the playback delay of the screen mirroring player. This technical solution, by introducing a cooling-off period mechanism, effectively prevents the problem of frequent and drastic increases in playback delay values caused by continuous stuttering within a short period. Such frequent adjustments not only keep the system in an unstable "oscillation" state but also severely impair the real-time performance of counter-control operations due to the continuous accumulation of delay values, ultimately affecting the user experience. By setting a reasonable cooling-off period (e.g., 5 seconds), the system provides a necessary observation window for the applied delay adjustment strategy, ensuring a relatively stable playback environment, thereby achieving adaptive and smooth stuttering handling.
[0007] Optionally, after adjusting the playback latency of the screen mirroring player on the terminal device to the target latency value, the method further includes: if the first stuttering event is not detected again within a second preset time period, then gradually adjusting the playback latency of the screen mirroring player to the initial latency value. This technical solution effectively avoids the problem of unnecessarily maintaining a high playback latency when the network condition temporarily deteriorates and then returns to normal by introducing an automatic recovery mechanism. Specifically, after the stuttering risk is eliminated, the playback latency is gradually reduced to reduce the abruptness perceived by the user. This mechanism ensures that the screen mirroring process has bidirectional adaptive capabilities, not only ensuring smooth video playback when the network fluctuates, but also reducing operation latency in a timely manner when the network quality improves, always maintaining the best balance between smoothness and responsiveness.
[0008] Optionally, the method further includes disabling the Wi-Fi scanning function of the terminal device during the screen mirroring process. This technical solution effectively solves the periodic lag problem caused by the system periodically scanning wireless networks in the background by actively managing the Wi-Fi scanning function. By temporarily disabling non-urgent Wi-Fi scanning tasks, the competition and occupation of wireless channel resources are reduced, ensuring that the screen mirroring data stream transmission prioritizes obtaining stable network bandwidth. This preventative measure can significantly reduce network latency fluctuations caused by the system's own behavior, preventing a type of regular lag from occurring at its source.
[0009] Optionally, during the screen mirroring process of the terminal device, disabling the Wi-Fi scanning function of the terminal device includes: if a second stuttering event is detected during the screen mirroring process, and the interval between the detection of the second stuttering event and the last detection of the second stuttering event is less than or equal to a preset interval threshold, then the Wi-Fi scanning function of the terminal device is disabled; wherein, the second stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds the second threshold. This technical solution, by introducing a conditional judgment mechanism, achieves precise control of the Wi-Fi scanning function, effectively distinguishing between periodic stuttering caused by system background Wi-Fi scanning and occasional stuttering caused by other reasons. By setting a reasonable time interval threshold, the Wi-Fi scanning disabling operation is only triggered when a second stuttering event with specific duration characteristics occurs repeatedly. This design significantly improves the accuracy of stuttering cause judgment and avoids unnecessary function disabling due to misjudgment. This mechanism can specifically eliminate regular stuttering problems caused by Wi-Fi scanning, while minimizing interference with other network functions of the system, thereby maintaining the integrity of the terminal device's network service and the balance of user experience while ensuring screen mirroring smoothness.
[0010] Optionally, the method further includes: when the terminal device is projecting its screen and the Wi-Fi scanning function is disabled, listening for the opening event of the Wi-Fi settings interface of the terminal device; when the Wi-Fi settings interface is detected to be open, enabling the Wi-Fi scanning function of the terminal device, and disabling the Wi-Fi scanning function of the terminal device again when the Wi-Fi settings interface is detected to be closed. Alternatively, when the terminal device is projecting its screen and the Wi-Fi scanning function is disabled, listening for the opening event of the Wi-Fi settings interface of the terminal device; when the Wi-Fi settings interface is detected to be open, enabling the Wi-Fi scanning function of the terminal device, and disabling the Wi-Fi scanning function of the terminal device again when the Wi-Fi settings interface is detected to be closed; and / or, when the terminal device is projecting its screen, listening for the state of the projecting interface of the terminal device; when the projecting interface is detected to switch from the foreground to the background, enabling the Wi-Fi scanning function of the terminal device, and disabling the Wi-Fi scanning function of the terminal device again when the projecting interface is detected to switch from the background to the foreground. This technical solution, by introducing an intelligent context awareness mechanism, effectively maintains the balance between the integrity of the terminal device's network services and the user experience while ensuring smooth projecting. Specifically, by monitoring changes in the Wi-Fi settings interface, the system can promptly restore the scanning function when the user actively configures the network, ensuring normal network connectivity. Once the settings are complete, the Wi-Fi scanning function is immediately disabled again, continuing to provide a stable network environment for screen mirroring. Simultaneously, by monitoring the foreground and background states of the screen mirroring interface, the system can intelligently restore the Wi-Fi scanning function when the user no longer needs to view the mirrored content, and disable it again when the user returns to screen mirroring, ensuring continuous optimization of core functions. This dynamic management strategy avoids disrupting normal user network operations by completely disabling Wi-Fi scanning, while minimizing the interference of Wi-Fi scanning on screen mirroring stability, achieving an intelligent balance between screen mirroring performance and device functional integrity.
[0011] An electronic device includes: a processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform the screen projection processing method described above.
[0012] A computer-readable storage medium storing a computer program that, when executed, implements the above-described screen projection method.
[0013] This application provides a screen mirroring processing solution. By monitoring the reception of real-time streaming data during screen mirroring on the terminal device, it promptly identifies the first stuttering event where the reception delay exceeds a first threshold. Then, based on a cache array recording historical stuttering durations, it determines a target latency value that reflects network fluctuation statistics. Finally, by adjusting the playback delay of the screen mirroring player on the terminal device to this target latency value, the playback pace is actively slowed down to accommodate the waiting for real-time streaming data reception. Thus, when transmission fluctuations occur, the adjusted playback delay buffers the waiting for slightly delayed real-time streaming data, thereby eliminating visual jitter and stuttering caused by untimely data reception. While ensuring smooth video playback, the overall latency is controlled within a reasonable range, significantly improving the continuity and stability of the mirrored image.
[0014] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the first flowchart of the screen projection processing method according to an embodiment of this application.
[0017] Figure 2 This is a schematic diagram of the real-time data stream in the screen casting processing method of this application under network lag conditions.
[0018] Figure 3 This is a schematic diagram of the second process of the screen projection method according to an embodiment of this application.
[0019] Figure 4 This is a schematic diagram of the third process of the screen projection method according to an embodiment of this application.
[0020] Figure 5 This is a schematic diagram of the fourth process of the screen projection processing method according to an embodiment of this application.
[0021] Figure 6 This is a schematic diagram of the screen projection processing device according to an embodiment of this application.
[0022] Figure 7This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0023] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0024] In screen mirroring scenarios, the real-time video data stream can be affected by various factors, resulting in stuttering and significantly impacting the user's viewing experience. The root cause of this stuttering is not data packet loss, but rather the receiving latency during real-time data stream transmission. Specifically, this manifests as: unstable transmission rates due to network fluctuations; uneven data packet transmission caused by specific transmission strategies employed by some terminal device manufacturers; momentary congestion caused by sudden high data volume transmissions at the initial stage of the screen mirroring connection; and periodic occupation of wireless channel resources by Wi-Fi scanning tasks executed regularly in the system background. These complex factors combine to cause video frame accumulation. To maintain real-time performance, the screen mirroring player rapidly renders and skips these accumulated video frames. This processing mechanism visually manifests as noticeable screen jumps, pauses, or ghosting, creating an unpleasant stuttering experience.
[0025] To address screen mirroring stuttering issues, existing technologies typically employ a simple fixed-delay buffering strategy to maintain video playback continuity. The core implementation of this approach involves setting a fixed time delay buffer (usually around 70 milliseconds) at the data receiving end. All received real-time streaming data is temporarily stored in this buffer, and then decoded and played after the fixed delay. This method attempts to "smooth out" minor network fluctuations by artificially introducing a fixed delay. While it can alleviate occasional minor stuttering to some extent, its inherent static nature determines its significant limitations: when network conditions are consistently good, this fixed-delay strategy forces unnecessary waiting time, resulting in consistently high operational response latency, severely impacting the sensitivity and real-time performance of control operations; conversely, when faced with continuous or severe network fluctuations, its fixed buffer depth cannot effectively absorb all transmission delays, the existing buffer is quickly exhausted, and noticeable stuttering and frame skipping still occur during video playback. This "one-size-fits-all" static buffering strategy lacks dynamic perception and adaptive capabilities regarding network conditions. It cannot intelligently adjust buffering parameters according to actual network conditions, making it difficult to achieve a dynamic optimal balance between video smoothness and real-time operation in complex and ever-changing network environments. This demonstrates a significant lack of adaptability in application scenarios that pursue a high-quality screen projection experience.
[0026] In view of this, this application provides a screen casting processing method, device, and storage medium, aiming to improve the smoothness of the screen casting screen and enhance the user experience by dynamically identifying the degree of stuttering through an adaptive adjustment mechanism and appropriately adjusting the playback latency of the screen casting player. The technical solutions provided by various embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0027] One embodiment of this application provides a screen mirroring method. Wherein, Figure 1 This is a flowchart illustrating the screen mirroring process, including the following steps: S101, monitor the reception of real-time streaming data by the terminal device during screen mirroring to detect the first stuttering event; wherein, the first stuttering event refers to the event in which the reception delay of real-time streaming data exceeds a first threshold.
[0028] In this embodiment, the terminal device specifically refers to the screen mirroring receiving device that performs the screen display function. A complete screen mirroring system consists of a screen mirroring sending device (such as a smartphone, tablet, or other mobile terminal) and a terminal device (such as a smart car infotainment system, smart TV, or other display device). When the screen mirroring sending device activates its screen mirroring function, it captures its screen display content in real time, converts it into real-time streaming data composed of a continuous sequence of video frames using encoding and compression technology, and continuously transmits it to the terminal device via a wireless network. This real-time streaming data, as the digital carrier of the screen mirroring content, directly determines the final display effect in terms of its reception quality on the terminal device—including the continuity and timeliness of the real-time streaming data reception, which together determine the smoothness of the screen mirroring. Any deficiency in any aspect may lead to visual stuttering.
[0029] To achieve dynamic response and intelligent handling of potential stuttering during screen mirroring, this embodiment establishes a continuous real-time streaming data monitoring mechanism on the receiving terminal device. This proactive monitoring strategy is crucial because waiting until the user notices the stuttering before taking remedial measures is often too late, and the user experience has already been compromised. Therefore, this embodiment actively tracks and analyzes the timing characteristics of data reception on the terminal device side to identify potential transmission anomalies in advance. Specifically, during monitoring, the system accurately records the actual arrival time of each frame of data and compares it with the expected playback time calculated based on the frame rate. When the system detects that the difference between the reception time of a single frame or multiple consecutive frames and the expected time—i.e., the reception delay—continuously accumulates and exceeds a preset first threshold, a first stuttering event is determined to have occurred. The setting of this first threshold takes into account the inherent characteristics of video streams: in a typical 30 frames per second screen mirroring scenario, the ideal interval between each frame is approximately 33 milliseconds. Therefore, setting the first threshold to 60 milliseconds is technically reasonable, as it is equivalent to the transmission waiting time of nearly two frames. When the reception delay exceeds this threshold, the system recognizes that initial signs of stuttering that may affect the viewing experience have appeared, and then initiates the subsequent adaptive processing flow, providing a crucial decision-making basis for taking timely corrective measures.
[0030] S102, in response to the detected first stuttering event, a target latency value is determined based on at least one stuttering duration in a cache array, the cache array recording the stuttering duration of previously detected first stuttering events.
[0031] In this embodiment, the cache array is a historical dataset reflecting network fluctuation characteristics, formed by continuously recording the duration of each detected stuttering event during the screen mirroring process. The importance of the cache array lies in its ability to provide a basis for predicting future network jitter by quantifying past stuttering events. Network jitter is essentially manifested as the uncertainty of data packet arrival time, and the cache array establishes a "fingerprint" of network fluctuation characteristics by statistically analyzing historical stuttering durations. Analyzing this cache array determines the target latency value, aiming to provide an optimal buffer duration for subsequent video playback that effectively absorbs network jitter without excessive delay. Specifically, the system sets an appropriate buffer size based on historical stuttering data, sufficient to accommodate data latency in most cases, thereby avoiding stuttering caused by instantaneous network fluctuations; at the same time, this buffer is not set too large to avoid introducing unnecessary playback delays.
[0032] As an optimized implementation, this embodiment determines the target latency value as the 75th percentile of all stutter durations in the updated cache array. This statistical metric choice considers the balance between video smoothness and responsiveness: compared to directly using the maximum value, the 75th percentile avoids excessive overall latency due to a few extreme latency values; compared to using the average value, it provides more adequate buffering. This method makes the determined target latency value more statistically representative, adaptively covering most common stuttering scenarios, achieving the best balance between eliminating stutters and maintaining operational responsiveness.
[0033] In practice, the average duration of all stutters in the cache array can be calculated first. Then, the stutter duration of the first detected stutter event is compared with a preset multiple (usually 2 times) of this average. If the stutter duration of the first detected stutter event exceeds this preset multiple, it is considered an abnormal spike and not added to the cache array. These abnormal spikes are usually caused by sporadic factors, such as other applications suddenly consuming a large amount of network resources or the device's CPU being temporarily occupied. These factors are not continuous or representative and cannot reflect the basic network condition. If the current stutter duration does not exceed the preset multiple, it indicates that this is a typical manifestation of the current network state. In this case, the stutter duration of the first detected stutter event is added to the cache array for updating. This dynamic evaluation mechanism can effectively distinguish between sporadic and severe network spikes and continuous network fluctuations. By filtering outliers, it prevents the system from overreacting to individual extreme stutters and ensures that the determined target latency value is closer to the real situation of the current network environment.
[0034] S103, adjust the playback delay of the screen mirroring player on the terminal device to the target delay value, which is greater than the initial delay value of the screen mirroring player before adjustment.
[0035] This embodiment introduces an appropriate playback delay, creating a buffer window for subsequently arriving data packets. When network fluctuations cause a brief delay in data packet arrival, this buffer absorbs the delay, ensuring the player always has data to play, thus avoiding video stuttering or frame skipping caused by waiting for data. Essentially, this trades controllable, minimal latency for continuous and stable video playback. (Reference) Figure 3 As shown, taking a 30 frames per second (fps) video stream as an example, under ideal transmission conditions, video frames F1 to F7 should be delivered and played continuously at a uniform interval of 33 milliseconds per frame. However, when network congestion occurs, frames F3 to F7 experience concentrated delays in arrival. In this case, by increasing the playback latency of the screen mirroring player, the waiting time for frame data in the playback queue is actively extended. This adjustment essentially creates a necessary buffer window for subsequent data packets delayed by network fluctuations, allowing the player to collect enough frame data to maintain continuous rendering. Simultaneously, the system adjusts the timestamps of each frame accordingly, re-establishing a continuous time sequence. This ensures that when the player renders based on the calibrated timestamps, it can display the image at a stable and uniform rhythm, thereby completely eliminating frame jumps or playback interruptions caused by uneven data reception in the user's perception, achieving a smooth and consistent visual experience.
[0036] After adjusting the playback latency, this embodiment immediately activates a cooldown period of a first preset duration (e.g., 5 seconds). During this time window, the system will prohibit any upward adjustment of the playback latency of the screen-casting player. This design fundamentally solves the problem of excessive accumulation of latency values caused by continuous detection of stuttering events within a short period. Without this protection mechanism, it is easy to fall into a vicious cycle of "detecting stuttering - increasing latency - new stuttering caused by increased latency - continuing to increase latency," which not only causes the system state to be in a state of continuous unstable oscillation, but also seriously impairs the real-time responsiveness of user operations due to the unlimited accumulation of latency values. The cooldown period provides the necessary observation and verification period for the previous adjustment strategy, allowing the system to fully evaluate the actual effect of the current latency setting, while effectively preventing over-adjustment caused by instantaneous network fluctuations, thereby ensuring the stability of the playback environment and the consistency of the user experience. This design reflects a fine balance between system response speed and stability, ensuring the timeliness of stuttering handling while avoiding aggressive and reckless adjustments.
[0037] Furthermore, this embodiment also incorporates an automatic playback latency recovery mechanism to address the inherent issue of maintaining latency settings after temporary network fluctuations subside, ensuring the system can dynamically adapt to changes in network conditions. This mechanism initiates a continuous monitoring process after latency adjustment: if no further stuttering event is detected within a second preset time period, it indicates that the network condition has stabilized from the fluctuation. At this point, the system will initiate a gradual callback process, progressively restoring the playback latency value of the casting player to the initial latency level through multiple adjustment cycles. Figure 3 The implementation process shown uses an intelligent countdown task to achieve precise dynamic management: when the system enters a delay state, countdown monitoring is immediately started. If a new first stuttering event is detected during this period, the countdown cycle is immediately reset. If the countdown is completed successfully and stable transmission is maintained during the process, the current latency value is precisely reduced by 30ms (this value is set based on the characteristic that the single frame interval in a 30fps video stream is about 33ms, ensuring that each adjustment is about the duration of one frame). The system then determines whether the adjusted receiving latency value has been completely zeroed. If zero latency has been achieved, the screen mirroring player is immediately notified to completely cancel the playback latency setting and restore normal real-time playback. If it has not been zeroed, the new latency value is maintained and the countdown task is restarted to enter the next monitoring cycle. This gradual recovery mechanism effectively avoids the visual jump caused by sudden changes in latency through small-step, multi-cycle adjustments. It can restore the real-time performance of video playback in a timely manner when network quality improves, and ensure a smooth transition in the latency adjustment process. Ultimately, it achieves intelligent management of the entire lifecycle of the latency strategy, enabling the system to maintain the best balance between video smoothness and operational responsiveness under complex and ever-changing network conditions.
[0038] In addition to adjusting playback latency to address network fluctuations, this embodiment also introduces a solution from the system resource management level to comprehensively ensure the smoothness of the projected screen. Specifically, during the projected screen process on the terminal device, the device's Wi-Fi scanning function can be disabled. This measure specifically targets a certain type of stuttering issue caused by the system's periodic scanning of wireless networks in the background, which typically manifests as regular, intermittent stuttering. By temporarily suspending non-urgent Wi-Fi scanning tasks, the terminal device system significantly reduces the intensity of competition for wireless channel resources, effectively reducing transmission conflicts caused by resource contention, thereby ensuring that the projected data stream can continuously obtain stable and sufficient network bandwidth. This preventative resource management strategy can fundamentally alleviate network latency fluctuations caused by the system's own behavior, achieving source control of regular stuttering phenomena.
[0039] At the implementation level, this embodiment further refines the triggering conditions for the Wi-Fi scanning function and establishes an intelligent decision-making mechanism based on multi-dimensional judgment. During the screen projection process of the terminal device, the reception of real-time streaming data is continuously monitored. When a second stuttering event is detected (characterized by a real-time streaming data reception delay exceeding a second threshold, typically set to 150ms), and the interval between the detection of the last similar event and the detection of the same event is less than or equal to a preset interval threshold (e.g., 9.2 seconds), the Wi-Fi scanning function is disabled. This triggering condition judgment mechanism enables accurate tracing of the cause of stuttering, effectively distinguishing between regular stuttering caused by the system's periodic Wi-Fi scanning and occasional stuttering caused by other network factors. By setting a reasonable preset interval threshold, this embodiment can accurately identify stuttering patterns that conform to the characteristics of the Wi-Fi scanning cycle. The Wi-Fi scanning function will only be disabled when stuttering events with a specific time pattern occur repeatedly, thereby effectively avoiding misjudgments caused by temporary network fluctuations or other accidental factors and preventing unnecessary restrictions on the Wi-Fi scanning function. This design ensures that effective measures can be taken in a timely manner to guarantee smooth screen projection when Wi-Fi scanning interference does occur, while maximizing the integrity and functionality of the terminal device's network services.
[0040] It's important to note that disabling Wi-Fi scanning doesn't mean completely depriving users of their network connectivity. In this embodiment, during screen mirroring while Wi-Fi scanning is disabled, the system continuously monitors for the opening of the terminal device's Wi-Fi settings interface. When the system detects that the user has actively opened the Wi-Fi settings interface, it immediately and temporarily restores the Wi-Fi scanning function to ensure the user can normally search for and connect to available networks. Conversely, when the settings interface is detected as closed, the scanning function is disabled again to maintain the clean network environment required for screen mirroring. This dynamic management mechanism, based on usage scenarios, achieves an intelligent balance between screen mirroring needs and network functionality. It effectively avoids the potential degradation in user experience caused by completely disabling the scanning function while minimizing the interference of Wi-Fi scanning on screen mirroring stability, demonstrating the system's comprehensive and user-friendly design.
[0041] Furthermore, this embodiment establishes a complete dynamic management system for Wi-Fi scanning by monitoring changes in the foreground and background states of the projection interface. When the projection interface is detected to switch from the foreground to the background, the Wi-Fi scanning function is immediately activated. This mechanism ensures the integrity and timeliness of the device's basic communication functions such as network search and message reception, allowing users to maintain a normal network connection even when temporarily leaving the projection interface. Conversely, when the projection interface is detected to return to the foreground from the background, the Wi-Fi scanning function is immediately disabled again, continuing to provide a clean network transmission environment for the projection application. This intelligent state awareness mechanism achieves refined management of Wi-Fi resource allocation by accurately identifying the user's actual usage of the projection function: it effectively avoids network interference caused by Wi-Fi scanning when the user is focused on watching the projection content, ensuring the smoothness of the core projection experience; it also ensures the complete availability of the device's network functions when the user does not need to watch the projection content, enabling the terminal device to perform critical tasks such as network discovery and message push normally. This intelligent switching strategy based on usage scenarios takes into account the diverse needs of users in actual use. While ensuring the experience of the main functions, it also takes into account the comprehensive practicality of the device as a multi-functional terminal, so that the screen projection function and other network services of the device achieve good synergy and balance.
[0042] in, Figure 4 This diagram illustrates the Wi-Fi function settings during screen mirroring from a terminal device. The process includes: when the user opens the screen mirroring interface, the terminal device's system immediately disables the Wi-Fi scanning function, and the Wi-Fi management class registers a listener for the Wi-Fi settings interface opening event; during screen mirroring, if the screen mirroring interface switches to the background or the user opens the Wi-Fi settings interface, the Wi-Fi scanning function is enabled to meet the user's network configuration needs; when the screen mirroring interface returns to the foreground or the Wi-Fi settings interface is closed, the system detects the status change through a callback mechanism and then disables the Wi-Fi scanning function again; finally, when the user exits the screen mirroring interface, the Wi-Fi scanning function is fully restored. This complete technical solution achieves dynamic and intelligent management of the Wi-Fi scanning function by establishing a multi-dimensional event listening and response mechanism. Its core value lies in effectively eliminating the periodic interference of background Wi-Fi scanning on screen mirroring data transmission, fundamentally avoiding the resulting regular lag issues, while fully guaranteeing the user's necessary network configuration operation permissions during screen mirroring. Ultimately, it achieves a better balance between screen mirroring smoothness and device functionality, significantly improving the stability of the overall screen mirroring experience and user satisfaction.
[0043] It should be noted that the definition of the second stuttering event and the first stuttering event in this embodiment can be flexibly designed, allowing the system to adapt to different application scenarios and performance requirements. In specific implementations, both can use the same judgment standard (i.e., the first threshold equals the second threshold) or different judgment standards. When the second stuttering event and the first stuttering event use the same judgment standard, it means that the two core processing measures—adjusting playback latency and disabling the Wi-Fi scanning function—work collaboratively based on a unified stuttering judgment benchmark. This collaborative operation mode manifests as follows: when the system detects stuttering that meets the threshold conditions, it simultaneously triggers the latency adjustment mechanism and the Wi-Fi scanning function disabling mechanism, forming a dual protection system that addresses stuttering issues from both the transmission and system levels. Conversely, when the second stuttering event uses a different judgment standard than the first stuttering event, it indicates that these two processing measures operate based on their respective independent judgment systems. This independent operation mode manifests itself in the following way: the system triggers corresponding processing mechanisms based on the different characteristics of the stuttering. For example, for minor stuttering with a reception latency within the range of 60-150ms, only the playback latency adjustment mechanism is activated; while for severe stuttering (reception latency exceeding 150ms) that recurs within a specific time interval (e.g., less than 9.2 seconds), the Wi-Fi scanning function is additionally disabled. This flexible architecture design allows this embodiment to flexibly configure the strictness and response range of the processing strategy according to the needs of actual application scenarios. It can adopt a more lenient collaborative processing mode in latency-sensitive scenarios, or a precise independent processing mode in scenarios with strict requirements for system resource consumption, thereby achieving the design goal of a single solution adapting to diverse application needs.
[0044] In practical applications, the screen mirroring method of this embodiment can be integrated into the operating systems of various terminal devices to form a complete network adaptive solution. For example... Figure 6The adaptive playback delay adjustment decision process shown in the diagram initiates full-process monitoring as soon as the terminal device starts screen mirroring. First, it continuously monitors the reception of real-time streaming data. When a reception delay exceeding 60ms is detected, a stuttering event is identified. Then, the system first distinguishes the severity of the stutter. If the delay reaches the severe stuttering standard of 150ms or more, the Wi-Fi scanning function is disabled to eliminate periodic network interference at the system level. For non-severe stuttering, an intelligent data filtering mechanism is activated. The current stutter duration is compared with the historical average in the cache array. If it exceeds twice the average, the stuttering event is considered an abnormal spike and excluded; otherwise, its duration is added to the cache array to update the historical dataset. After the data update, the system checks if it is within the cooldown period (i.e., the 5-second protection period after the last screen mirroring player adjustment). If not within the cooldown period, the 75th percentile of all stutter durations is extracted from the cache array as the target delay value, and this target delay value is compared with the preset maximum playback delay limit. When the target latency value exceeds the maximum limit, the screen mirroring player is notified to adjust playback to the maximum latency value; when it does not exceed the limit, the screen mirroring player is notified to adjust playback latency according to the target latency value. This complete closed-loop control mechanism, through progressive judgment logic and refined condition filtering, achieves accurate identification and differentiated processing of different types of stuttering. It effectively filters out interference data caused by momentary network anomalies, preventing the system from over-responding, and ensures that the latency parameter settings are accurately matched with the actual network conditions. Ultimately, in complex and ever-changing wireless network environments, it intelligently maintains the optimal balance between screen mirroring experience and real-time operation, providing users with a continuous and stable high-quality screen mirroring service.
[0045] In summary, the method in this embodiment continuously monitors the reception of real-time streaming data by the terminal device during screen mirroring, accurately identifies the first stuttering event where the reception delay exceeds a first threshold, and establishes a real-time perception capability of network conditions. Based on this, using a cache array recording historical stuttering durations, a target delay value that accurately reflects network fluctuation characteristics is determined through statistical analysis, ensuring that the delay setting is both consistent with the current network conditions and supported by historical data. Finally, by dynamically adjusting the playback delay of the screen mirroring player on the terminal device to this target delay value, the playback pace is actively slowed down to match the reception status of real-time streaming data. When network transmission fluctuates, the moderately increased playback delay creates buffer space for subsequent data arrival, allowing the screen mirroring player to render video frames based on real-time streaming data. This effectively eliminates screen jitter, frame skipping, and stuttering caused by untimely data reception from the user's perspective, ensuring smooth video playback while keeping the overall delay within a reasonable range, significantly improving the continuity, stability, and overall visual experience of the screen mirrored image.
[0046] In addition, corresponding to Figure 1 In addition to the method shown, another embodiment of this application also provides a screen projection processing device. Figure 6 This is a structural diagram of the screen projection processing device 600, including: The monitoring module 610 is used to monitor the reception of real-time streaming data by the terminal device during screen projection, so as to detect the first stuttering event; wherein, the first stuttering event refers to the event in which the reception delay of the real-time streaming data exceeds a first threshold.
[0047] The determination module 620 is configured to, in response to the detected first stuttering event, determine a target latency value based on at least one stuttering duration in a cache array, wherein the cache array records the stuttering duration of the first stuttering events detected in the past.
[0048] The adjustment module 630 is used to adjust the playback delay of the screen mirroring player of the terminal device to the target delay value, wherein the target delay value is greater than the initial delay value of the screen mirroring player before adjustment.
[0049] Optionally, the determining module 620 determines a target latency value based on at least one lag duration in the cache array, including: determining the average of all lag durations in the cache array; determining whether the lag duration of the first lag event exceeds a preset multiple of the average; if it does not exceed, adding the lag duration of the first lag event to the cache array, and determining the target latency value based on all lag durations in the updated cache array; if it exceeds, directly determining the target latency value based on all lag durations in the cache array. This technical solution, by introducing a dynamic evaluation mechanism based on historical lag data, can effectively distinguish between occasional, severe network spikes (such as a single severe packet loss) and continuous network fluctuations. By filtering out these abnormal spike values, it can prevent overreaction due to individual extreme lags, thereby avoiding setting unnecessary large delays and making the determined target latency value closer to the real and general conditions of the current network environment.
[0050] Optionally, the determining module 620 determines a target latency value based on at least one stutter duration in the cache array, including: determining the 75th percentile of all stutter durations in the cache array as the target latency value. This technical solution, by employing the 75th percentile as a statistical metric, intelligently balances the smoothness of the video stream with the real-time requirements of the control operation. Compared to directly using the maximum value, the 75th percentile effectively covers the vast majority of common stutter durations, providing sufficient buffering for smooth playback and avoiding setting excessively large buffers due to excessively long delays in a few extreme cases, thus preventing excessively sluggish response from the control operation. Compared to using the average value, the 75th percentile more adequately addresses the mainstream level of network fluctuations, avoiding underestimating latency requirements due to averaging, which could lead to insufficient buffering and stuttering again. This method makes the final determined target latency value more statistically representative and robust, adaptively adapting to the mainstream fluctuation level of the current network conditions, thereby achieving a better balance between eliminating stuttering and maintaining operational responsiveness.
[0051] Optionally, after adjusting the playback delay of the screen mirroring player on the terminal device to the target delay value, the adjustment module 630 is further configured to: activate a first preset cooling-off period; during the cooling-off period, prohibit further adjustment of the playback delay of the screen mirroring player. This technical solution, by introducing a cooling-off period mechanism, effectively prevents the problem of frequent and drastic increases in playback delay value caused by continuous stuttering within a short period. Such frequent adjustments not only keep the system in an unstable "oscillation" state, but also severely impair the real-time performance of the counter-control operation due to the continuous accumulation of delay values, ultimately affecting the user experience. By setting a reasonable cooling-off period (e.g., 5 seconds), the system provides a necessary observation window for the applied delay adjustment strategy, ensuring a relatively stable playback environment, thereby achieving adaptive and smooth stuttering handling.
[0052] Optionally, after adjusting the playback delay of the screen mirroring player on the terminal device to the target delay value, the adjustment module 630 is further configured to: if the first stuttering event is not detected again within a second preset time period, then gradually adjust the playback delay of the screen mirroring player to the initial delay value. This technical solution, by introducing an automatic recovery mechanism, effectively avoids the problem of unnecessarily maintaining a high playback delay level when network conditions temporarily deteriorate and then return to normal. Specifically, after the stuttering risk is eliminated, the playback delay is gradually reduced to minimize the abruptness perceived by the user. This mechanism ensures that the screen mirroring process has bidirectional adaptive capabilities, not only ensuring smooth video playback during network fluctuations but also promptly reducing operational latency when network quality improves, always maintaining the optimal balance between smoothness and responsiveness.
[0053] Optionally, the apparatus of this embodiment further includes: The Wi-Fi management module is used to disable the Wi-Fi scanning function of the terminal device during screen mirroring. This technical solution effectively solves the periodic lag problem caused by the system periodically scanning wireless networks in the background by actively managing the Wi-Fi scanning function. By temporarily disabling non-urgent Wi-Fi scanning tasks, it reduces the contention and occupation of wireless channel resources, ensuring that the screen mirroring data stream transmission has priority access to stable network bandwidth. This preventative measure can significantly reduce network latency fluctuations caused by the system's own behavior, thus preventing such regular lag from occurring at its source.
[0054] Optionally, the Wi-Fi management module disables the Wi-Fi scanning function of the terminal device during screen mirroring. This includes: if a second stuttering event is detected during screen mirroring, and the interval between the detection of the second stuttering event and the last detection of the second stuttering event is less than or equal to a preset interval threshold, then the Wi-Fi scanning function of the terminal device is disabled. The second stuttering event refers to an event where the reception delay of the real-time streaming data exceeds the second threshold. This technical solution, by introducing a conditional judgment mechanism, achieves precise control of the Wi-Fi scanning function, effectively distinguishing between periodic stuttering caused by system background scanning and occasional stuttering caused by other reasons. By setting a reasonable time interval threshold, the Wi-Fi scanning disabling operation is only triggered when a second stuttering event with specific duration characteristics occurs repeatedly. This design significantly improves the accuracy of stuttering cause judgment and avoids unnecessary function disabling due to misjudgment. This mechanism can specifically eliminate regular stuttering problems caused by Wi-Fi scanning, while minimizing interference with other network functions of the system, thereby maintaining a balance between the integrity of the terminal device's network service and the user experience while ensuring smooth screen mirroring.
[0055] Optionally, the Wi-Fi management module is further configured to: when the terminal device is projecting its screen and the Wi-Fi scanning function is disabled, listen for the opening event of the Wi-Fi settings interface of the terminal device; when the Wi-Fi settings interface is detected to be open, enable the Wi-Fi scanning function of the terminal device, and when the Wi-Fi settings interface is detected to be closed, disable the Wi-Fi scanning function of the terminal device again. When the terminal device is projecting its screen and the Wi-Fi scanning function is disabled, listen for the opening event of the Wi-Fi settings interface of the terminal device; when the Wi-Fi settings interface is detected to be open, enable the Wi-Fi scanning function of the terminal device, and when the Wi-Fi settings interface is detected to be closed, disable the Wi-Fi scanning function of the terminal device again; and / or, when the terminal device is projecting its screen, listen for the status of the projecting interface of the terminal device; when the projecting interface is detected to switch from the foreground to the background, enable the Wi-Fi scanning function of the terminal device, and when the projecting interface is detected to switch from the background to the foreground, disable the Wi-Fi scanning function of the terminal device again. This technical solution introduces an intelligent context-aware mechanism to effectively maintain a balance between the integrity of network services on the terminal device and user experience while ensuring smooth screen mirroring. Specifically, by monitoring changes in the Wi-Fi settings interface, it can promptly restore the scanning function when the user actively configures the network to ensure normal network connectivity, and immediately disable the Wi-Fi scanning function again after the settings are complete to continue providing a stable network environment for screen mirroring. Simultaneously, by monitoring the foreground and background states of the screen mirroring interface, it can intelligently restore the Wi-Fi scanning function when the user does not need to view the mirrored content, and disable it again when the user returns to screen mirroring, ensuring continuous optimization of core functions. This dynamic management strategy avoids affecting the user's normal network operation needs by completely disabling Wi-Fi scanning, while minimizing the interference of Wi-Fi scanning on screen mirroring stability, achieving an intelligent balance between screen mirroring performance and device functional integrity.
[0056] In summary, the device in this embodiment continuously monitors the reception of real-time streaming data during screen mirroring on the terminal device, accurately identifies the first stuttering event where the reception delay exceeds a first threshold, and establishes a real-time perception capability of network conditions. Based on this, using a cache array recording historical stuttering durations, a target delay value that accurately reflects network fluctuation characteristics is determined through statistical analysis, ensuring that the delay setting is both consistent with the current network conditions and supported by historical data. Finally, by dynamically adjusting the playback delay of the screen mirroring player on the terminal device to this target delay value, the playback pace is actively slowed down to match the reception status of real-time streaming data. When network transmission fluctuates, the moderately increased playback delay creates buffer space for subsequent data arrival, allowing the screen mirroring player to render video frames based on real-time streaming data. This effectively eliminates screen jitter, frame skipping, and stuttering caused by untimely data reception from the user's perspective, ensuring smooth video playback while keeping the overall delay within a reasonable range, significantly improving the continuity, stability, and overall visual experience of the screen mirrored image.
[0057] It should be noted that the specific methods by which each module performs its operation in the screen projection processing device described in the above embodiments have been described in detail in the embodiments of the method, and will not be elaborated here.
[0058] In addition, another embodiment of this application provides an electronic device. Figure 7 This is a schematic diagram of the electronic device, including a memory 701 and a processor 702. The memory 701 stores executable program code 7011, and the processor 702 is used to call and execute the executable program code 7011 to perform the electronic device control method provided in the above embodiment. The corresponding steps include: The system monitors the reception of real-time streaming data during screen mirroring to detect a first stuttering event; wherein the first stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds a first threshold.
[0059] In response to the detected first stuttering event, a target latency value is determined based on at least one stuttering duration in a cache array, the cache array recording the stuttering duration of the first stuttering events detected in the past.
[0060] Adjust the playback delay of the screen mirroring player on the terminal device to the target delay value, where the target delay value is greater than the initial delay value of the screen mirroring player before adjustment.
[0061] This embodiment can divide the electronic device into functional modules according to the above method example. For example, each module can correspond to a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0062] When each functional module is divided according to its corresponding function, the electronic device may include: a monitoring module, a determining module, and an adjusting module. It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional descriptions of the corresponding functional modules, and will not be repeated here.
[0063] In this embodiment, the electronic device continuously monitors the reception of real-time streaming data during screen mirroring, accurately identifying the first stuttering event where the reception delay exceeds a first threshold, thus establishing a real-time perception capability of network conditions. Based on this, using a cache array recording historical stuttering durations, a target delay value that accurately reflects network fluctuation characteristics is determined through statistical analysis, ensuring that the delay setting is both consistent with current network conditions and supported by historical data. Finally, by dynamically adjusting the playback delay of the screen mirroring player on the terminal device to this target delay value, the playback pace is actively slowed down to match the reception status of real-time streaming data. When network transmission fluctuates, the moderately increased playback delay creates buffer space for subsequent data arrival, allowing the screen mirroring player to render video frames based on real-time streaming data. This effectively eliminates screen jitter, frame skipping, and stuttering caused by untimely data reception from the user's perspective, ensuring smooth video playback while keeping the overall delay within a reasonable range, significantly improving the continuity, stability, and overall visual experience of the screen mirrored image.
[0064] When using integrated units, the electronic device may include a processing module and a storage module. The processing module is used to control and manage the operation of the electronic device. The storage module is used to support the execution of program code and data by the electronic device.
[0065] The processing module may be a processor or a controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and microprocessors, etc., and the storage module may be a memory.
[0066] Furthermore, another embodiment of this application provides a computer-readable storage medium storing computer program code. When the computer program code is executed on a computer, the computer performs the aforementioned method steps to implement the screen projection method provided in the above embodiments, which includes the following steps: The system monitors the reception of real-time streaming data during screen mirroring to detect a first stuttering event; wherein the first stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds a first threshold.
[0067] In response to the detected first stuttering event, a target latency value is determined based on at least one stuttering duration in a cache array, the cache array recording the stuttering duration of the first stuttering events detected in the past.
[0068] Adjust the playback delay of the screen mirroring player on the terminal device to the target delay value, where the target delay value is greater than the initial delay value of the screen mirroring player before adjustment.
[0069] The beneficial effects of the above embodiments can be referred to the beneficial effects of the corresponding methods provided above, and will not be repeated here.
[0070] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0071] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0072] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0073] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A screen mirroring processing method, characterized in that, include: The system monitors the reception of real-time streaming data during screen mirroring to detect a first stuttering event; wherein, the first stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds a first threshold. In response to the detected first stuttering event, a target latency value is determined based on at least one stuttering duration in a cache array, wherein the cache array records the stuttering duration of the first stuttering events detected in the past. Adjust the playback delay of the screen mirroring player on the terminal device to the target delay value, where the target delay value is greater than the initial delay value of the screen mirroring player before adjustment.
2. The method according to claim 1, characterized in that, The target latency value is determined based on at least one stutter duration in the cache array, including: Determine the average duration of all stutters in the cache array; Determine whether the duration of the first stuttering event exceeds a preset multiple of the average value; If the delay is not exceeded, the delay duration of the first delay event is added to the cache array, and the target delay value is determined based on all delay durations in the updated cache array. If the value exceeds the limit, the target latency value is determined directly based on all the stutter durations in the cache array.
3. The method according to claim 1, characterized in that, The target latency value is determined based on at least one stutter duration in the cache array, including: The 75th percentile of all stutter durations in the cache array is determined as the target latency value.
4. The method according to claim 1, characterized in that, After adjusting the playback delay of the screen mirroring player on the terminal device to the target delay value, the method further includes: Activate the first preset cooldown period; During the cooling-off period, it is prohibited to adjust the playback delay of the screen mirroring player again.
5. The method according to claim 1, characterized in that, After adjusting the playback delay of the screen mirroring player on the terminal device to the target delay value, the method further includes: If the first stuttering event is not detected again within the second preset time period, the playback delay of the screen mirroring player is gradually adjusted to the initial delay value.
6. The method according to claim 1, characterized in that, Also includes: During the screen mirroring process of the terminal device, the Wi-Fi scanning function of the terminal device is disabled.
7. The method according to claim 6, characterized in that, Disabling the Wi-Fi scanning function of the terminal device during screen mirroring includes: During the screen mirroring process of the terminal device, if a second stuttering event is detected, and the interval between the detection of the second stuttering event and the last detection of the second stuttering event is less than or equal to a preset interval threshold, the Wi-Fi scanning function of the terminal device is disabled; wherein, the second stuttering event refers to an event in which the reception delay of the real-time streaming data exceeds the second threshold.
8. The method according to claim 6, characterized in that, Also includes: When the terminal device is projecting its screen and the Wi-Fi scanning function is disabled, listen for the opening event of the Wi-Fi settings interface of the terminal device; When the Wi-Fi settings interface is detected to be open, the Wi-Fi scanning function of the terminal device is enabled, and when the Wi-Fi settings interface is detected to be closed, the Wi-Fi scanning function of the terminal device is disabled again. And / or, When the terminal device is casting its screen, the status of the casting interface of the terminal device is monitored; when the casting interface is detected to switch from the foreground to the background, the Wi-Fi scanning function of the terminal device is enabled, and when the casting interface is detected to switch from the background to the foreground, the Wi-Fi scanning function of the terminal device is disabled again.
9. An electronic device, comprising: processor; And a memory arranged to store computer-executable instructions, characterized in that, when executed, the executable instructions cause the processor to perform the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the method as described in any one of claims 1 to 8.