Video playback method and electronic device

By determining the video playback status in the terminal device and adapting according to the display direction and the video configuration direction, the display abnormality caused by the inconsistent direction of the user's handheld or placement direction and the video display direction is solved, and the stability of video playback is improved.

CN118827854BActive Publication Date: 2025-02-25HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411298191.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-02-25
Estimated Expiration
2044-09-18

AI Technical Summary

Technical Problem

When the direction of the user holding or placing the terminal device does not match the configuration display direction corresponding to the video, the terminal device is prone to display abnormalities.

Method used

When the preset trigger condition is met, the current video playback status of the electronic device is determined, and when the video is not played, it is adapted to play the video according to the display direction and the video configuration direction, thereby avoiding display abnormalities.

Benefits of technology

Improves the stability of electronic devices when playing videos and avoids display abnormalities caused by inconsistent display directions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118827854B_ABST
    Figure CN118827854B_ABST
Patent Text Reader

Abstract

The present application provides a video playback method and electronic device, which relates to the field of terminals. The method includes: when a preset trigger condition is met, determining the current video playback state of the electronic device, the preset trigger condition is used to trigger the electronic device to play the video after adapting the configuration direction of the video in the video resource and the display direction of the electronic device, and the configuration direction is used to configure the display direction required when the corresponding video is played; when the video playback state is that the video is being played, terminating the response to the preset trigger condition; when the video playback state is that the video is not being played, according to the display direction of the electronic device and the configuration direction of each video in the video resource, the video in the video resource is played. It can improve the stability of the electronic device playing the video and avoid display abnormalities when playing the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminals, and in particular to a video playback method and an electronic device. Background Art

[0002] With the rapid development of terminal devices, people have become accustomed to using various terminal devices for entertainment or office work, and using terminal devices to play videos is a very common scenario.

[0003] At present, in order to provide users with a comfortable video playback experience, terminal devices usually adaptively adjust the screen display direction according to the direction in which the user holds or places the terminal device. At the same time, the terminal device also adapts the display direction of the corresponding terminal device according to the display direction configured corresponding to the video played by the terminal device, so that the terminal device can better play horizontal screen videos in the horizontal screen display direction, and better play vertical screen videos in the vertical screen display direction.

[0004] However, when the direction in which the user holds or places the terminal device is different from the display direction configured corresponding to the video played by the terminal device, conflicts may easily occur when the terminal device implements the above functions, resulting in display anomalies. Summary of the invention

[0005] The present application provides a video playback method and an electronic device, which can improve the stability of video playback by the electronic device and avoid display abnormalities when playing the video.

[0006] In order to achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, a video playback method is provided, which may include: when a preset trigger condition is met, determining a current video playback state of an electronic device, the preset trigger condition being used to trigger the electronic device to play the video after adapting a configuration direction of a video in a video resource and a display direction of the electronic device, the configuration direction being used to configure a display direction required when the corresponding video is played; when the video playback state is that the video is being played, terminating the response to the preset trigger condition; when the video playback state is that the video is not being played, playing the video in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource.

[0008] It is understandable that the electronic device can first determine whether the electronic device is currently playing a video when the application for playing the video is started, or when the display direction change is detected (or monitored). Thus, the electronic device can play the video normally when it is determined that the electronic device is currently playing the video (i.e., it is currently playing the video) without making other responses. Correspondingly, when the electronic device is determined that the electronic device is not currently playing the video (i.e., it is not currently playing the video), it can adapt according to the display direction of the current electronic device and the display direction of the corresponding configuration of the video to be played, and play the video. Thus, it can avoid that the application in the electronic device playing the video responds to the display direction modified by the desktop launcher (Launcher) that has entered the foreground during the process of switching to the background (the application has not completely entered the background, i.e., it has not been onPause) (the application has not been onPause activity and is still in the running state, so the video playback state is still playing the video, so based on the above method, it will not respond to the display direction modification), thereby avoiding the subsequent display abnormality when the application is back to the foreground to play the video because the application responds to the display direction modification, and the system of the electronic device fails to modify the display direction in time when the application has been onPause, resulting in the display abnormality when the application is back to the foreground to play the video.

[0009] In a possible implementation, the preset trigger condition includes any one of the following: the electronic device starts a first application, where the first application is an application for playing a video; when the first application is running, the display direction of the electronic device changes.

[0010] In this way, when the electronic device detects that the first application for playing the video is started, the video playing method provided by the present application can be triggered to play the video. In addition, when the electronic device detects that the display direction has changed, the video playing method provided by the present application can be triggered to re-adapt the video according to the current display direction and the configuration direction of the video. Furthermore, the electronic device can better play the video according to the video playing method provided in the embodiment of the present application under these two triggering conditions to avoid display anomalies.

[0011] In another possible implementation, determining the current video playback state of the electronic device includes: obtaining a playback state flag, where the playback state flag is used to indicate the current video playback state of the electronic device; and determining the current video playback state of the electronic device according to the playback state flag.

[0012] In this way, indicating the video playback status by setting the playback status flag can be more convenient, efficient and accurate.

[0013] In another possible implementation, after playing the video in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource, the method further includes: updating a play status flag to indicate that the electronic device is currently playing the video.

[0014] In this way, when the video playback status is indicated by the playback status flag, the playback status flag can be updated in time when the video starts to be played, thereby improving the accuracy of the current video playback status indicated by the playback status flag.

[0015] In another possible implementation, videos in video resources are played according to the display direction of the electronic device and the configuration direction of each video in the video resource, including: obtaining the current first display direction of the electronic device, the display direction including horizontal screen display and vertical screen display; when the configuration direction of each video in the video resource is different from the first display direction, changing the display direction of the electronic device to a second display direction, the second display direction is different from the first display direction; and playing the videos in the video resource according to the second display direction.

[0016] In this way, the electronic device can match the corresponding video according to the current display direction, so that when there is no video configured with the current display direction, the display direction of the electronic device can be changed to match the configured direction of the video, so as to play the video. The electronic device can play the video according to the configured direction of the video, thereby improving the user experience.

[0017] In another possible implementation, the video resource includes multiple videos, and playing the videos in the video resource according to the second display direction includes: playing the videos in the video resource in sequence according to the second display direction in a preset order.

[0018] Of course, in some other possible implementations, videos in the video resource may also be randomly played according to the second display direction.

[0019] Through the above method, the videos in the video resources can be played in sequence, thereby realizing the continuous broadcast of the videos in the video resources and improving the user experience.

[0020] In another possible implementation manner, the method further includes: when there is a video configured in the first display direction in the video resource, playing the video configured in the first display direction in the video resource according to the first display direction.

[0021] In this way, the electronic device can match the corresponding video according to the current display direction, so that when there is a video with a configuration direction consistent with the current display direction, the electronic device can play the video according to the configuration direction of the video, that is, play the video according to the configuration direction of the video, thereby improving the user experience.

[0022] In another possible implementation, the video resources include multiple videos configured with a first display direction, and playing the videos configured with a first display direction in the video resources according to the first display direction includes: playing the videos configured with a first display direction in the video resources in sequence according to the first display direction in a preset order.

[0023] Of course, in some other possible implementations, videos configured with the first display direction in the video resource may also be randomly played according to the first display direction.

[0024] Through the above method, the videos in the video resources whose configuration direction is consistent with the current display direction can be played in sequence, thereby realizing the continuous broadcast of the videos in the video resources and improving the user experience.

[0025] In another possible implementation, the electronic device includes a desktop launcher, a system service and a first application, the posture of the electronic device is a third display direction, and the preset trigger condition is that the display direction of the electronic device changes when the first application is running; before determining the current video playback state of the electronic device, the method also includes: the first application plays the video according to the fourth display direction, and updates the playback state flag to indicate that the electronic device is currently playing the video; in response to the user's operation of switching the background, the system service switches the first application to the background and switches the desktop launcher to the foreground; the desktop launcher detects that the posture of the electronic device is the third display direction, and modifies the display direction of the electronic device to the third display direction; the first application detects the change in the display direction of the electronic device; determining the current video playback state of the electronic device, including: the first application determines that the current video playback state of the electronic device is playing the video according to the playback state flag; terminating the response to the preset trigger condition, including: the first application terminates the response to the trigger condition of the display direction change of the electronic device when the first application is running; after the first application terminates the response to the trigger condition of the display direction change of the electronic device when the first application is running, the method also includes: the first application enters the background to pause the activity, and updates the playback state flag to indicate that the electronic device is not currently playing the video.

[0026] In this way, when the application is playing a video, the playback status flag can be updated to correctly indicate that the current video playback status is playing the video. This can prevent the application in the electronic device playing the video from responding to the display direction modified by the desktop launcher that has entered the foreground during the process of switching to the background (the application has not completely entered the background, that is, it has not been onPaused) (the application has not yet been onPaused and the activity is still in the running state, so the video playback status is still playing the video, so based on the above method, it will not respond to the display direction modification), thereby avoiding the subsequent display abnormality when the application returns to the foreground to play the video because the application has responded to the display direction modification, but the electronic device system has not modified the display direction in time when the application has been onPaused.

[0027] In a second aspect, an electronic device is provided, the electronic device comprising: a processor, a memory, and a communication interface. The memory and the communication interface are coupled to the processor, the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes the method as described in any one of the above-mentioned first aspects.

[0028] In a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes any one of the methods described in the first aspect.

[0029] According to a fourth aspect, a computer program product comprising computer instructions is provided. When the computer instructions are executed on an electronic device, the electronic device executes the method as described in any one of the above-mentioned first aspects.

[0030] In a fifth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the method described in the first aspect above. In a possible design, the device also includes a memory for storing necessary program instructions and data for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0031] Among them, the technical effects brought about by any design method in the second to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a schematic diagram of an application scenario when a tablet computer plays a horizontal screen video provided by an embodiment of the present application;

[0033] Figure 2It is a hardware structure block diagram of an electronic device provided in an embodiment of the present application;

[0034] Figure 3 is a system structure block diagram of an electronic device provided in an embodiment of the present application;

[0035] Figure 4 It is a flowchart of a video playback method provided in an embodiment of the present application;

[0036] Figure 5 It is a flowchart of another video playback method provided in an embodiment of the present application;

[0037] Figure 6 This is a schematic diagram of a system flow when a video playback method provided by an embodiment of the present application is applied;

[0038] Figure 7 It is a structural schematic diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "a", "an", "said", "above", "the" and "this" are intended to also include plural expressions, unless the context clearly indicates otherwise. It should also be understood that " / " means or, for example, A / B can mean A or B; "and / or" in the text is merely a description of an association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0040] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0041] The terms "first" and "second" in the following embodiments of the present application are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.

[0042] With the rapid development of terminal devices, people have become accustomed to using various terminal devices for entertainment or office work, and using terminal devices to play videos is a very common scenario.

[0043] At present, in order to provide users with a comfortable video playback experience, terminal devices usually adaptively adjust the screen display direction according to the direction in which the user holds or places the terminal device. At the same time, the terminal device also adapts the display direction of the corresponding terminal device according to the display direction configured corresponding to the video played by the terminal device, so that the terminal device can better play horizontal screen videos in the horizontal screen display direction, and better play vertical screen videos in the vertical screen display direction.

[0044] However, when the direction in which the user holds or places the terminal device is different from the display direction configured corresponding to the video played by the terminal device, conflicts may easily occur when the terminal device implements the above functions, resulting in display anomalies.

[0045] For example, the terminal device is a tablet computer, and the tablet computer plays a first video through a first application program. The first video is a horizontal screen video, and its corresponding configured display direction is a horizontal screen display. Figure 1 As shown, it is a schematic diagram of an application scenario of a tablet computer provided by an embodiment of the present application when playing a horizontal screen video. Figure 1 As shown in (a) in the figure, the user places the tablet computer in a portrait state, and uses the tablet computer to play the first video through a first application (such as a video application), and displays an interface 101 for playing the first video. At this time, although the tablet computer is placed in a portrait state, since the display direction corresponding to the first video played by the tablet computer is configured as a landscape display, the first application in the tablet computer can first determine whether the current display direction of the tablet computer is consistent with the display direction configured for the first video before playing the first video, thereby modifying the display direction of the tablet computer to a landscape display consistent with the display direction configured for the first video, and then playing the first video, so that the tablet computer plays the landscape video in the landscape display direction, and displays an interface 101 for displaying the first video in landscape.

[0046] like Figure 1 As shown in (b), when the user operates the tablet computer to switch the first application playing the current first video in the tablet computer to the background, the tablet computer can switch the current first application to the background in response to the user's operation, and switch the desktop launcher (Launcher) to the foreground to display the interface 102 of the desktop launcher.

[0047] At this time, the tablet computer's Launcher is in a resident state (i.e., the Launcher is not destroyed when it is switched to the background) and has a faster response speed. Therefore, when the first application is switched to the background, the Launcher will modify the display orientation of the tablet computer to a vertical screen display corresponding to the current vertical screen state of the tablet computer based on the tablet computer's posture information detected by the tablet computer's sensors (such as gravity sensors, acceleration sensors, etc.). Therefore, the interface 102 of the desktop launcher is displayed in vertical screen.

[0048] Since the tablet computer system requires a certain response time when switching the first application to the background, if the first application playing the first video has not completely returned to the background, the first application will respond upon detecting that the display direction of the tablet computer is changed to portrait display, thereby changing the display direction of the tablet computer to landscape display according to the landscape display direction configured for the first video it is playing.

[0049] At this time, as the first application playing the first video returns to the background and calls onPause, if the tablet computer's system has not modified the display direction according to the instructions of the first application when the first application has been onPause, the tablet computer's system will stop modifying the display direction and cache the callback message for modifying the display direction in the queue.

[0050] In this way, when the user restarts the first application to continue playing the first video, the first application will receive a callback message sent by the tablet computer system to modify the display direction, and then determine whether the current display direction of the tablet computer is consistent with the configuration direction of the first video based on the callback value of the callback message, and then believe that the current display direction of the tablet computer has been changed to landscape display, and thus no longer modify the display direction of the tablet computer. At this time, the tablet computer will calculate according to the relevant parameters of the current display direction of the tablet computer (i.e. portrait display) to obtain the vertical view coordinates, resulting in the tablet computer being Figure 1 As shown in (c) in FIG. 1 , a display abnormality occurs when the first video is played, and an abnormal video playback interface 103 is displayed.

[0051] In this regard, the present application provides a video playback method, which is applied to electronic devices. When the electronic device is started up and when the display direction changes during the operation of the application for playing the video, the electronic device can first determine whether the electronic device is currently playing the video. Thus, the electronic device can make no other response when it is determined that the electronic device is currently playing the video (i.e., it is currently playing the video). Correspondingly, when the electronic device is determined that the electronic device is not currently playing the video (i.e., it is not currently playing the video), it can adapt according to the display direction of the current electronic device and the display direction of the corresponding configuration of the video to be played, and play the video. Thus, it can avoid that the application for playing the video of the electronic device responds to the display direction modified by the Launcher that has entered the foreground during the process of switching to the background (the application has not completely entered the background, i.e., it has not been onPause), thereby avoiding the subsequent display abnormality when the application returns to the foreground to play the video because the application responds to the display direction modification, and the system of the electronic device fails to modify the display direction in time when the application has been onPause.

[0052] A video playback method provided in an embodiment of the present application can be applied to an electronic device having a video playback function and capable of switching the display direction. For example, the electronic device can be a tablet computer, a personal computer (PC), a laptop computer, a mobile phone, a vehicle-mounted device, or a wearable device (e.g., a smart bracelet), etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device.

[0053] Continuing with the example of a tablet computer, refer to Figure 2 , which is a hardware structure block diagram of an electronic device provided in an embodiment of the present application.

[0054] like Figure 2As shown, the electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc. The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, an air pressure sensor 280C, a magnetic sensor 280D, an acceleration sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a PPG sensor 280M, etc.

[0055] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0056] For example, when the electronic device 200 is a mobile phone, it may include all the components shown in the figure, or only some of the components shown in the figure. Some of the components shown in the figure may be integrated on the electronic device 200, or may be independently provided. When independently provided, the components may be connected to the electronic device 200 in a wired or wireless manner.

[0057] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0058] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0059] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.

[0060] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0061] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0062] The electronic device 200 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.

[0063] Display screen 294 is used to display images, videos, etc.

[0064] The electronic device 200 can realize the shooting function through ISP, camera 293, video codec, GPU, display screen 294 and application processor.

[0065] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0066] The internal memory 221 may be used to store computer executable program codes, which include instructions. The internal memory 221 may include a program storage area and a data storage area. The processor 210 executes various functional applications and data processing of the electronic device 200 by running instructions stored in the internal memory 221 and / or instructions stored in a memory provided in the processor.

[0067] The sensor module 280 may be integrated in the electronic device 200 or independently provided and connected to the electronic device 200 in a wired or wireless manner, or may be partially integrated in the electronic device 200 and partially independently provided.

[0068] The gyro sensor 280B can be used to determine the motion posture of the electronic device 200. In some embodiments, the angular velocity of the electronic device 200 around three axes (ie, x, y and z axes) can be determined by the gyro sensor 280B. The gyro sensor 280B can be used for anti-shake shooting.

[0069] The acceleration sensor 280E can detect the magnitude of the acceleration of the electronic device 200 in all directions (generally three axes). When the electronic device 200 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching and pedometers. In an embodiment of the present application, the electronic device 200 can monitor the sensor signal of the acceleration sensor 280E through the Launcher, thereby determining the posture of the electronic device 200 based on the sensor signal and switching the display direction (i.e., horizontal and vertical screen switching).

[0070] The touch sensor 280K is also called a "touch control device". The touch sensor 280K can be set on the display screen 294. The touch sensor 280K and the display screen 294 form a touch screen, also called a "touch control screen". The touch sensor 280K is used to detect touch operations acting on or near it.

[0071] It is understandable that the realization of electronic device functions requires the cooperation of software architecture in addition to hardware support. In some examples, the operating system used by the electronic device 200 may include but is not limited to Symbian TM (Symbian TM ), Android TM (Android TM ),window TM (Windows TM ),apple TM (MacOS TM 、iOS TM ),blackberries TM (Blackberry TM ), Hongmeng TM (HarmonyOS TM ), Linus TM (Linux TM ) or Unex TM (Unix TM ) and other operating systems.

[0072] Here, the operating system running in the electronic device 200 is Android TM The system is taken as an example for explanation.

[0073] Figure 3 It is a system structure block diagram of the electronic device provided in the embodiment of the present application.

[0074] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. TM The system is divided into three layers, from top to bottom: application layer, application framework layer, and kernel layer.

[0075] The application layer can include a series of application packages.

[0076] like Figure 3 As shown, the application package may include floating windows, videos, galleries, emails, music, information, maps, instant messaging applications, etc. Of course, the application layer may also include other application packages, such as Bluetooth, calendars, shopping applications, chat applications, etc., which are not limited in this application.

[0077] In the embodiment of the present application, the application layer may also include a desktop launcher (Launcher). The Launcher includes but is not limited to the following functions: (1) Determine the touch operation area: the launcher can identify the touch position of the touch operation input by the user, so as to respond to the corresponding application launch or other interactive actions according to the touch operation and touch position; (2) Startup animation: the launcher is responsible for managing and executing the animation effects on the desktop, such as the bouncing of icons, the transition effect of application launch, the transition animation effect of application switching to the background, etc.; (3) Monitor the posture of the electronic device to switch the adaptive display direction, etc.

[0078] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0079] For example, Figure 3 As shown, the application framework layer may include a system server, a system-level user interface, a surface manager, a surface flinger, an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, an audio service (camera service), etc., and the embodiments of the present application do not impose any restrictions on this.

[0080] Among them, the system service (system server) is Android TM One of the core services of the system, responsible for managing and running various services of the system. These services include but are not limited to the activity manager and window manager. After the system server is started, it will initialize and manage these key system services to ensure the normal operation of the entire system.

[0081] The surface manager is an important component in the AndroidTM system, which is used to manage and allocate the display of all surfaces on the display screen, including application windows, system UI, etc. It is closely related to the surface flinger, which is responsible for allocating buffers for each surface, tracking the position and hierarchical order of each surface, and managing the life cycle of the surface.

[0082] The surface flinger is a system-level service in the AndroidTM system that is responsible for displaying all 2D and 3D graphic elements in the system. It manages all surfaces on the display. The surface flinger is responsible for compositing all surfaces and outputting the final image to the display.

[0083] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0084] The view system includes visual controls, such as controls for displaying characters, controls for displaying pictures, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text message notification icon can include a view for displaying characters and a view for displaying pictures.

[0085] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0086] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0087] The kernel layer is the layer between hardware and software. It interacts directly with the hardware and provides a variety of basic system services and functions. The kernel layer shields the upper-layer software from hardware details, ensuring the stability and compatibility of the system. The kernel layer contains drivers for various hardware devices, such as display drivers, camera drivers, audio drivers, etc., and of course other drivers such as sensor drivers, so that the upper-layer software can operate without paying attention to the specific implementation details of the hardware.

[0088] Based on the above hardware architecture and software architecture, the video playback method provided in the embodiment of the present application is introduced below by taking the electronic device as a tablet computer as an example.

[0089] Reference Figure 4 FIG. 1 is a flow chart of a video playback method provided in an embodiment of the present application. The video playback method can be applied to electronic devices (such as tablet computers), such as Figure 4 As shown, the video playing method may specifically include S401-S404.

[0090] S401: When a preset trigger condition is met, determine the current video playback state of the electronic device.

[0091] The video playing status includes two states: the video is playing and the video is not playing.

[0092] The preset trigger condition may be a condition for triggering the electronic device to play the video after adapting the configuration direction of the video in the video resource and the display direction of the electronic device, so that when the preset trigger condition is met, the electronic device plays the video in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource. The configuration direction of the video is the display direction configured by the video to be used when playing the video.

[0093] The preset trigger condition may be any one of the following: the first application for playing the video is started; when the first application for playing the video is running, the display direction of the electronic device is changed. For example, when the first application is started, the electronic device may determine the current video playing state of the electronic device and perform subsequent steps, or when the display direction is detected to be changed, the electronic device may determine the current video playing state of the electronic device and perform subsequent steps.

[0094] Based on the above preset trigger conditions, when the first application is started, the electronic device can play the corresponding video (such as the first video) in a suitable display direction through the first application based on the video playback method. When the display direction of the electronic device changes while the first application for playing the video is running, the electronic device can respond to the change of the display direction in a timely manner through the first application based on the video playback method, so as to better play the video (such as the first video) through the first application.

[0095] When the electronic device modifies the display direction, it will return a callback message for modifying the display direction accordingly. Therefore, whether the display direction of the electronic device has changed can be determined by the electronic device by monitoring the callback message for modifying the display direction. For example, when the display direction of the electronic device changes, the system service of the electronic device can call the onConfigurationChanged(Configuration newConfig) callback method, in which the changed display direction can be indicated by the newConfig parameter. When the electronic device monitors the callback, it can determine that the display direction of the electronic device has changed.

[0096] For example, the current video playback status of the electronic device can be indicated by a mark, so that the electronic device can determine the current video playback status by reading the mark. For example, the current video playback status can be marked by a playback status flag. When the playback status flag is read as "true", it can be determined that the current video playback status of the electronic device is playing the video; when the playback status flag is read as "false", it can be determined that the current video playback status of the electronic device is not playing the video. It should be noted that in order to accurately indicate the video playback status, when the application for playing the video is installed and started for the first time, the playback status flag defaults to "false". Accordingly, when the application enters the background or exits and stops playing the video, the electronic device can update the playback status flag to "false".

[0097] Of course, in practical applications, the electronic device can also determine the current video playback state of the electronic device in other ways. For example, the electronic device can also determine the current video playback state by calling the isPlaying() method of VideoView, etc., which is not limited here.

[0098] After the electronic device determines the current video playback state, it can subsequently perform the relevant steps of playing the video when the video is not currently playing. Correspondingly, when the video is currently playing, the electronic device can end the current process without making other responses. For example, when the display direction of the electronic device changes while the first application for playing the video is running, if the electronic device determines that the video is currently playing, it can not respond to the change of the display direction of the electronic device, thereby ensuring the normal display of the current video playback.

[0099] As an example, if the electronic device determines that no video is currently being played, the following subsequent steps may be performed.

[0100] S402: When the electronic device is not currently playing a video, obtain a current first display direction of the electronic device.

[0101] The display direction of the electronic device may include horizontal screen display and vertical screen display, and the first display direction is one of the horizontal screen display and the vertical screen display. The display direction of the electronic device may be modified by the desktop launcher according to the posture of the electronic device to instruct the system service of the electronic device, or may be modified by the application (such as the first application) according to the corresponding configuration to instruct the system service of the electronic device.

[0102] For example, when an electronic device obtains its current first display orientation, it can be implemented by calling the corresponding display orientation acquisition method. For example, the electronic device can obtain the current display orientation of the electronic device by calling the getResources().getConfiguratio().orientation method. Through this method, the system service of the electronic device can return the value of the current display orientation of the electronic device. For example, if Configuration.ORIENTATION_PORTRAIT is returned, it means that the current display orientation of the electronic device is portrait display (or called longitudinal display); if Configuration.ORIENTATION_LANDSCAPE is returned, it means that the current display orientation of the electronic device is landscape display (or called landscape display). Of course, in actual applications, the electronic device can also obtain the current display orientation of the electronic device in other ways. For example, the electronic device can also obtain the current screen layout size information, and indirectly determine the current display orientation according to the aspect ratio of the screen layout, etc. The method of obtaining the current display orientation of the electronic device is not limited here.

[0103] S403: When the configuration direction of each video in the video resources of the first application for playing videos is different from the current first display direction of the electronic device, change the display direction of the electronic device to the second display direction.

[0104] Among them, the configuration direction of the video is the display direction required to be adopted when the video is configured to play the video. The configuration direction, that is, the display direction required to be adopted by the video, can be configured for the video by setting the corresponding field in the name of the video. For example, by adding an "H" or "S" field to the end of the name of the video, the display direction required to be adopted by the video can be configured through the "H" field as horizontal screen display, and the display direction required to be adopted by the video can be configured through the "S" field as vertical screen display. For example, if the name of video X is "X01_S", the configuration direction of the video (that is, the display direction required to be adopted) can be determined to be vertical screen display through the field "S" in the name; for another example, if the name of video Y is "Y02_H", the configuration direction of the video (that is, the display direction required to be adopted) can be determined to be horizontal screen display through the field "H" in the name. Of course, in some other possible implementations, the corresponding configuration direction can also be configured for the video in other ways, such as by configuring a mapping table to map the corresponding configuration direction for each video, etc., which is not limited here.

[0105] The second display direction is another display direction different from the aforementioned first display direction. For example, when the first display direction is a vertical screen display, the second display direction may be a horizontal screen display. For another example, when the first display direction is a horizontal screen display, the second display direction may be a vertical screen display.

[0106] Since the video resources of the first application do not include any video configured to be played in the first display direction, the display direction of the electronic device needs to be modified so that the electronic device can play the corresponding video in a display direction consistent with the display direction configured for the video in the video resources through the first application after the display direction is changed.

[0107] Of course, in some possible implementations, when there is a configuration direction in the video resources of the first application used to play the video that is the same as the current first display direction of the electronic device, the electronic device can directly use the first application to adopt the first display direction to play the video in the video resource with the configuration direction that is the first display direction.

[0108] For example, the electronic device can match a video with a configuration direction consistent with the display direction from the video resources of the first application based on the current display direction of the electronic device. If a corresponding video is matched, the matched video is played directly through the first application using the current display direction. If no corresponding video is matched, the current display direction of the electronic device is modified to another direction, thereby facilitating the electronic device to play the video in its video resources through the first application using the modified display direction.

[0109] For example, if the configuration direction of each video in the video resources of the first application is horizontal display, and the first display direction is vertical display, then when the electronic device determines that the configuration direction of each video in the video resources of the first application is different from the current first display direction of the electronic device, the electronic device can change its display direction to the second display direction, i.e., horizontal display, so that the electronic device can subsequently play the videos in its video resources through the first application according to the changed display direction (i.e., horizontal display).

[0110] For another example, take the case where the video resources of the first application include videos configured for horizontal display and also include videos configured for vertical display, and the first display direction is vertical display. When the electronic device determines that there is a video configured for a direction consistent with the current display direction of the electronic device (i.e., a video configured for vertical display) in the video resources of the first application, the electronic device can directly use the current display direction (i.e., vertical display) to play the video configured for the first display direction (i.e., a video configured for vertical display) in its video resources through the first application.

[0111] As an example, when the electronic device changes the display direction to the second display direction, it can be implemented by calling the corresponding method for modifying the display direction. For example, the electronic device can modify the display direction of the electronic device by calling the setRequestedOrientation() method. By calling this method, the display direction that the electronic device needs to modify can be indicated, so that the system service of the electronic device can modify the display direction to the corresponding display direction (such as the second display direction) according to the indication. For example, the system service of the electronic device can be instructed to modify the display direction of the electronic device to landscape display (or horizontal display) by calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); the system service of the electronic device can be instructed to modify the display direction of the electronic device to portrait display (or vertical display) by calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT).

[0112] When the electronic device modifies the display direction through the system service, the system service can also return a corresponding callback message for modifying the display direction. For example, the callback message can be implemented through the onConfigurationChanged() callback method. For example, when the system service modifies the display direction, it can call the onConfigurationChanged(Configuration newConfig) callback and indicate the changed display direction through the newConfig parameter.

[0113] S404: Play the first video in the second display direction through the first application.

[0114] Among them, since the display direction generally includes two types, horizontal screen display and vertical screen display, based on S403, in the video resources of the first application for playing videos, when the configuration direction of each video is different from the current first display direction of the electronic device, it can be determined that the configuration direction of each video in the video resources of the first application is another display direction different from the first display direction (i.e., the second display direction). Therefore, after the electronic device changes the display direction to the second display direction, the electronic device can play the video in the video resource in the second display direction through the first application.

[0115] According to the above description, since the configuration direction of each video in the video resource of the first application is the second display direction, the first video can be any video in the video resource of the first application. For example, the electronic device can play each video in the video resource of the first application in sequence according to a preset order. Alternatively, the electronic device can randomly play each video in the video resource of the first application, which is not limited here.

[0116] For example, when an electronic device plays a first video in a second display direction through a first application, the electronic device may read relevant parameters corresponding to the current display direction of the electronic device (the electronic device has changed the display direction, so the current display direction is the second display direction) through the system, and then calculate and render the picture of the first video according to the configuration direction of the first video based on the parameters to play the first video.

[0117] As an example, based on the above description of S403, in the video resources of the first application for playing the video, when there is a configuration direction that is the same as the current first display direction of the electronic device, the electronic device can directly use the first application to play the video with the configuration direction and the first display direction in the video resource. At this time, when there are two or more videos with the configuration direction of the first display direction, the electronic device can also play these videos with the configuration direction of the first display direction in sequence according to a preset order, or randomly play these videos with the configuration direction of the first display direction. Among them, when the electronic device plays the video with the configuration direction of the first display direction, a similar method as described above can be adopted. For example, the electronic device can read the relevant parameters corresponding to the current display direction of the electronic device (since the electronic device has not changed the display direction, the current display direction is the first display direction) through the system, and then calculate and render the picture of the first video according to the configuration direction of the video (i.e., the first display direction) according to the parameters, so as to play the video with the configuration direction of the first display direction.

[0118] In the embodiment of the present application, based on the relevant description of the aforementioned S401, as an example, when the electronic device determines its current video playback status, it can be implemented by marking (such as a playback status flag). At this time, when the electronic device executes S404 to start playing the first video, it can update the playback status flag to "true" so that the subsequent electronic device can correctly judge the video playback status according to the playback status flag; and when the electronic device determines that there is a video with a configuration direction consistent with the current display direction in the video resource of the first application, and directly plays the video with a configuration direction of the current display direction without changing the display direction, the electronic device can also update the playback status flag to "true" so that the subsequent electronic device can correctly judge the video playback status according to the playback status flag. Correspondingly, when the first application used by the electronic device to play the video exits and switches to the background to stop playing the video, the electronic device can update the flag to "false" so that when the first application is restarted, the electronic device can play the video normally according to the video playback method provided in the embodiment of the present application.

[0119] It should be noted that, as a possible implementation method, based on the aforementioned video playback method, a related judgment process can be introduced to better implement the video playback method provided in the embodiment of the present application. Figure 5 As shown, it is a flow chart of another video playback method provided by an embodiment of the present application. Figure 5 As shown, when the aforementioned preset triggering condition is met, the video playing method may specifically include S501-S506.

[0120] S501: Determine whether a video is currently being played based on a play status flag.

[0121] The specific method of determining whether the electronic device is currently playing a video according to the play status flag bit can be referred to the related description in the aforementioned S401, which will not be described in detail here.

[0122] If the electronic device is currently playing a video, the electronic device may not make any other response and the process ends. If the electronic device is not currently playing a video, the electronic device may further determine whether there is a video with a configuration direction consistent with the current display direction in the video resource of the first application and execute S502.

[0123] S502: Determine whether there is a video in the video resource whose configuration direction is consistent with the current display direction.

[0124] The video resource is a video resource of the first application for playing the video, which may include one or more videos, and each video may be configured with a corresponding configuration direction. The method of setting the configuration direction for the video can refer to the relevant description in the aforementioned S403, which will not be repeated here. In the judgment process, how to obtain the current display direction can refer to the relevant description in the aforementioned S402, which will not be repeated here.

[0125] In order to play the video better, the electronic device needs to play the video in a display direction that is consistent with the configuration direction of the video. Therefore, when there is a video in the video resource whose configuration direction is consistent with the current display direction of the electronic device, the electronic device can directly play the corresponding video according to the current display direction, that is, execute S503. When there is no video in the video resource whose configuration direction is consistent with the current display direction, the electronic device can execute S504 to modify the display direction of the electronic device, so as to facilitate the subsequent playback of the corresponding video according to the modified display direction.

[0126] S503: Play the video whose configuration direction is consistent with the current display direction.

[0127] When there are two or more videos whose configuration direction is consistent with the current display direction, the electronic device can play the corresponding videos in sequence according to a preset order, or can play the corresponding videos randomly, and there is no limitation here.

[0128] Among them, how to play the corresponding video can refer to the relevant instructions in the aforementioned S404, which will not be repeated here.

[0129] S504: Modify the display direction of the electronic device.

[0130] The method of modifying the display direction of the electronic device may refer to the related description in the aforementioned S403, which will not be described in detail here.

[0131] S505: Play the video in the video resource according to the modified display direction.

[0132] When there are two or more videos in the video resource, the electronic device may play the corresponding videos in sequence according to a preset order, or may play the corresponding videos randomly, and there is no limitation here.

[0133] Among them, how to play the corresponding video can refer to the relevant instructions in the aforementioned S404, which will not be repeated here.

[0134] S506: Update the play status flag.

[0135] When the electronic device starts to play a video whose configuration direction is consistent with the current display direction, the electronic device can update the play status flag to "true", or when the electronic device starts to play the video according to the modified display direction, the electronic device can update the play status flag to "true". This facilitates the subsequent satisfaction of the aforementioned preset trigger condition, and when executing the video playback method, the electronic device can correctly determine whether the video is currently being played according to the play status flag.

[0136] Of course, when the first application that plays the video exits or switches to the background to stop playing the video, the electronic device can update the flag to "false" so that when the first application is restarted, the electronic device can play the video normally according to the video playback method provided in the embodiment of the present application.

[0137] Based on the aforementioned video playback method, as an example, its key judgment steps can refer to the following pseudo code:

[0138] If (no video played) {

[0139] If (the current display direction is consistent with the configuration direction) {

[0140] Start playing the video

[0141] Update the playback status flag after the video is played

[0142] }eles {

[0143] Modify the display orientation

[0144] }

[0145] }

[0146] Based on the above method, when the application for playing videos (such as the first application) is started, or when the display direction of the electronic device is changed during the operation of the application for playing videos (such as the first application), it is first determined whether the electronic device is currently playing a video, and only responds when no video is currently playing, and executes the subsequent video playback process. It can prevent the application for playing videos on the electronic device from responding to the display direction modified by the Launcher that has entered the foreground during the process of switching to the background (the application has not completely entered the background, that is, it has not been onPaused), thereby avoiding the subsequent display abnormality when the application returns to the foreground to play the video because the application has responded to the display direction modification, but the system of the electronic device has not modified the display direction in time when the application has been onPaused.

[0147] For example, take an application scenario in which the electronic device is in a third display orientation (e.g., portrait orientation) to start a first application, the first application (e.g., a demonstration video application) has a video (e.g., a first video, which can be a demonstration video) in its video resources, and the configuration direction of the first video is a fourth display orientation (e.g., landscape display), and the user switches the first application to the background during the process of the electronic device playing the first video through the first application, and then the user switches the first application back to the foreground and continues to play the first video. The electronic device can use the aforementioned software architecture, such as a desktop launcher (Launcher), a system service (system server), and an application (e.g., the first application) for playing videos to execute the video playback method to avoid video playback display anomalies that occur after the first application is switched back to the foreground. For example, referring to Figure 6 As shown, it is a schematic diagram of the system flow when a video playback method provided by an embodiment of the present application is applied. Figure 6 As shown, the system process may include the following S601-S615.

[0148] S601: In response to a user's operation of starting a first application, a desktop launcher instructs a system service to start the first application.

[0149] The operation of the user launching the first application may be an operation of the user clicking the icon of the first application in the desktop launcher. For example, the user may click the icon of the first application by touching the display screen of the electronic device, or may click the icon of the first application by using a cursor of an external device such as a mouse, etc., which is not limited here. Of course, in actual applications, the user may also launch the first application by inputting a shortcut key, etc., which is not limited here.

[0150] As an example, the desktop launcher can start the first application by calling the startActivity method.

[0151] S602: The system service starts the first application.

[0152] The system service may start the first application by calling the oncreate method, and notify the first application to execute the lifecycle callback.

[0153] S603: The first application determines that no video is currently being played.

[0154] Since the first application has just been started, no video is currently being played. How the first application specifically determines whether a video is currently being played (ie, how to determine the current video playing state) can be referred to the related description in the aforementioned S401, which will not be repeated here.

[0155] S604: The first application determines that the current vertical screen display direction of the electronic device is inconsistent with the configuration direction (horizontal screen display) of the first video configuration.

[0156] Since the electronic device is in a portrait orientation, the current display orientation of the electronic device is portrait. Before playing a video, the first application can first match a video with a configuration orientation consistent with the current display orientation from its own video resources. If a match is found, the corresponding video can be played directly. If a match is not found, the display orientation can be modified so that the video can be played in the configuration orientation of the video configuration. In this example, the current display orientation is portrait, while the configuration orientation of the first video configuration is landscape, and they cannot be matched. Therefore, the display orientation of the electronic device needs to be modified.

[0157] Among them, the first application can obtain the current display orientation of the electronic device by calling the getResources().getConfiguratio().orientation method. Through this method, the system service of the electronic device can return the value of the current display orientation of the electronic device. For example, in this example, Configuration.ORIENTATION_PORTRAIT can be returned, indicating that the current display orientation of the electronic device is vertical screen display. For the acquisition of the configuration direction of the first video configuration and the detailed description of obtaining the current display orientation of the electronic device, please refer to the relevant instructions in the aforementioned S403, which will not be repeated here.

[0158] S605: The first application program instructs the system service to modify the display direction of the electronic device to the configuration direction of the first video configuration (horizontal screen display).

[0159] Among them, modifying the display orientation of the electronic device can be that the first application modifies the display orientation of the electronic device by calling the setRequestedOrientation() method. By calling this method, the display orientation that needs to be modified can be indicated, so that the system service can modify the display orientation to the corresponding display orientation according to the indication. For example, in this example, the system service of the electronic device can be instructed to modify the display orientation of the electronic device to landscape display by calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE). For detailed instructions on how to modify the display orientation of the electronic device, please refer to the relevant instructions in the aforementioned S403, which will not be repeated here.

[0160] S606: The system service modifies the display direction of the electronic device to landscape display according to the instruction.

[0161] S607: The system service sends a display direction change callback to the first application.

[0162] The display direction change callback can be implemented through the onConfigurationChanged() callback method. For example, when the system service modifies the display direction, it can call the onConfigurationChanged(ConfigurationnewConfig) callback to indicate the changed display direction through the newConfig parameter. After receiving the indication from the first application to modify the display direction, the system service will execute the callback to indicate to the first application the modification of the display direction of the electronic device. The callback may be received by the first application before the system service has completed the modification of the display direction.

[0163] S608: The first application starts playing the first video in the horizontal screen display direction.

[0164] After the display direction of the electronic device is changed, the display direction of the electronic device and the configuration direction of the first video can match, and the first application can play the first video according to the horizontal screen display direction.

[0165] Among them, the specific method of playing the first video can refer to the relevant instructions in the aforementioned S404, which will not be repeated here.

[0166] In this example, S601-S608 is an example of executing the video playback method provided in the embodiment of the present application when the preset trigger condition "when the first application for playing the video is started" is met.

[0167] S609: In response to the user's operation of exiting the first application to the background, the system service switches the first application to the background and switches the desktop launcher to the foreground.

[0168] Since the desktop launcher is in a permanent state, the response speed is very fast. When the first application is switched to the background, it takes a certain amount of time for the first application to switch, and the desktop launcher will quickly enter the foreground. Therefore, when the desktop launcher subsequently responds to the posture of the current electronic device to modify the display direction, the first application may not have completely entered the background, and its activity is still running.

[0169] S610: The desktop launcher detects that the display direction (portrait display) corresponding to the current posture of the electronic device is inconsistent with the current display direction (landscape display) of the electronic device.

[0170] The desktop launcher can determine the current posture of the electronic device by monitoring the sensor of the electronic device. For example, the current posture of the electronic device can be determined by monitoring the detection signal of the acceleration sensor of the electronic device.

[0171] S611. The desktop launcher instructs the system service to change the display direction of the electronic device to the display direction corresponding to the current posture of the electronic device (vertical screen display).

[0172] Modifying the display orientation of the electronic device may be that the desktop launcher calls the setRequestedOrientation() method to modify the display orientation of the electronic device. By calling this method, the display orientation that needs to be modified can be indicated, so that the system service can modify the display orientation to the corresponding display orientation according to the indication. For example, in this example, the system service of the electronic device can be instructed to modify the display orientation of the electronic device to a vertical screen display by calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT).

[0173] S612: The system service changes the display orientation of the electronic device to vertical display.

[0174] S613: The first application monitors that the display direction of the electronic device changes.

[0175] When the system service modifies the display direction, it sends a display direction change callback to the desktop launcher. The display direction change callback can be implemented through the onConfigurationChanged() callback method. For example, when the system service modifies the display direction, it can call the onConfigurationChanged(Configuration newConfig) callback and indicate the changed display direction through the newConfig parameter. After receiving the indication from the desktop launcher to modify the display direction, the system service will execute the callback to indicate the modification of the display direction of the electronic device to the desktop launcher.

[0176] Since the first application has not yet entered the background completely through onPause at this time and the activity is still running, the first application can monitor the display direction change callback sent by the system service to the desktop launcher, thereby determining that the display direction of the electronic device has changed.

[0177] S614: The first application determines that a video is currently being played and does not respond to a change in the display direction of the electronic device.

[0178] When the display direction of the electronic device changes, the first application will trigger the execution of the video playback method of the embodiment of the present application. Since the first application has started playing the video in S608, the video playback state of the first application is playing the video at this time. Based on the video playback method of the embodiment of the present application, the first application will not respond to the change of the display direction.

[0179] As an example, based on the above description, when the current video playback state is determined by the playback state flag, at S608, the first application can update the playback state flag to "true", thereby indicating that the video playback state is playing the video. At this time, S614 can determine that the video is currently playing according to the playback state flag.

[0180] S615: The first application onPause completely enters the background.

[0181] As the system service responds to the first application switching to the background, the first application can execute onPause to enter the background after a certain period of time, and the activity of the first application enters a paused state.

[0182] As an example, based on the foregoing description, when the current video playback status is determined by a playback status flag, the first application may update the playback status flag to "false" during onPause, thereby indicating that the video playback status is that no video is being played.

[0183] In this example, S613-S615 is an example of executing the video playback method provided in the embodiment of the present application when the preset trigger condition "the display direction of the electronic device changes when the first application is running" is met.

[0184] After the first application completely enters the background, when the user restarts the first application, the first application can perform the response step again according to the video playback method provided in the embodiment of the present application. At this time, the first application will detect that there is no video currently being played, and thus match the current display direction with the configuration direction of the video again.

[0185] In the above example, when the first application program has not yet completely entered the background, and it monitors that the desktop launcher has modified the display direction of the electronic device to a vertical screen display, based on the video playback method of the embodiment of the present application, the first application program will first determine the current video playback status. At this time, since the first application program is switched to the background from the state of playing the video, the video playback state is still playing the video when it has not yet completely entered the background. Therefore, when the first application program determines that the video is currently playing, it will no longer respond to the display direction change of the electronic device. Thus, it will not indicate to the system service to modify the display direction to the configured direction of the video. This also avoids the problem that the system service fails to modify the display direction after the first application program completely enters the background, and when the first application program is started again, it will not modify the display direction due to receiving the display direction modification callback sent by the system service, and the video is played according to the unmodified display direction, resulting in display abnormalities.

[0186] It is obvious that those skilled in the art can make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0187] It is understandable that, in order to realize the above functions, the above electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0188] The embodiment of the present application can divide the functional modules of the above-mentioned electronic device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0189] An embodiment of the present application also provides an electronic device, which includes: a memory and one or more processors; the memory is coupled to the processor; wherein computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method provided in the aforementioned embodiment.

[0190] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method provided in the above embodiment.

[0191] An embodiment of the present application also provides a computer program product, which includes executable instructions. When the computer program product is run on an electronic device, the electronic device executes the method provided in the above embodiment.

[0192] The present application also provides a chip system, such as Figure 7 As shown, the chip system 700 includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 can be interconnected through a line. For example, the interface circuit 702 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 702 can be used to send signals to other devices (such as the processor 701).

[0193] Exemplarily, the interface circuit 702 can read the instruction stored in the memory and send the instruction to the processor 701. When the instruction is executed by the processor 701, the chip system can execute the various steps in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0194] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0195] In the several embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0196] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0198] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0199] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A video playback method, characterized in that: The method comprises: When a preset trigger condition is met, determining the current video playback state of the electronic device, wherein the preset trigger condition is used to trigger the electronic device to play the video after adapting the configuration direction of the video in the video resource and the display direction of the electronic device, wherein the configuration direction is used to configure the display direction required when the corresponding video is played; When the video playback state is that the video is being played, terminating the response to the preset trigger condition; When the video playing state is that no video is being played, playing the video in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource; The preset trigger condition includes any one of the following: The electronic device starts a first application, where the first application is an application for playing a video; While the first application is running, the display direction of the electronic device changes.

2. The method according to claim 1, characterized in that Determining the current video playback state of the electronic device includes: Acquire a play status flag, where the play status flag is used to indicate a current video play status of the electronic device; The current video playback state of the electronic device is determined according to the playback state flag.

3. The method according to claim 2, characterized in that After playing the videos in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource, the method further includes: The play status flag is updated to indicate that the electronic device is currently playing a video.

4. The method according to claim 1, characterized in that: The step of playing the videos in the video resource according to the display direction of the electronic device and the configuration direction of each video in the video resource comprises: Acquire a current first display orientation of the electronic device, where the display orientation includes horizontal screen display and vertical screen display; When the configuration direction of each video in the video resource is different from the first display direction, changing the display direction of the electronic device to a second display direction, where the second display direction is different from the first display direction; The video in the video resource is played according to the second display direction.

5. The method according to claim 4, characterized in that The video resource includes a plurality of videos, and playing the videos in the video resource according to the second display direction includes: The videos in the video resource are played sequentially according to the second display direction in a preset order.

6. The method according to claim 4, characterized in that The method further comprises: When there is a video with a configuration direction of the first display direction in the video resource, the video with a configuration direction of the first display direction in the video resource is played according to the first display direction.

7. The method according to claim 6, characterized in that The video resource includes a plurality of videos configured with the first display direction, and playing the video resource configured with the first display direction according to the first display direction includes: The videos configured with the first display direction in the video resource are played in sequence according to the first display direction in a preset order.

8. The method according to claim 3, characterized in that The electronic device comprises a desktop launcher, a system service and a first application, the posture of the electronic device is a third display direction, and the preset trigger condition is that the display direction of the electronic device is changed when the first application is running; Before determining the current video playback state of the electronic device, the method further includes: The first application plays the video according to the fourth display direction, and updates the play status flag to indicate that the electronic device is currently playing the video; In response to a user's operation of switching the background, the system service switches the first application to the background and switches the desktop launcher to the foreground; The desktop launcher detects that the posture of the electronic device is the third display direction, and changes the display direction of the electronic device to the third display direction; The first application detects a change in the display orientation of the electronic device; Determining the current video playback state of the electronic device includes: The first application determines, according to the play status flag, that the current video play status of the electronic device is playing the video; The terminating the response to the preset trigger condition includes: The first application terminates the response to the trigger condition of changing the display direction of the electronic device when the first application is running; After the first application terminates the response to the triggering condition of the display direction change of the electronic device when the first application is running, the method further includes: The first application enters the background to pause the activity, and updates the play status flag to indicate that the electronic device is not currently playing a video.

9. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a communication interface; the memory and the communication interface are coupled to the processor, the memory is used to store computer program code, and the computer program code comprises computer instructions; wherein, when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 8.

11. A chip system, characterized in that: The chip system includes a processor and an interface circuit, and the processor and the interface circuit can be interconnected via lines; wherein the interface circuit is used to receive a signal from an electronic device and send the signal to the processor, and the signal includes a computer instruction; when the processor executes the computer instruction, the chip system executes the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Video play image display method and device and mobile terminal

    CN106201168A