Media play control method and apparatus
By detecting the interface status, the terminal device can decide whether to pause the operation of media applications when switching to the background, which solves the interference problem when switching from media applications to other applications in the screen-off state, improves the user experience and saves power.
Patent Information
- Application Number
- CN202210692226.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-06-17
AI Technical Summary
In existing technologies, when a media application plays music while the screen is off, the audio may interfere with other applications when the user switches to them, resulting in a degraded user experience.
The terminal device detects the interface status to determine whether the conditions are met. If they are met, the media application is switched to the background and kept running. Otherwise, the media application is paused.
It saves power while preventing interference between multiple applications, thus improving the user experience.
Smart Images

Figure CN114969399B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a media playing control method and device BACKGROUND
[0002] Nowadays, when the media application of the smart phone, tablet computer and other smart devices runs for a long time, the screen is always in the normal light state, which occupies most of the power consumption. In some cases, the user may not need to watch the device screen all the time or is only interested in the audio, so the screen can be turned off to save power consumption while ensuring the normal operation of the media application.
[0003] The prior art implementation has realized the media application playing in the off-screen state, but at the same time, when the user switches from the media application to other applications in the normal light state, the media application in the background is still in the playing state, and its audio may have a certain impact on the use of other applications, resulting in a decline in user experience. SUMMARY
[0004] The embodiment of the present application provides a media playing control method and device, when the terminal device switches the media application from the foreground to the background, whether to pause the running of the media application is determined according to the interface state, so as to save the power or prevent the mutual interference between multiple applications.
[0005] In a first aspect, the embodiment of the present application provides a media playing control method, comprising:
[0006] determining the interface state of the terminal device after the first operation of triggering the state switching command is executed, the state switching command being used to indicate that the media application running in the foreground of the terminal device is switched to the background;
[0007] judging whether the interface state meets the first condition;
[0008] if the interface state meets the first condition, the media application is switched to the background and the running state of the media application is kept unchanged;
[0009] if the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to the pause state.
[0010] In an implementation manner, the judging whether the interface state meets the first condition comprises:
[0011] if the screen state of the terminal device is the off-screen state and the running state of the media application is the playing state, it is determined that the interface state meets the first condition.
[0012] In an implementation, the determining that the screen state is the screen-off state comprises:
[0013] calling a screen detection process, the screen detection process being configured to detect the screen state and return a first return value, the first return value comprising: a first state value or a second state value, the first state value being configured to indicate that the screen state is a screen-on state or a lock screen state, the second state value being configured to indicate that the screen state is a screen-off state;
[0014] receiving the first return value;
[0015] if the first return value is the second state value, determining that the screen state is the screen-off state.
[0016] In an implementation, the switching the media application to the background and keeping the running state of the media application unchanged if the interface state meets the first condition comprises:
[0017] if the screen state is the screen-off state and the running state is the playing state, switching the media application to the background and disabling a running of a play-pause process;
[0018] wherein the play-pause process is configured to set the running state of the media application to the pause state.
[0019] In an implementation, the judging whether the interface state meets a first condition comprises:
[0020] if a screen state of the terminal device is a lock screen state and the running state of the media application is a playing state, determining that the interface state meets the first condition.
[0021] In an implementation, the determining that the screen state is the lock screen state comprises:
[0022] calling a screen detection process and an input detection process, the input detection process being configured to detect the screen state and return a second return value, the second return value comprising: a third state value or a fourth state value, the third state value being configured to indicate that the screen state is a screen-off state or the lock screen state, the fourth state value being configured to indicate that the screen state is a screen-on state
[0023] receiving the first return value and the second return value of the screen detection process,
[0024] if the first return value is the first state value and the second return value is the third state value, determining that the screen state is the lock screen state.
[0025] In one implementation, if the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to a pause state, including:
[0026] If the screen state is a constant light state and the running state is the playing state, the media application is switched to the background and a playing-pause process is run to set the running state of the media application to the pause state.
[0027] In a second aspect, an embodiment of the present application provides a video playing control device, including:
[0028] A determining module is configured to determine an interface state of a terminal device after a first operation triggering a state switching command is executed, the state switching command being used to instruct a media application running in a foreground of the terminal device to be switched to a background;
[0029] A judging module is configured to judge whether the interface state meets a first condition;
[0030] A switching module is configured to, if the interface state meets the first condition, switch the media application to the background and keep the running state of the media application unchanged;
[0031] The switching module is further configured to, if the interface state does not meet the first condition, switch the media application to the background and set the running state of the media application to a pause state.
[0032] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0033] At least one processor; and
[0034] At least one memory connected with the processor, wherein:
[0035] The memory stores program instructions executable by the processor, and the processor invoking the program instructions can execute the method provided in the first aspect.
[0036] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, including stored program, wherein when the program runs, the computer readable storage medium controls a device where the computer readable storage medium is located to execute the method provided in the first aspect.
[0037] In the embodiment of the present application, the first operation of determining the interface state of the terminal device after the trigger state switching command is executed is performed, the state switching command is used to indicate switching the media application running in the foreground of the terminal device to the background, the interface state is judged whether to meet the first condition, if the interface state meets the first condition, the media application is switched to the background and the running state of the media application is kept unchanged, if the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to the pause state. When the media application is switched from the foreground to the background, the running of the media application is determined whether to be paused according to the interface state, so as to save the power or prevent the mutual interference between the multiple applications. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, hereinafter, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.
[0039] Figure 1 The flow chart of the media playing control method provided by the embodiment of the present application;
[0040] Figure 2 The flow chart of another media playing control method provided by the embodiment of the present application;
[0041] Figure 3 The structural schematic diagram of the media playing control device provided by the embodiment of the present application;
[0042] Figure 4 The structural schematic diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to better understand the technical solutions of the present application, the embodiments of the present application will be described in detail below with reference to the drawings.
[0044] It should be clear that the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort are within the scope of protection of the present application.
[0045] The terms used in the embodiments of the present application are only for the purpose of describing the specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0046] Figure 1 A flow chart of a media playing control method is provided in the embodiments of the present application. The method can be applied to a terminal device such as a smart phone or a tablet computer, as shown in the figure, the method can include: Figure 1
[0047] Step 101, determining the interface state of the terminal device after the first operation triggering the state switching command is executed, the state switching command is used to indicate switching the media application running in the foreground of the terminal device to the background.
[0048] In the embodiments of the present application, the media application includes the application of the terminal device such as video software or audio software. After the media application is started, it will first run in the foreground of the terminal device (i.e. displayed in the front interface of the terminal device), when the terminal device detects some specific operations of the user, it will switch the media application running in the foreground to the background. For example, the user performs the screen-off operation or the lock screen operation by pressing the power key, or the user performs the return to the home screen operation by pressing the home screen key, or the user performs the application switching operation by screen sliding. The above-mentioned operations can be used as the first operation capable of triggering the state switching command. Optionally, the terminal device can set a listening process inside, when the above-mentioned first operation is detected, the state switching command is sent.
[0049] Step 102, judging whether the interface state meets the first condition.
[0050] When the terminal device detects that the state switching command is triggered, it detects the current interface state and judges whether the interface state meets the first condition.
[0051] In specific embodiments, the step of judging whether the interface state meets the first condition can include: if the screen state of the terminal device is the screen-off state and the running state of the media application is the playing state, it is determined that the interface state meets the first condition; if the screen state of the terminal device is the lock screen state and the running state of the media application is the playing state, it is determined that the interface state meets the first condition. It can be understood that if the first operation triggering the state switching command is the lock screen operation, when the terminal device determines that the state switching command is triggered and detects the interface state, it can detect that the screen state is the lock screen state; if the first operation triggering the state switching command is the screen-off operation, when the terminal device determines that the state switching command is triggered and detects the interface state, it can detect that the screen state is the screen-off state. The terminal device can determine whether the first operation making the media application switch to the background is the screen-off operation or the lock screen operation through the interface state.
[0052] Further, the terminal device can determine the screen state by calling a screen detection process and / or an input detection process. The screen detection process returns a first return value after running, and the first return value includes a first state value or a second state value. The first state value is used to indicate that the screen state is a constant state or a lock screen state, and the second state value is used to indicate that the screen state is an off screen state. The input detection process returns a second return value after running, and the second return value includes a third state value or a fourth state value. The third state value is used to indicate that the screen state is an off screen state or a lock screen state, and the fourth state value is used to indicate that the screen state is a constant state. It can be understood that the terminal device can directly determine whether the screen state is an off screen state through the screen detection process. After receiving the first return value, if it is determined that the first return value is the second state value, it is determined that the screen state is an off screen state, otherwise, it is a constant state or a lock screen state. The lock screen state needs to be determined by combining the screen detection process and the input detection process. If the first return value is the first state value and the second return value is the third state value, it is determined that the screen state is a lock screen state.
[0053] In specific embodiments, if the terminal device is loaded with an Android system, the screen detection process can be implemented by using an isInteractive method provided by the Android system, and the input detection process can be implemented by using an inKeyguardRestrictedInputMode method provided by the Android system.
[0054] In step 103, if the interface state meets the first condition, the media application is switched to the background and the running state of the media application is kept unchanged.
[0055] In step 104, if the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to a pause state.
[0056] In the embodiments of the present application, the terminal device can switch the media application from the foreground to the background by using a life cycle callback method. The life cycle callback method varies in different applications. For example, the media application adds a play / pause process, which is used to switch the media application to the background and set the running state of the media application to a pause state.
[0057] In specific embodiments, the following cases can be included: (1) if the terminal device detects that the screen state is the off state and the running state of the media application is the playing state, the media application is switched to the background and the running of the playing pause process is prohibited. (2) if the terminal device detects that the screen state is the lock state and the running state of the media application is the playing state, the media application is switched to the background and the running of the playing pause process is prohibited. (3) if the terminal device detects that the screen state is the always-on state and the running state of the media application is the playing state, the media application is switched to the background and the running state of the media application is set to the pause state. It can be understood that when the media application runs in the foreground and is in the playing state, if the user changes the screen state of the terminal device to the lock state or the off state, it can be determined that the user wants the media application to run while the screen is turned off to save power. Therefore, when the terminal device switches the media application to the background, the running state of the media application is kept unchanged. If the user switches the media application to the background by returning to the home screen or starting other applications while the screen is always on, it can be determined that the user wants to pause the interaction with the media application. For example, a video application first runs in the foreground of the terminal device, at a certain moment, a chat message pops up on the top of the screen of the terminal device, the user clicks the message to enter the corresponding chat application, at this moment, the above-mentioned video application is switched to the background. When the terminal device switches the video application to the background, the running state of the video application is set to the pause state to prevent the audio of the video application from affecting the viewing of the chat message, and also to avoid the invalid playing of the video application.
[0058] In the embodiments of the present application, the terminal device first determines the interface state after the first operation triggering the state switching command is executed, then judges whether the interface state meets the first condition, if the interface state meets the first condition, the media application is switched to the background and the running state of the media application is kept unchanged, if the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to the pause state. When the media application is switched from the foreground to the background, whether to pause the running of the media application is determined according to the interface state, so as to save power or prevent mutual interference between multiple applications.
[0059] Figure 2 A flowchart of another media playing control method provided by the embodiments of the present application is shown in FIG. 8. As shown in FIG. 8, the method can include: Figure 2
[0060] Step 201, receiving a state switching command.
[0061] Step 202, executing the onPause method.
[0062] Step 203, obtaining an interface state.
[0063] Step 204, executing the onstop method.
[0064] The onpause method and the onstop method in the embodiment of the application are two methods in the life cycle callback method, and are used for switching the application running in the foreground of the terminal device to the background. Generally, the onpause method and the onstop method are executed in sequence, the onpause method can make the foreground application lose the focus, and the onstop method can make the application losing the focus further become invisible (i.e. running in the background). The method of the embodiment of the application adds the step of obtaining the interface state 203 between the onpause method and the onstop method, and adds the logical judgment after executing the onstop method.
[0065] Step 205, determining whether the interface state meets the first condition, if yes, entering step 206, otherwise entering step 207.
[0066] Step 206, not changing the running state of the media application.
[0067] Switching the media application to the background and keeping the running state of the media application unchanged.
[0068] Step 207, setting the media application to the pause state.
[0069] Switching the media application to the background and setting the running state of the media application to the pause state.
[0070] The method obtains the interface state before executing the onstop method and makes the logical judgment according to the interface state during the execution of the onstop method, so as to determine whether to change the running state of the media application, which can realize the effects of saving the electric energy or preventing the mutual interference between multiple applications.
[0071] The following further illustrates the flow chart by specific embodiments. Scene one: user A is playing a video through a smart phone (i.e. the video application is running in the foreground and in a playing state at this moment), if user A performs a screen-off operation at a certain moment when the video is continuously playing, the smart phone will sequentially execute the onPause method and the onStop method. After executing the onPause method, the smart phone will acquire the interface state at this moment through the isInteractive method and the inKeyguardRestrictedInputMode method, and can determine that the screen state is a screen-off state and the video application is in a playing state, which meets the first condition. Based on the above determination, the smart phone will not change the running state of the video application during the execution of the onStop method, so as to achieve the purpose of playing the video in the screen-off state. Scene two: user B starts the audio application of the smart phone to play music, and the audio application is running in the foreground of the smart phone and in a playing state. If user B needs to interact with other applications, the audio application needs to be switched to the background. The smart phone acquires the interface state and determines that the screen state is a constant state and the audio application is in a playing state at this moment. Then, when the smart phone switches the audio application to the background, the music playing is paused, so as to avoid that the audio application interferes with user B when user B views other applications.
[0072] Figure 3 A structure schematic diagram of a media playing control device provided by an embodiment of the present application is shown. The device can be a specific equipment to realize the media playing control method provided by the embodiment of the present application. As shown in the figure, the device can include: Figure 3
[0073] A determining module 301 is configured to determine the interface state of the terminal device after a first operation triggering a state switching command is executed, and the state switching command is used to instruct to switch a media application running in the foreground of the terminal device to the background.
[0074] A judging module 302 is configured to judge whether the interface state meets a first condition.
[0075] A switching module 303 is configured to switch the media application to the background and keep the running state of the media application unchanged if the interface state meets the first condition.
[0076] The switching module 303 is further configured to switch the media application to the background and set the running state of the media application to a pause state if the interface state does not meet the first condition.
[0077] Figure 4 A structure schematic diagram of an electronic device provided by an embodiment of the present application is shown. Figure 4 The electronic device shown is only an example, and should not bring any limitation to the function and use range of the embodiment of the present application.
[0078] like Figure 4 As shown, the electronic device is represented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: one or more processors 410, memory 430, and communication bus 440 connecting different system components (including memory 430 and processor 410).
[0079] Communication bus 440 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MAC) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0080] Electronic devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, and removable and non-removable media.
[0081] Memory 430 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Although Figure 4A disk drive, a floppy disk drive, and / or other mass storage device can be provided (and a corresponding computer-readable media connection can be provided) in communication with bus 440 for reading from and writing to a removable, nonvolatile magnetic floppy disk (e.g., a "floppy disk"), and to a removable, nonvolatile optical disk, such as an optical compact disk read-only memory (CD-ROM), digital video disk (DVD), or other optical media. In these instances, each drive can be connected to bus 440 by one or more data media interfaces. The memory 430 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
[0082] Program / utility, having a set (at least one) of program modules, can be stored in memory 430, for example, include an operating system, one or more application programs, other program modules, and program data, each or some combination thereof, may
[0083] The electronic device can also communicate with one or more external devices 480 that can or can not be part of the electronic device. Also, the electronic device can communicate with one or more devices that enable user interaction with the electronic device (e.g., a display, a speaker, a keyboard, a keypad, a mouse, a pen, a voice recognition and / or biometric mechanism, etc.). Communication with one or more of these devices can occur through the communication interface(s) 420. Additionally, the electronic device can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or the Internet) through the network adapter 460. Figure 4 (Not shown in FIG. 4.) The network adapter 460 can also be used to enable communication between the electronic device and one or more devices remotely located from the electronic device. The network adapter 460 can communicate with the other Figure 4 (Not shown in FIG. 4.) Other hardware and / or software modules can be used in conjunction with the electronic device 400. Such hardware and / or software modules can include, but are not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0084] The processor 410 can execute the various components of the media playback control method provided by embodiments of the application by running programs stored in the memory 430.
[0085] The embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the computer instructions make the computer execute the media playing control method provided by the embodiment of the present application.
[0086] The computer readable storage medium can adopt any combination of one or more computer readable mediums. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example but not limited to, an electrical, a magnetic, an optical, an electromagnetic, an infrared, or a semiconductor system, device or apparatus, or any combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer readable storage medium can be any tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus or device.
[0087] The computer readable signal medium can include a data signal traveling in baseband or an analog carrier wave traveling in the baseband, in which computer readable program code is contained. This data signal can take many forms, including but not limited to, electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport program for use by or in connection with an instruction execution system, apparatus, or device.
[0088] The program code contained in the computer readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the above.
[0089] In the description of the specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the specification and the features of the different embodiments or examples, without contradiction.
[0090] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise specifically limited.
[0091] Any process or method descriptions in flow charts or otherwise described herein can be understood as representing code modules, segments, or portions of code that include one or more executable instructions for implementing specific logic functions (or steps) in the process, and the various embodiments of the present application include additional implementations in which the order of steps can be different, including use of simultaneous processes, or the steps can be performed in reverse order, or with additional steps, or with additional processes, or with fewer steps, or with fewer processes, and the like, without departing from the scope of the present application.
[0092] In several embodiments provided by the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the above-described device embodiments are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0093] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The above integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0094] The above description is only the preferred embodiment of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of protection of the present application.
Claims
1. A media playback control method, characterized in that, The method includes: The interface state of the terminal device is determined after the first operation that triggers the state switching command is executed. The state switching command is used to indicate that the media application running in the foreground of the terminal device is switched to the background. Determine whether the interface state meets the first condition; If the interface state meets the first condition, the media application is switched to the background and the running state of the media application remains unchanged. If the interface state does not meet the first condition, the media application is switched to the background and the running state of the media application is set to paused. The step of determining whether the interface state meets the first condition includes: If the screen of the terminal device is in a screen-off state and the media application is in a playback state, then the interface state is determined to meet the first condition. If the screen state of the terminal device is locked and the running state of the media application is playback, then the interface state is determined to meet the first condition. The determination of the terminal device's interface state after the first operation of the trigger state switching command is executed includes: obtaining the current interface state through the screen detection process isInteractive and the input detection process inKeyguardRestrictedInputMode provided by the Android system; The step of switching the media application to the background and setting the running state of the media application to a paused state includes: switching the media application to the background and setting the running state of the media application to a paused state through a lifecycle callback method.
2. The method according to claim 1, characterized in that, Determining the screen state as the screen-off state includes: The screen detection process is invoked to detect the screen state and return a first return value. The first return value includes a first state value or a second state value. The first state value is used to indicate that the screen state is always on or locked, and the second state value is used to indicate that the screen state is off. Receive the first return value; If the first return value is the second status value, then the screen status is determined to be the screen-off state.
3. The method according to claim 1, characterized in that, If the interface state meets the first condition, then switching the media application to the background while maintaining the running state of the media application unchanged includes: If the screen state is the off state and the running state is the playback state, then the media application is switched to the background and the playback pause process is prohibited. The playback pause process is used to set the running state of the media application to the paused state.
4. The method according to claim 1, characterized in that, Determining the screen state as the locked screen state includes: The screen detection process and the input detection process are invoked. The input detection process is used to detect the screen state and return a second return value. The second return value includes a third state value or a fourth state value. The third state value is used to indicate that the screen state is a screen-off state or a screen-locked state. The fourth state value is used to indicate that the screen state is a always-on state. Receive the first return value and the second return value of the screen detection process; If the first return value is the first state value and the second return value is the third state value, then the screen state is determined to be the locked screen state.
5. The method according to claim 1, characterized in that, If the interface state does not meet the first condition, then switching the media application to the background and setting the running state of the media application to a paused state includes: If the screen state is always on and the running state is the playback state, then the media application is switched to the background and the playback pause process is run to set the running state of the media application to the pause state.
6. A video playback control device, characterized in that, The device includes: The determination module is used to determine the interface state of the terminal device after the first operation that triggers the state switching command is executed. The state switching command is used to indicate that the media application running in the foreground of the terminal device is switched to the background. The judgment module is used to determine whether the interface state meets the first condition; The switching module is used to switch the media application to the background and keep the running state of the media application unchanged if the interface state meets the first condition. The switching module is further configured to switch the media application to the background and set the running state of the media application to a paused state if the displayed interface state does not meet the first condition. The determination module is specifically used to determine that the interface state meets the first condition if the screen state of the terminal device is off and the running state of the media application is in playback state; and to determine that the interface state meets the first condition if the screen state of the terminal device is locked and the running state of the media application is in playback state. The determination of the terminal device's interface state after the first operation of the trigger state switching command is executed includes: obtaining the current interface state through the screen detection process isInteractive and the input detection process inKeyguardRestrictedInputMode provided by the Android system; The step of switching the media application to the background and setting the running state of the media application to a paused state includes: switching the media application to the background and setting the running state of the media application to a paused state through a lifecycle callback method.
7. An electronic device, characterized in that, include: At least one processor; as well as At least one memory communicatively connected to the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can invoke the program instructions to perform the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Music play control method and apparatus as well as mobile terminal
CN105843522A
Method for pausing activities in page when browser window is switched
CN107665257A