System-level global media playing control method and device

By accessing pre-configured files at the system framework layer to generate media controllers, the problem of inaccurate audio focus control and state confusion in the Android system is solved, realizing unified control of global application media and improving user experience.

CN121000930APending Publication Date: 2025-11-21BEIJING XUEDIRUANJIAN DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511157168.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

The existing Android system's audio focus control is not precise enough, improper handling of headphone button events leads to state confusion and audio system disorder, and the media state cannot be effectively controlled when switching audio channels to call mode.

Method used

By accessing pre-configured files through the system framework layer, a media controller is generated. Based on the running status and control conditions, control commands are sent to achieve unified control over global application media, including a whitelist of applications and time and status control conditions.

Benefits of technology

It enables precise control over global application media, avoids audio system disorder, improves user experience, and ensures unified management of media status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121000930A_ABST
    Figure CN121000930A_ABST
Patent Text Reader

Abstract

The invention provides a system-level global media playing control method and device, and the method comprises the steps: responding to the obtaining of a starting system control instruction, accessing a pre-configuration file, and enabling the system control instruction to represent that a system frame layer controls the operation of each application media, the pre-configuration file at least records a management and control condition and a management and control effect needing to be realized; on the basis of the pre-configuration file, when it is determined that the current scene meets the control condition, obtaining a session identifier of the application media; generating a corresponding media controller in combination with the session identifier of the application media, wherein the media controller is used for acquiring the running state of the application media and performing running control on the application media; obtaining the current running state of the application media through the media controller; when the application media are target application media needing to be managed and controlled, a matched control instruction is determined based on the running state and the management and control effect; and sending a control instruction to the target application media through the media controller.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of system-level audio control, and in particular to a system-level global media playback control method and device. BACKGROUND

[0002] The Android system native MediaSession architecture design provides a way to interact with audio and video players.

[0003] The MediaSession maintains the state of the player state (play / pause), and the MediaSession can receive the callback interface of the media controller, and the response logic of the callback implemented in the application layer remains consistent.

[0004] Server: the application can build a MediaSession session in the service class, and implement the mediaSession.setCallback callback method to receive control instructions from the outside, implement the control of the associated player, and call back the corresponding state.

[0005] Client: through the system mediaSessionManager, the corresponding MediaController of the server can be traversed, the MediaController method getTransportControls (get control link flow) gets TransportControls, calls the corresponding play, pause, stop, skipToNext method to communicate with the server MediaSession session, and controls the corresponding player by the corresponding MediaSession, thereby realizing media playback control.

[0006] Among them, the MediaSession is an instantiation constructor, which creates a corresponding system Session in the constructor through the MediaSessionManager, and generates a corresponding unique SessionToken (session identifier), and generates a corresponding media controller MediaController according to the unique SessionToekn;

[0007] The MedaiSessionManager creates a corresponding MediaSessionRecord (media session record) instance according to the information of the current application, and the MediaSessionRecord contains unique SessionToken information and application information corresponding to the created Session.

[0008] The MediaSessionRecord instance is saved by a MediaSessionStack after being created.

[0009] Based on the above, the applicant finds that the existing application media control system for audio playing has the following disadvantages:

[0010] 1. Audio focus: the audio focus is open to applications, and there are few references to strictly follow the audio focus mechanism, and there is a possibility of long-term holding without release, which cannot guarantee accurate system control.

[0011] 2. Simulate earphone key event sending: some wire control earphones only provide a unique pause button to realize the cycle control of playing / pausing media, and the application receives the earphone event, which cannot correctly distinguish the playing / pausing state, resulting in state disorder.

[0012] 3. The system power module indirectly holds the AudioMix lock of the AudioServer process (Android system audio process) in the playing state of the application to disable and release resources: this scheme will cause audio system disorder, the hardware audio system cannot keep synchronization, and the AudioMix lock will always be kept in the continuous flush process of audio data, resulting in still unable to normally disable and release.

[0013] 4. Switching the audio channel to the call mode: switching to the call mode will mute the media playing, but cannot control the state of the media. SUMMARY

[0014] To solve the above technical problems, the embodiments of the present application provide a system-level global media playing control method, comprising:

[0015] In response to obtaining a system control instruction, accessing a pre-configuration file, the system control instruction representing the control of the running of each application media by the system framework layer, and the pre-configuration file recording at least a control condition and a control effect to be achieved;

[0016] Based on the pre-configuration file, if the current scene meets the control condition, obtaining the session identifier of the application media;

[0017] Generating a corresponding media controller in combination with the session identifier of the application media, the media controller being used to obtain the running state of the application media and to control the running of the application media;

[0018] Obtaining the current running state of the application media through the media controller;

[0019] determining a matched control instruction based on the running state and the control effect when the application media is a target application media that needs to be controlled;

[0020] sending the control instruction to the target application media through the media controller.

[0021] In an embodiment, the method further comprises:

[0022] obtaining input control requirement information, the control requirement information being used to describe a scenario that needs to be controlled and a control effect that needs to be achieved;

[0023] generating the control condition based on the control requirement information, the control condition being used to describe scenario information that needs to be controlled.

[0024] writing the control condition and the control effect into the pre-configuration file.

[0025] In an embodiment, the method further comprises:

[0026] obtaining a white list of applications, the white list of applications including application information that is not subject to the control condition;

[0027] writing the white list of applications into the pre-configuration file.

[0028] In an embodiment, the control condition comprises:

[0029] a time control condition, including a time range in which the system layer framework needs to start and maintain control over the application media;

[0030] a state control condition, including a device state in which the system layer framework needs to start and maintain control over the application media, the device state at least including a target application being in a running state and a system being in a target mode.

[0031] In an embodiment, determining that a current scenario satisfies the control condition based on the pre-configuration file comprises:

[0032] determining a control condition based on the pre-configuration file;

[0033] in response to the control condition being a time control condition, configuring a system clock based on the time range, so that the system clock is automatically triggered at a start time and an end time of the time range;

[0034] setting a first media control flag, a state value of the first media control flag being used to represent whether the system framework layer implements control, and the state value of the first media control flag being matched and replaced according to a clock broadcast output by the system when the system clock is triggered.

[0035] In response to the triggering of the system clock at the start time, determine whether the state value of the first media control flag is the target value;

[0036] If so, then the current scenario is determined to meet the control conditions.

[0037] In one embodiment, determining that the current scenario meets the control conditions based on the pre-configuration file includes:

[0038] The control conditions are determined based on the pre-configuration file;

[0039] In response to the control condition being a state control condition, a second media control flag is set. The state value of the second media control flag is used to characterize whether the system framework layer implements control. The state value of the second media control flag is matched and written by the target application according to its own running state, or matched and written by the system framework layer according to the monitoring result of the running state of the target mode.

[0040] In response to the target value being the status value of the second media control flag, it is determined that the current scenario meets the control conditions.

[0041] In one embodiment, obtaining the session identifier of the application media includes:

[0042] Access the media session record of the application media, wherein the media session record includes the session identifier of the application media and the corresponding application name;

[0043] The session identifier of the application media is obtained based on the media session record;

[0044] The step of generating a corresponding media controller by combining the session identifier of the application media includes:

[0045] The application media's session identifier is instantiated by combining the media session record, and a corresponding media controller is generated. The media controller records the session identifier, application name, running logic for obtaining the application media's running status, and running logic for obtaining the application media's control link to send control commands based on the controlled link.

[0046] In one embodiment, when the application media is a target application media that needs to be controlled, determining a matching control command based on the operating state and the control effect includes:

[0047] When it is determined that the application media needs to be managed based on the operating status and management effect, the application name corresponding to the application media is obtained through the media controller.

[0048] determining whether the application name is recorded in the whitelist application list;

[0049] if the application name is not recorded in the whitelist application list, determining that the application media is a target application media to be controlled;

[0050] determining a matched control instruction based on the running state and the control effect, the control instruction at least including pausing playing and reducing volume to a target value.

[0051] In an embodiment, the method further comprises:

[0052] recording the control instruction, the corresponding application name, and the running parameter before control, the application name being obtained based on the media controller in which the application name is recorded;

[0053] in response to a change of the scene, the control condition being released, a recovery instruction being generated based on the recorded information, the recovery instruction being used to restore the running state of the application media to a state before control;

[0054] sending the recovery instruction to the target application media through the media controller.

[0055] Another embodiment of the application simultaneously provides a system-level global media playing control device, characterized in that comprising:

[0056] a first response module, used for accessing a pre-configuration file in response to obtaining a system control instruction, the system control instruction representing control of running of each application media by a system framework layer, the pre-configuration file at least recording a control condition and a control effect to be achieved;

[0057] a first determination module, used for obtaining a session identifier of the application media based on the pre-configuration file in a case that a current scene satisfies the control condition;

[0058] a generation module, used for generating a corresponding media controller in combination with the session identifier of the application media, the media controller being used for obtaining a running state of the application media and performing running control on the application media;

[0059] a first obtaining module, used for obtaining the current running state of the application media through the media controller;

[0060] a second determination module, used for determining a matched control instruction based on the running state and the control effect in a case that the application media is a target application media to be controlled;

[0061] a sending module, used for sending the control instruction to the target application media through the media controller.

[0062] Based on the above, the application embodiment has the beneficial effects including that the media running of the global application can be controlled through the system framework layer, that is, the media of the global application is uniformly controlled by the system framework layer, the system framework layer can accurately control according to the user's pre-set control requirements and the specific running state of the application media, and ensure that the user's required control effect can be achieved through control, so that the over-customization of the audio framework layer and the low-precision control implemented by the user through blind pressing of the instruction key can be avoided, and the user's experience of using the device is improved.

[0063] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the application. The objects and other advantages of the present application can be realized and attained by the structure particularly pointed out in the written description and claims, and the appended drawings.

[0064] The technical solutions of the present application will be further described in detail below with the help of the accompanying drawings and embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0065] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific 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 those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0066] Figure 1 The flowchart of the system-level global media playback control method in the embodiment of the present application.

[0067] Figure 2 The flowchart of the system-level global media playback control method in another embodiment of the present application.

[0068] Figure 3 The flowchart of the system-level global media playback control method in another embodiment of the present application.

[0069] Figure 4 The structure block diagram of the system-level global media playback control device in the embodiment of the present application. DETAILED DESCRIPTION

[0070] In the following, the specific embodiments of the present application will be described in detail with the help of the accompanying drawings, but not as a limitation of the present application.

[0071] It should be understood that various modifications can be made to the embodiments disclosed herein. Therefore, the following description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope of this disclosure will be apparent to those skilled in the art.

[0072] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present disclosure and, together with the general description of the disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the disclosure.

[0073] These and other features of the invention will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.

[0074] It should also be understood that although the invention has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of the invention, which have the features described in the claims and are therefore all within the scope of protection defined herein.

[0075] The above and other aspects, features and advantages of this disclosure will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.

[0076] Specific embodiments of the present disclosure are described thereafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure and can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the present disclosure. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but merely to serve as the basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of substantially any suitable detailed structures.

[0077] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in still another embodiment,” all of which may refer to one or more of the same or different embodiments according to this disclosure.

[0078] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0079] like Figure 1 As shown, this embodiment of the invention provides a system-level global media playback control method, including:

[0080] S1: In response to the acquisition of the system control command, access the pre-configuration file. The system control command represents the control of the operation of various application media by the system framework layer. The pre-configuration file records at least the control conditions and the control effects to be achieved.

[0081] S2: in the case that it is determined that the current scenario meets the management and control condition based on the information recorded in the pre-configuration file, obtaining a session identifier of the application media;

[0082] S3: generating a corresponding media controller in combination with the session identifier of the application media, the media controller being used to obtain a running state of the application media and to perform running control on the application media;

[0083] S4: obtaining the current running state of the application media through the media controller;

[0084] S5: in the case that the application media is a target application media that needs to be managed and controlled, determining a matched control instruction based on the running state and the management and control effect;

[0085] S6: sending the control instruction to the target application media through the media controller.

[0086] In this embodiment, the system management and control instruction can be triggered by the system based on the information input by the user, that is, the user instructs to start the system management and control function; or the system generates the system management and control instruction in response to the triggering of the user pre-configuration event, such as the user instructing to start the system management and control function at 7 o'clock every night, etc.; or the system generates the system management and control instruction automatically after the system is started, that is, the system management and control function is automatically started when the device is powered on. In addition, the system management and control instruction can also be that the system device or a third-party device actively judges that the user can not be able to manage and control the application media of the system device at present based on the monitoring of the current state of the user, for example, the user is currently sleeping, is in a video conference, etc. At this time, the system generates the system management and control instruction based on the judgment result of itself and starts the system management and control function, or the third-party device sends instruction information to the system device through the system server to instruct the system to generate the system management and control instruction and start the system management and control function. Of course, the user sends instruction information to the system device through a third-party device, such as a mobile phone, a smart watch, a smart home, etc. The instruction information is sent to the system device by the third-party device through the server, and the system generates the system management and control instruction based on this and starts the system management and control function. The system management and control function in this embodiment is to perform running control on the media of the global application in the system through the system framework layer.

[0087] In response to obtaining the system management instruction, the system starts the system management function. At this time, the system framework layer accesses the pre-configuration file, which is pre-stored by the user in a specified area in the system, and notifies the system framework layer of the address, so that it can subsequently access the file smoothly. The pre-configuration file includes management conditions and corresponding management effects to be achieved, the management conditions are used to indicate under what scenario the system framework layer is valid, and the management effect is the running state of the device after management, which is a specified state. For example, the management condition is during the user's sleep period, specifically from 11:00 to 6:00 the next day, and the system management function is valid within the time range, and the management effect to be achieved includes that the device is in a mute state within the above time range to avoid disturbing the user. After the system framework layer reads the information in the pre-configuration file, it determines the current scenario based on the information, that is, whether the current device state meets the management condition, such as whether the current clock of the device indicates that the current time is the target time, whether the device is currently running a certain application, whether the current running mode of the device is the target mode, etc. In the case where it is determined that the management condition is met, the session token of all application media in the system is obtained. The session token is registered simultaneously when the application starts the media function, such as audio playback, to receive the media control callback. At the same time, the instantiation of MediaSession will generate a unique session token using a preset algorithm. By combining the session token of the application media, the system framework layer can generate a corresponding media controller, which is used to obtain the running state of the application media and control the running of the application media. In this embodiment, the media controller is equivalent to a control intermediary, and the system framework layer obtains the current running state of the application media, such as the playing state, through the media controller, and sends instructions to the application media through the media controller. For example, the system framework layer obtains the current playing state of the application media through the media controller, including whether it is in a playing state, a playing mode, a playing volume, etc. Then, when it is determined that the application media is the target application media that needs to be managed, the system framework layer determines the matching control instruction based on the running state and the read management effect, and then sends the control instruction to the target application media through the media controller, to achieve targeted control of the target application media, so that the state after control matches the management effect. The specific management effect is not limited to mute and reducing the volume, but can also be changing the volume, switching the sound effect according to the environment sound, or determining whether to adjust the volume and switch the sound effect according to the user's excitement state and the playing state and content of the application media. For example, when the user is exercising, the system framework layer can determine whether to increase the volume and switch the sound effect to a dynamic mode according to the user's excitement state.

[0088] Based on the above, it can be known that the method described in the embodiment can flexibly configure the management and control scene and effect by adjusting the pre-configuration file. Secondly, the system framework layer can centrally and uniformly process the session records of all application media, so that the registered media session information of all applications of the device can be quickly read without omission and with high efficiency. By constructing an independent media controller for each application media, the one-to-one mapping relationship and control relationship between the application media and the system framework layer can be realized, and accurate control can be ensured.

[0089] In an embodiment, as shown in Figure 2 The method further includes:

[0090] S7: obtaining input management and control requirement information, the management and control requirement information being used to describe a scene that needs to be managed and controlled and a management and control effect that needs to be achieved;

[0091] S8: generating the management and control condition based on the management and control requirement information, the management and control condition being used to describe scene information that needs to be managed and controlled.

[0092] S9: writing the management and control condition and the management and control effect into the pre-configuration file.

[0093] For example, a user inputs management and control requirement information into a device system according to a management and control requirement, and the information describes a scene that needs to be managed and controlled and a management and control effect that needs to be achieved. After the system framework layer obtains the management and control requirement information, the pre-configuration file can be constructed, the management and control requirement information can be analyzed, the user's semantics can be recognized, and then the management and control condition and the management and control effect can be generated according to the analysis result, wherein the management and control condition clearly and accurately records the scene information that needs to be managed and controlled, such as management and control in a certain time period, management and control when the device system is in a certain running mode, management and control when the user is in a specified state, and the like. After the management and control condition and the management and control effect are determined, the system framework layer can write them into the pre-configuration file.

[0094] In another embodiment, the at least generating the pre-configuration file in combination with the management and control condition and the management and control effect further includes:

[0095] S901: obtaining a white list application list, the white list application list including application information that is not subject to the management and control condition;

[0096] S902: writing the white list application list into the pre-configuration file.

[0097] The whitelist application list can be written by the user actively, or all application information can be added to a list by the system, and the user can select the whitelist application or remove the application that needs to be controlled and keep the whitelist application. In this way, the system framework layer can not only adjust the control object, i.e., the application media, according to the playing state of the application, but also filter out the application that does not need to be controlled by configuring the whitelist application list. In this way, the user's control demand can be met, the use of the required application by the user is not affected, the use demand of the user for the device is more completely met, and the use experience of the user for the device is improved.

[0098] Further, the control condition in the embodiment includes:

[0099] The time control condition includes a time range in which the system layer framework needs to start and maintain the control of the application media.

[0100] The state control condition includes a device state in which the system layer framework needs to start and maintain the control of the application media, and the device state at least includes that the target application is in a running state and the system is in a target mode.

[0101] For example, the time control condition can be defined as constraint_time (time constraint), and constraint_time specifies the control time range of the application media control, which can be, but is not limited to, a fixed time period every day, and the fixed time period includes a start time and an end time, and the specific precision is accurate to minutes. When the start time is triggered, the system framework layer performs media control, such as pausing the playing of the application media. When the end time is triggered, the system framework layer can actively restore the playing of the application media. The specific operation can be flexibly configured by the user, or the system framework layer can continue to control by monitoring the user state, i.e., the control time is extended, instead of directly restoring the original state. That is, the system framework layer can determine how to operate the application media according to the actual situation when the end time is triggered.

[0102] The state control condition can be defined as scene (scene constraint), and scene specifies which scene is established to trigger the system control of the application media. The scene can be the start of an application, such as the start of a reading application or the start of a learning application, or the use of a system mode, such as a power saving mode, a learning mode, or a work mode. When the system enters a fixed immersive scene (i.e., any of the above scenes), it indicates that the system framework layer needs to control the application media, such as controlling the pause playing or reducing the volume.

[0103] The whitelist application list lists all whitelist application fields in the list. The applications recorded in the list are not within the scope of the media playback control restrictions, that is, they are not within the scope of the system framework layer control. The whitelist applications are allowed to normally operate without any restrictions in the case where any one of the above constraint conditions is met. For example, a call application, an online video learning application, and the like.

[0104] As an optional application example, the system framework layer can access and parse the configuration file config.xml saved under system / system / etc in response to obtaining of the system control instruction. The system system / etc directory saves a global control configuration file config.xml (a pre-configuration file). The content of the config.xml includes a time constraint constraint_time condition (a string type), a state constraint scene condition (a string type), and a whitelist application list (a string type). The config.xml file is built into the system / etc directory when the system is compiled into an img (a system image). The config.xml file is maintained by the system framework layer, so that the system framework layer has the permission to access at any time.

[0105] In an embodiment, determining that the current scene satisfies the control condition based on the pre-configuration file includes:

[0106] S10: determining a control condition based on the pre-configuration file;

[0107] S11: in response to the control condition being a time control condition, configuring a system clock based on the time range, so that the system clock is automatically triggered at a start time and an end time of the time range;

[0108] S12: setting a first media control flag. A state value of the first media control flag is used to represent whether the system framework layer starts control. The state value of the first media control flag is switched according to a clock broadcast output by the system when the system clock is triggered;

[0109] S13: in response to the system clock being triggered at the start time, determining whether the state value of the first media control flag is a target value;

[0110] S14: if yes, determining that the current scene satisfies the control condition.

[0111] For example, the system framework layer determines the control time range, i.e. the control period, including the start time and the end time of the control, by analyzing the control condition. Based on this, the system framework layer sets the corresponding system clock (RTC), i.e. configures the system clock, so that the system clock triggers the reminding mechanism when reaching the start time and the end time, to remind the system control layer to perform media control. At the same time, a unique media control flag bit need_media_control_flag is set, the value of which represents whether to enter the control stage, and the value of the flag bit changes according to the start and end of the control period. Specifically, in response to the reminder triggered by the system clock reaching the start time, the system triggers the corresponding RTC broadcast, and at the same time sets the value of the unique media control flag bit need_media_control_flag to true. Conversely, in response to the end of the time period, i.e. the trigger of the system clock for the end time, at this time, the system sets the value of the flag bit need_media_control_flag to false. In the above, when the flag bit value is true, it represents in this embodiment that the current scene meets the control condition, and the specific control process is executed.

[0112] In another embodiment, determining that the current scene meets the control condition based on the pre-configuration file comprises:

[0113] S15: determining the control condition based on the pre-configuration file;

[0114] S16: in response to the control condition being a state control condition, setting a second media control flag bit, the state value of the second media control flag bit being used to represent whether the system framework layer starts control, and the state value of the second media control flag bit being matched and written by the target application according to its running state, or being matched and written by the system framework layer according to the listening result of the running state of the target mode;

[0115] S17: in response to the state value of the second media control flag bit being a target value, determining that the current scene meets the control condition.

[0116] Exemplarily, the system framework layer determines the control scene by analyzing the control condition, and the control scene in the embodiment is limited to a homework mode scene, and the corresponding scene field is homework, i.e., the corresponding scene field in the pre-configuration file is homework. In response to the entering and exiting of the homework mode, the value of the flag bit is written by the homework mode APP (application) to the system global attribute homework_mode (homework mode attribute), i.e., to the second media control flag bit established by the system. Among them, writing true represents that the user has entered the homework mode; writing false represents that the homework mode has been exited. Alternatively, the value of the flag bit can also be written by the system framework layer. For example, the system framework layer can set a listener for the homework_mode global attribute, and when the value of homework_mode is true, set the unique media control flag bit need_media_control_flag to true, and vice versa, i.e., when the value of homework_mode is false, set the unique media control flag bit need_media_control_flag to false.

[0117] In another embodiment, the control condition can include multiple conditions, for example, both a time control condition and a state control condition, and when the time control condition and the state control condition are satisfied at the same time, or the control time periods intersect, if one control condition is released before the other control condition during the period when both control conditions are satisfied, for example, when the time control condition reaches the end time, and the scene of the other state control condition has not ended, even if the system framework layer determines that the value of the first media control flag bit is false, the control cannot be ended directly, and it is also necessary to determine whether the value of the second media control flag bit is also false. If yes, the control is ended, if the value of the second media control flag bit is true, the control is continued until the value of the second media control flag bit is false. Conversely, if the scene of the device ends first, the logic is the same, and when the system framework layer determines that the value of the second media control flag bit is false, the control will not be ended directly, and it is also necessary to determine whether the value of the first media control flag bit is also false. If not, the control is continued until the value of the first media control flag bit is false.

[0118] Further, the session identifier of the application media is obtained, including:

[0119] S18: accessing the media session record of the application media, wherein the media session record includes the session identifier of the application media and the corresponding application name;

[0120] S19: obtaining the session identifier of the application media based on the media session record;

[0121] S20: generating the corresponding media controller based on the session identifier of the application media, including:

[0122] S21: instantiating the session identifier of the application media based on the media session record to generate the corresponding media controller, wherein the media controller records the session identifier, the application name, the running logic for obtaining the running state of the application media, and the control link for obtaining the application media, so as to send the control instruction based on the running logic of the control link.

[0123] For example, under the condition that the first media control flag is true, that is, the premise that the media control needs to take effect, the obtaining of the media session identifier of all installed applications in the system framework layer includes: the system framework layer first obtains all system saved MediaSessionRecord (media session record) data of the application registered to the system framework layer. Each application synchronously registers MediaSession (media session) while playing audio, for receiving a media control listening callback. The system framework layer instantiates MediaSession at the same time, uses a fixed algorithm to generate a unique identifier SessionToken (session identifier) corresponding to the media session, and synchronously generates a MediaSessionRecord data record. The MediaSessionRecord records the unique identifier SessionToken of the media session and the package name (packagename) of the corresponding application, and saves it to the system MediaSessionStack stack data structure. The system framework layer can obtain the list of MediaSessionRecord saved by all applications by traversing MediaSessionStack. The list is maintained by the system framework layer to facilitate the system framework layer to access at any time. When the system framework layer obtains the list of MediaSessionRecord of all applications, the SessionToken and other data recorded in the MediaSessionRecord data can be directly instantiated to generate the corresponding media controller instance (MediaController). The MediaController is maintained by the system framework layer, so that it can be controlled by the system framework layer. The instantiated media controller will contain SessionToken, application package name parameter packagename, getPlaybackState logic (getPlaybackState logic), getTransportControls logic (getTransportControls logic, media control pipe for realizing data interaction) and other key information and methods.

[0124] Further, as shown in Figure 3 When it is determined that the application media is the target application media that needs to be controlled based on the running state and the control effect, a matched control instruction is determined based on the running state and the control effect, including:

[0125] S501: When it is determined that the application media needs to be controlled based on the running state and the control effect, the application name corresponding to the application media is obtained by the corresponding media controller;

[0126] S502: It is determined whether the application name is in the white list application list;

[0127] S503: If the application name is not recorded in the white list application list, it is determined that the application media is the target application media to be controlled;

[0128] S504: A matched control instruction is determined based on the running state and the control effect, and the control instruction at least includes pausing playing and lowering the volume to a target value.

[0129] For example, in the case that the first media flag bit or the second media flag bit is true, the current state (i.e., the initial state) of the application media obtained by the system framework layer through the media controller is play (playing), and at the same time, it is determined through matching verification that the white list application list does not contain the application, then it is determined that the application media is the target application media to be controlled. After determining that it is the target application media, the system framework layer will determine the specific control instruction in combination with the control effect recorded in the pre-configuration file and the actual playing state of the current target application media, for example, it can be a pause playing instruction. It can also be determined in combination with the obtained playing parameters of the application media, and the playing parameters of the media can also be obtained by the media controller. The system framework layer can also set other types of control instructions according to the playing parameters and the control effect, such as lowering the volume, or the system framework layer collects the environmental sound through the microphone of the device, and determines whether to raise the volume in combination with the environmental sound, etc. The specific control can be flexibly controlled in combination with the actual scene, the state of the user, etc. For the state of the user, the image can be obtained by the camera, or it can be obtained by the third party device, such as a smart watch, a mobile phone, etc.

[0130] In this embodiment, the media controller can obtain the corresponding media control pipe through the getTransportControls method stored by itself, and the pipe is maintained by the system framework layer. Based on the pipe, the system framework layer can instruct the media controller to issue a control instruction to the application media. After issuing the control instruction, the mediaSession callback registered by the corresponding app will receive the corresponding pause instruction (control instruction), and then execute the instruction.

[0131] In another embodiment, the method further comprises:

[0132] S22: recording the control instruction, the corresponding application name, and the running parameter before the control, the application name being obtained based on the media controller in which the application name is recorded;

[0133] S23: in response to the change of the scenario, the control condition being released, a recovery instruction being generated based on the recorded information, the recovery instruction being used to restore the running state of the application media to the state before the control;

[0134] S24: sending the recovery instruction to the target application media through the media controller.

[0135] Exemplarily, after the control step is executed, the system framework layer records the application subjected to the control and the running state or the running parameter of the application before the control, and saves the same in the local. In the case that the first media flag bit or the second media flag bit is false, the system framework layer determines whether the application name corresponding to the target application media is saved in the recorded information in the local, which guarantees that the state change of the application is caused by the control of the system framework layer, such as the change from the playing state to the paused playing state. After the above information is determined, the system framework layer generates a recovery instruction based on the recorded information, and sends the recovery instruction to the target application media through the media controller, so as to restore the running state of the target application media to the state before the control.

[0136] As shown in Figure 4 Another embodiment of the present application simultaneously provides a system-level global media playing control device, comprising:

[0137] A first response module, configured to access a pre-configuration file in response to the obtaining of a system control instruction, the system control instruction representing the control of the running of each application media by the system framework layer, and the pre-configuration file recording at least a control condition and a control effect to be achieved;

[0138] A first determination module, configured to acquire a session identifier of the application media in the case that the current scenario satisfies the control condition based on the pre-configuration file;

[0139] A first generation module, configured to generate a corresponding media controller in combination with the session identifier of the application media, the media controller being used to acquire the running state of the application media and to control the running of the application media;

[0140] A first obtaining module, configured to acquire the current running state of the application media through the media controller;

[0141] a second determining module, configured to, when the application media is determined as the target application media that needs to be controlled based on the running state and the control effect, determine a matched control instruction based on the running state and the control effect;

[0142] a first sending module, configured to send the control instruction to the target application media through the media controller.

[0143] In an embodiment, the apparatus further includes:

[0144] a second obtaining module, configured to obtain inputted control requirement information, the control requirement information being used to describe a scenario that needs to be controlled and a control effect that needs to be achieved;

[0145] a second generating module, configured to generate the control condition based on the control requirement information, the control condition being used to describe scenario information that needs to be controlled.

[0146] a first writing module, configured to write the control condition and the control effect into the pre-configuration file.

[0147] In an embodiment, the apparatus further includes:

[0148] a third obtaining module, configured to obtain a white list application list, the white list application list including application information that is not restricted by the control condition;

[0149] a second writing module, configured to write the white list application list into the pre-configuration file.

[0150] In an embodiment, the control condition includes:

[0151] a time control condition, including a time range in which the system layer framework needs to start and maintain control over the application media;

[0152] a state control condition, including a device state in which the system layer framework needs to start and maintain control over the application media, the device state at least including that the target application is in a running state and the system is in a target mode.

[0153] In an embodiment, determining, based on the pre-configuration file, that a current scenario satisfies the control condition includes:

[0154] determining, based on the pre-configuration file, a control condition;

[0155] in response to the control condition being a time control condition, configuring a system clock based on the time range, so that the system clock is automatically triggered at a start time and an end time of the time range;

[0156] A first media control flag is set, and a state value of the first media control flag is used to represent whether the system framework layer implements control, and the state value of the first media control flag is matched and replaced according to a clock broadcast output by the system corresponding to a trigger of the system clock;

[0157] In response to the trigger of the system clock at the starting time, it is determined whether the state value of the first media control flag is a target value.

[0158] If yes, it is determined that the current scenario satisfies the control condition.

[0159] In an embodiment, the determination that the current scenario satisfies the control condition based on the pre-configuration file comprises:

[0160] The control condition is determined based on the pre-configuration file.

[0161] In response to the control condition being a state control condition, a second media control flag is set, and a state value of the second media control flag is used to represent whether the system framework layer implements control, and the state value of the second media control flag is matched and written by the target application according to a running state of the target application, or is matched and written by the system framework layer according to a listening result of the running state of the target mode.

[0162] In response to the state value of the second media control flag being a target value, it is determined that the current scenario satisfies the control condition.

[0163] In an embodiment, the session identifier of the application media is obtained, comprising:

[0164] A media session record of the application media is accessed, and the media session record comprises a session identifier of the application media, a corresponding application name.

[0165] The session identifier of the application media is obtained based on the media session record.

[0166] The corresponding media controller is generated in combination with the session identifier of the application media, comprising:

[0167] The session identifier of the application media is instantiated in combination with the media session record to generate the corresponding media controller, and the media controller records the session identifier, the application name, the running logic for obtaining the running state of the application media, and the control link for obtaining the application media, so as to send the control instruction based on the running logic of the control link.

[0168] In an embodiment, when the application media is a target application media that needs to be controlled, the matching control instruction is determined based on the running state and the control effect, comprising:

[0169] determining whether the application name is recorded in the white list application list;

[0170] determining whether the application name is recorded in the white list application list;

[0171] if the application name is not recorded in the white list application list, determining that the application media is a target application media to be controlled;

[0172] determining a matched control instruction based on the running state and the control effect, the control instruction at least including pausing playing and reducing volume to a target value.

[0173] In an embodiment, the apparatus further comprises:

[0174] a recording module configured to record the control instruction, a corresponding application name, and a running parameter before control, the application name being obtained based on the media controller, the application name being recorded in the media controller;

[0175] a second response module configured to, in response to a change of the scene, the control condition being released, generate a recovery instruction based on the recorded information, the recovery instruction being used to restore the running state of the application media to a state before control;

[0176] sending the recovery instruction to the target application media through the media controller.

[0177] Another embodiment of the present application further provides an electronic device, comprising:

[0178] one or more processors;

[0179] a memory configured to store one or more programs;

[0180] when the one or more programs are executed by the one or more processors, the one or more processors implement the system-level global media playing control method as described in any of the above embodiments.

[0181] Further, an embodiment of the present application further provides a storage medium having a computer program stored thereon, the program being executed by a processor to implement the system-level global media playing control method as described above. It should be understood that each scheme in the embodiment has a corresponding technical effect as described in the method embodiment, which will not be described here.

[0182] Further, the embodiments of the present application also provide a computer program product, which is tangibly stored on a computer readable medium and includes computer readable instructions, which, when executed, cause at least one processor to perform the global media play control method at the system level as in the above embodiments.

[0183] Note that the computer storage media of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable medium may, for example, but not limited to, be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system or device. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as a carrier wave in a propagated data signal, which carries computer readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that can send, propagate or transfer a program for use by or in connection with an instruction execution system, system or device. The program code contained on the computer readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire, cable, RF, etc., or any suitable combination of the above.

[0184] In addition, those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product embodied in one or more computer readable storage media (including, but not limited to, disk memory, optical memory, etc.) having computer usable program code embodied thereon.

[0185] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions specified in the flowchart block or blocks. Figure 1 The flowchart and / or block diagram in the variation of the present application can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing apparatus, or other programmable data processing apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 The flowchart and / or block diagram in the variation of the present application can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing apparatus, or other programmable data processing apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowchart and / or block diagram block or blocks.

[0186] It should be understood that the above discussion is merely an example, and is not intended to limit the protection scope of the present application; the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as described above. For the sake of brevity, they are not provided in detail.

Claims

1. A system-level global media playback control method, characterized in that, include: In response to the acquisition of the system control command, the system accesses the pre-configuration file, which represents the control of the operation of various application media by the system framework layer, and the pre-configuration file records at least the control conditions and the control effects to be achieved. If the current scenario meets the control conditions based on the pre-configuration file, obtain the session identifier of the application media; A corresponding media controller is generated by combining the session identifier of the application media. The media controller is used to obtain the running status of the application media and to control the operation of the application media. The current running status of the application media is obtained through the media controller; When the application media is a target application media that needs to be controlled, a matching control command is determined based on the operating status and the control effect. The control command is sent to the target application media through the media controller.

2. The system-level global media playback control method according to claim 1, characterized in that, The method further includes: Obtain input control requirements information, which describes the scenarios requiring control and the control effects to be achieved; The control conditions are generated based on the control requirements information, and the control conditions are used to describe the scenario information that needs to be controlled; The control conditions and control effects are written into the pre-configuration file.

3. The system-level global media playback control method according to claim 2, characterized in that, The method further includes: Obtain a whitelist of applications, which includes application information that is not subject to the control conditions. Write the whitelist of applications into the pre-configuration file.

4. The system-level global media playback control method according to claim 1, characterized in that, The control conditions include: The time control conditions include the requirement for the system layer framework to initiate the application media and maintain the controlled time range. The state control conditions include the requirement that the system layer framework starts the application media and maintains the controlled device state, wherein the device state includes at least the target application being in a running state and the system being in a target mode.

5. The system-level global media playback control method according to claim 4, characterized in that, Based on the pre-configuration file, it is determined that the current scenario meets the control conditions, including: The control conditions are determined based on the pre-configuration file; In response to the control condition being a time control condition, the system clock is configured based on the time range so that the system clock is automatically triggered at both the start and end times of the time range. A first media control flag is set. The status value of the first media control flag is used to indicate whether the system framework layer implements control. The status value of the first media control flag is changed according to the clock broadcast output by the system when the system clock is triggered. In response to the triggering of the system clock at the start time, determine whether the state value of the first media control flag is the target value; If so, then the current scenario is determined to meet the control conditions.

6. The system-level global media playback control method according to claim 4, characterized in that, Based on the pre-configuration file, it is determined that the current scenario meets the control conditions, including: The control conditions are determined based on the pre-configuration file; In response to the control condition being a state control condition, a second media control flag is set. The state value of the second media control flag is used to characterize whether the system framework layer implements control. The state value of the second media control flag is matched and written by the target application according to its own running state, or matched and written by the system framework layer according to the monitoring result of the running state of the target mode. In response to the target value being the status value of the second media control flag, it is determined that the current scenario meets the control conditions.

7. The system-level global media playback control method according to claim 1, characterized in that, Obtaining the session identifier of the application media includes: Access the media session record of the application media, wherein the media session record includes the session identifier of the application media and the corresponding application name; The session identifier of the application media is obtained based on the media session record; The step of generating a corresponding media controller by combining the session identifier of the application media includes: The application media's session identifier is instantiated by combining the media session record, and a corresponding media controller is generated. The media controller records the session identifier, application name, running logic for obtaining the application media's running status, and running logic for obtaining the application media's control link to send control commands based on the controlled link.

8. The system-level global media playback control method according to claim 3, characterized in that, When the application media is a target application media that needs to be controlled, determining the matching control command based on the operating status and the control effect includes: When it is determined that the application media needs to be managed based on the operating status and management effect, the application name corresponding to the application media is obtained through the media controller. Determine whether the application name is recorded in the whitelist of applications; If the application name is not recorded in the whitelist of applications, then the application media is determined to be the target application media to be controlled; Based on the operating status and the control effect, a matching control instruction is determined, and the control instruction includes at least pausing playback and reducing the volume to a target value.

9. The system-level global media playback control method according to claim 1, characterized in that, The method further includes: The control command, the corresponding application name, and the operating parameters before control are recorded. The application name is obtained based on the media controller, and the media controller records the application name. In response to the change in the scenario, the control conditions are lifted, and a recovery instruction is generated based on the recorded information. The recovery instruction is used to restore the operating state of the application media to the state before the control. The recovery command is sent to the target application media via the media controller.

10. A system-level global media playback control device, characterized in that, include: The first response module is used to respond to the acquisition of the system control command and access the pre-configuration file. The system control command represents the control of the operation of various application media by the system framework layer. The pre-configuration file records at least the control conditions and the control effects to be achieved. The first determining module is used to obtain the session identifier of the application media when the current scenario meets the control conditions based on the pre-configuration file. The first generation module is used to generate a corresponding media controller by combining the session identifier of the application media. The media controller is used to obtain the running status of the application media and to control the running of the application media. The first acquisition module is used to obtain the current running status of the application media through the media controller; The second determining module is used to determine a matching control command based on the operating status and the control effect when the application media is a target application media that needs to be controlled. The first sending module is used to send the control command to the target application media through the media controller.