Short video display method and device, storage medium and electronic equipment
By dynamically evaluating device performance and optimizing playback strategies, the problem of a fixed number of short video player instances has been solved, achieving smooth playback and efficient resource utilization, thereby improving user experience and device battery life.
Patent Information
- Application Number
- CN202511254588.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2025-11-04
AI Technical Summary
Existing short video playback solutions cannot dynamically adjust the number of player instances based on device performance, resulting in lag on low-end devices and resource waste on high-end devices. Furthermore, the frequent creation and destruction of player instances causes memory jitter, affecting user experience.
By acquiring device information of the video playback terminal, determining the device performance status, dynamically setting the number of reusable short video player views, initializing the sliding container, setting a unique identifier for each view, calculating index values in response to user sliding operations, and optimizing playback strategies to reduce resource waste and memory jitter.
It enables smooth playback of short videos on different devices, improves user experience, and optimizes device performance and battery life.
Smart Images

Figure CN120897088A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the multimedia technical field, and in particular to a short video display method and device, a storage medium and an electronic device. BACKGROUND
[0002] With the rapid development of mobile Internet, short videos have become an important part of users' lives.
[0003] However, the prior art has the problem of low-end device lag and high-end device resource waste caused by a fixed number of player instances. In addition, the memory jitter caused by frequent creation and destruction of player instances causes interface lag when sliding, seriously affecting the user experience.
[0004] Therefore, how to improve the smoothness of short video playback and improve the user experience has become a technical problem that technicians in the field urgently need to solve. SUMMARY
[0005] In view of the above problems, the present application provides a short video display method, device, storage medium and electronic device which overcome the above problems or at least partially solve the above problems, and the technical solutions are as follows:
[0006] A short video display method comprises:
[0007] obtaining current device information of a video playback terminal;
[0008] judging the current device performance state of the video playback terminal according to the current device information;
[0009] setting the number of reusable short video player views using the current device performance state, initializing a sliding container containing each short video player view, and setting a unique identification value for each short video player view;
[0010] calculating a current index value through the current content offset of the sliding container in response to the user's sliding operation;
[0011] playing the short video player view of the visible area of the video playback terminal according to the current index value and a preset rule, and pausing the short video player view of the non-visible area of the video playback terminal.
[0012] A short video display device comprises a current device information obtaining unit, a current device performance state judging unit, a short video player initializing unit, a sliding processing unit and a short video player view control unit.
[0013] The current device information obtaining unit is configured to obtain the current device information of a video playback terminal;
[0014] The current device performance state judging unit is configured to judge the current device performance state of the video playing terminal according to the current device information.
[0015] The short video player initializing unit is configured to set the number of reusable short video player views according to the current device performance state, initialize a sliding container containing each short video player view, and set a unique identification value for each short video player view.
[0016] The sliding processing unit is configured to calculate a current index value through the current content offset of the sliding container in response to a sliding operation of a user.
[0017] The short video player view controlling unit is configured to play the short video player view in the visual area of the video playing terminal according to the current index value and a preset rule, and pause the short video player view in the non-visual area of the video playing terminal.
[0018] A computer readable storage medium, which stores a program, the program is executed by a processor to implement the short video display method.
[0019] An electronic device, comprising at least one processor, and at least one memory connected with the processor, a bus; wherein the processor, the memory complete mutual communication through the bus; the processor is used to call the program instruction in the memory, to execute the short video display method.
[0020] By the above technical solution, the short video display method, device, storage medium and electronic device provided by the application obtain current device information of a video playing terminal, judge the current device performance state of the video playing terminal according to the current device information, set the number of reusable short video player views according to the current device performance state, initialize a sliding container containing each short video player view, and set a unique identification value for each short video player view, calculate a current index value through the current content offset of the sliding container in response to a sliding operation of a user, and play the short video player view in the visual area of the video playing terminal according to the current index value and a preset rule, and pause the short video player view in the non-visual area of the video playing terminal. The application dynamically evaluates the device performance of the video playing terminal, dynamically sets the number of reusable short video player views and optimizes the playing strategy, thereby effectively reducing resource waste and memory jitter, realizing smooth playing of short videos, and improving the watching experience of users.
[0021] The above description is only a summary of the technical solutions of the present application. In order to make the technical means of the present application more clearly understood and implemented according to the content of the specification, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS
[0022] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not meant to limit the present application. Furthermore, the same reference numerals are used throughout the several drawings to denote the same or similar components. In the drawings:
[0023] Figure 1 A flowchart of an embodiment of a short video display method provided by an embodiment of the present application is shown;
[0024] Figure 2 A schematic diagram of a judgment process of a device performance state provided by an embodiment of the present application is shown;
[0025] Figure 3 A schematic diagram of another judgment process of a device performance state provided by an embodiment of the present application is shown;
[0026] Figure 4 An explanatory schematic diagram of setting a unique identifier of a short video player view provided by an embodiment of the present application is shown;
[0027] Figure 5 An explanatory schematic diagram of single-view movement provided by an embodiment of the present application is shown;
[0028] Figure 6 An explanatory schematic diagram of multi-view movement provided by an embodiment of the present application is shown;
[0029] Figure 7 An explanatory schematic diagram of resource recycling provided by an embodiment of the present application is shown;
[0030] Figure 8 An explanatory schematic diagram of dynamic expansion provided by an embodiment of the present application is shown;
[0031] Figure 9 A structural schematic diagram of a short video display device provided by an embodiment of the present application is shown;
[0032] Figure 10 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0033] Exemplary embodiments of the present application will be described herein below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it is understood that the present application can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0034] With the rapid development of mobile Internet technology, short videos have become an indispensable part of users' daily life. However, the traditional short video playback scheme usually preloads a fixed number of player instances, which cannot be dynamically adjusted according to device performance. This approach leads to a phenomenon of stuttering in the playback process for low-end devices, while high-end devices may waste computing power and power due to resource surplus. At the same time, when the short video list is sliding, frequent creation and destruction of player instances will cause memory jitter, resulting in interface stuttering. This phenomenon seriously affects the user's viewing experience, especially in the fast sliding scenario. In addition, the prior art fails to comprehensively consider multiple factors such as device memory, CPU core number, battery state, power, and temperature state when formulating a playback strategy. This defect makes the short video playback relatively weak in energy management, especially in a low-power environment, and the device's endurance is not effectively guaranteed.
[0035] Based on this, in the embodiments of the present application, a short video display method is provided, which acquires device information of a video playback terminal, judges the performance state of the device, and dynamically sets the number of reusable short video player views according to the judgment result. The specific process includes checking the physical memory, CPU core number, battery power, low-power mode, and temperature state to determine whether the device is in a high-performance or low-performance state. Then, the sliding container view is initialized, and a unique identifier is set for the player view. During sliding processing, the current index value is calculated according to the current content offset, and the short video player in the visible area is played according to the preset rule, while other players are paused to optimize performance. In addition, dynamic resource management is performed by monitoring the device state to ensure the balance between performance and energy efficiency, and the number and resolution of player instances are automatically adjusted to improve user experience and device endurance. It can be seen that the intelligent adaptive short video playlist scheme designed by the present application can reduce device load and provide smooth short video playback services on different devices, achieving collaborative optimization of playback smoothness and energy efficiency, thereby comprehensively improving user experience.
[0036] As shown in FIG. 1, an embodiment of the short video display method provided by the present application includes the following steps: Figure 1
[0037] S100, obtain the current device information of a video playback terminal.
[0038] wherein the video playback terminal refers to a device that can play video content, such as a smartphone, tablet, smart TV, computer, and the like.
[0039] wherein the current device information refers to various hardware and software state data obtained from the video playback terminal at a specific time.
[0040] Optionally, the current device information can include the physical memory, CPU core number, battery charging state, battery level, low power mode, and temperature state of the video playback terminal at the current time.
[0041] wherein the physical memory (physicalMemory) refers to the size of the random access memory (RAM) available in the video playback terminal, which determines the smoothness of the video playback terminal when running multiple programs simultaneously.
[0042] wherein the CPU core number (activeCores) refers to the number of cores of the central processing unit of the video playback terminal, which affects the ability of the device to handle multiple tasks and complex calculations.
[0043] wherein the battery charging state (batteryState) refers to whether the battery of the video playback terminal is currently in a charging state, which affects the performance and availability of the video playback terminal.
[0044] wherein the battery level (batteryLevel) refers to the percentage of the remaining battery capacity of the video playback terminal, which determines the usage time of the video playback terminal.
[0045] wherein the low power mode (isLowPowerModeEnabled) refers to whether the video playback terminal has enabled a low power mode, which is designed to extend battery life and usually reduces the performance of the video playback terminal.
[0046] wherein the temperature state (thermalState) refers to the temperature condition of the video playback terminal, which can be generally divided into normal, warming, high, and critical states, affecting the performance and stability of the video playback terminal.
[0047] Specifically, the embodiments of the present application can obtain various hardware and software state information of the video playback terminal by calling the system information API (Application Programming Interface) of the video playback terminal.
[0048] As some examples, the embodiments of the present application can use a system memory management interface to obtain the physical memory size, query processor information to obtain the CPU core number, call a battery management interface to obtain the battery charging status and power, check the low-power mode through a system setting API, and monitor the device temperature through a temperature sensor interface.
[0049] S110, judging the current device performance state of the video playing terminal according to the current device information.
[0050] The current device performance state refers to the overall performance of the video playing terminal evaluated according to the current device information, which can be divided into a high performance state and a low performance state, or a high performance state, a medium performance state and a low performance state, and is used to determine the allocation of system resources and the running effect of applications.
[0051] Specifically, the embodiments of the present application can comprehensively evaluate and analyze the physical memory, the CPU core number, the battery charging status, the battery power, the low-power mode and the temperature state of the video playing terminal at the current time, save the evaluation result as a "high performance" or "low performance" identifier, and guide the subsequent steps.
[0052] As some examples, the embodiments of the present application can set a threshold value, evaluate the usage rate of the physical memory and the CPU core number, and determine that the device is in a low performance state if the physical memory is lower than a certain threshold value or the CPU load is too high.
[0053] S120, setting the number of reusable short video player views according to the current device performance state, initializing a sliding container containing each short video player view, and setting a unique identification value for each short video player view.
[0054] The short video player view refers to a user interface component for displaying short video content. Each short video player view can accommodate a video player and provide the functions of playing, pausing and interacting with short videos.
[0055] The sliding container is a slidable view element, which is used for sliding switching between multiple short video player views, and facilitates users to browse short videos.
[0056] The unique identification value (tag) refers to a unique identifier assigned to each short video player view, which is used to distinguish different short video player views and can appear in the form of sequential numbers (such as 10001, 10002, etc.).
[0057] Specifically, the embodiment of the present application can set the number of short video player views according to the current device performance state of the video playing terminal. If the video playing terminal is in a high performance state, more short video player views are allowed to be initialized, while in a low performance state, the number of short video player views to be initialized is reduced. A sliding container is initialized, and a unique identification value is generated for each short video player view to ensure that each view can be uniquely identified in the system.
[0058] As some examples, if the video playing terminal is in a high performance state, 5 short video player views are allowed to be initialized, while in a low performance state, 2 short video player views are allowed to be initialized, and an incremental integer value or a UUID (Universally Unique Identifier) is used to generate a unique identification value for each short video player view.
[0059] S130, in response to the sliding operation of the user, a current index value is calculated through a current content offset of the sliding container.
[0060] Wherein, the current content offset refers to the offset value of the content in the sliding container, indicating the position of the current viewable area in the entire content, and is used to determine the view index currently viewed by the user.
[0061] Wherein, the current index value refers to the index position of the currently viewable short video player view in all player views calculated, and is used to identify the short video player view of the viewable area of the video playing terminal.
[0062] Specifically, the embodiment of the present application can obtain the current content offset by listening to the events of the sliding container when the user performs the sliding operation. The index value of the short video player view in the current viewable area is calculated by using the relationship between the current content offset and the width or height of each short video player view.
[0063] As some examples, if the width of each short video player view is 300 pixels and the current offset is 750 pixels, the current index value is 750 / 300=2, indicating that the user is currently viewing the third short video player view.
[0064] S140, according to the current index value and the preset rule, the short video player view of the viewable area of the video playing terminal is positioned and played, while the short video player view of the non-viewable area of the video playing terminal is paused.
[0065] Among them, the preset rules refer to the rules used to determine how to switch the short video player view when the index value changes, and how to handle the state of the short video player view (such as play and pause).
[0066] The visible area refers to the short video player view that the user can currently see in the sliding container. The short video player view in the visible area will be activated to play the video.
[0067] The non-visual areas are short video player views that are not currently visible to the user. These short video player views are only activated when the user swipes over them, and will pause playback to save resources when the user does not touch them.
[0068] Specifically, in this embodiment of the invention, the corresponding short video player view in the sliding container can be located based on the current index value, and the playback function of the short video player view can be started according to preset rules (such as only playing short video player views in the visible area). At the same time, the pause method of other non-visible area views can be called to reduce resource consumption and optimize performance, ensure the smoothness of user experience, and take into account device performance and battery life.
[0069] This invention provides a short video display method, which includes: obtaining current device information of a video playback terminal; determining the current device performance status of the video playback terminal based on the current device information; setting the number of reusable short video player views using the current device performance status, initializing a sliding container containing each short video player view, and setting a unique identifier value for each short video player view; responding to the user's sliding operation, calculating the current index value through the current content offset of the sliding container; locating and playing the short video player views in the visible area of the video playback terminal according to the current index value and preset rules, while pausing the short video player views in the non-visible areas of the video playback terminal. This invention effectively reduces resource waste and memory jitter by dynamically evaluating the device performance of the video playback terminal, dynamically setting the number of reusable short video player views, and optimizing playback strategies, thereby achieving smooth playback of short videos and improving the user's viewing experience.
[0070] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S110 may specifically include:
[0071] Based on the combination of multiple device parameters in the current device information, the current device performance status of the video playback terminal is determined by a preset evaluation logic. The preset evaluation logic is used to dynamically classify the performance status level according to the changes in device parameters. The current device performance status is low performance, medium performance, or high performance.
[0072] Specifically, in this embodiment of the invention, multiple device parameters can be selected and combined from physical memory, number of CPU cores, battery charging status, battery level, low power mode, and temperature status. Based on the specific values of these device parameters, a preset evaluation logic is used to determine whether the current device performance status of the video playback terminal is in a low performance state, a medium performance state, or a high performance state.
[0073] Optionally, embodiments of the present invention may determine whether the physical memory is less than a first memory threshold; if so, the current device performance state of the video playback terminal is determined to be a low-performance state. If the physical memory is equal to or greater than the first memory threshold, the system determines whether the number of CPU cores is greater than or equal to a first preset CPU core threshold; if not, the current device performance state of the video playback terminal is determined to be a low-performance state. If the number of CPU cores is greater than or equal to the first preset CPU core threshold, the system determines whether battery charging is enabled; if so, the current device performance state of the video playback terminal is determined to be a low-performance state. If battery charging is not enabled, the system determines whether the battery level is greater than a first preset remaining battery level threshold; if not, the current device performance state of the video playback terminal is determined to be a low-performance state. If the battery level is greater than the first preset remaining battery level threshold, the system determines whether low-power mode is enabled; if so, the current device performance state of the video playback terminal is determined to be a low-performance state. If low-power mode is not enabled, the system determines whether the temperature is within a first preset reasonable temperature range; if not, the current device performance state of the video playback terminal is determined to be a low-performance state; if so, the current device performance state of the video playback terminal is determined to be a high-performance state.
[0074] The first memory threshold refers to the minimum physical memory that should be available when evaluating the performance of a video playback terminal. If the physical memory is less than the first memory threshold, the video playback terminal is considered to be in a low-performance state.
[0075] Understandably, the first memory threshold can be set based on the memory requirements of the video playback terminal and the operating characteristics of the application. Typically, low memory usage may cause applications to frequently exchange data (e.g., using virtual memory), thus impacting performance. The specific value of the first memory threshold can be adjusted according to the configuration of different video playback terminals and the target usage scenario. For example, for low-end devices, the first memory threshold may be set lower, while for high-end devices, it can be set higher.
[0076] The first preset CPU core threshold refers to the minimum standard that the number of CPU cores should meet when evaluating the performance of a video playback terminal. If the number of CPU cores is less than the first preset CPU core threshold, the video playback terminal is judged to be in a low-performance state.
[0077] Understandably, the number of CPU cores directly affects the multitasking capabilities of a video playback terminal; the more cores, the stronger the performance of the video playback terminal when processing parallel tasks. The first preset CPU core threshold is related to the computational needs of the application providing short video services.
[0078] The first preset remaining battery power threshold refers to the minimum battery level that should be reached when evaluating the performance of the video playback terminal. If the battery power is less than the first preset remaining battery power threshold, the video playback terminal is determined to be in a low-performance state.
[0079] Understandably, the setting of the first preset remaining battery power threshold is related to the battery life of the video playback terminal and the user experience, and can be set to 10%-20% of the battery capacity of the video playback terminal. For example, if the battery capacity of the video playback terminal is 2000mAh, the first preset remaining battery power threshold can be set to 200mAh to 400mAh.
[0080] The first preset reasonable temperature range refers to the safe and effective operating range that the video playback terminal's temperature should maintain when evaluating its performance. If the video playback terminal's temperature is outside the first preset reasonable temperature range, the video playback terminal is judged to be in a low-performance state.
[0081] Understandably, the operating temperature of a video playback terminal directly affects its performance and stability. Excessively high or low temperatures can lead to decreased hardware performance and may even damage the device. The optimal operating temperature range for a video playback terminal is between 0°C and 85°C.
[0082] As some examples, see Figure 2The diagram illustrates a process for determining the performance status of a device. In this embodiment, the physical memory of the video playback terminal is obtained. First, it is determined whether the video playback terminal is a modern device, with the standard being whether the physical memory is greater than or equal to 6GB. If the video playback terminal is not a modern device and the physical memory is less than 4GB, it is directly determined to be in a low-performance state. The number of currently active CPU cores is obtained. For modern devices (physical memory ≥ 6GB), at least 6 CPU cores are required; for non-modern devices, at least 4 cores are required. If the number of cores is insufficient, it is determined to be in a low-performance state. The battery monitoring function is enabled (batteryMonitoringEnabled=YES), and the current battery level (batteryLevel) and charging status (batteryState) are obtained. If the current battery level is less than or equal to 25% and the video playback terminal is not charging, it is determined to be in a low-performance state. If the video playback terminal is charging, it is also determined to be in a low-performance state. The low-power mode is checked to see if it isLowPowerModeEnabled. If low-power mode is enabled, it is determined to be in a low-performance state. The current temperature state (thermalState) of the video playback terminal is obtained. The iOS system provides four temperature statuses: Normal: Normal operating temperature range; Fair: Device starts to heat up, performance may be limited; Serious: Device temperature is high, may trigger frequency throttling or performance limiting; Critical: Device temperature is too high, may force frequency throttling or suspend high-performance operations. If the temperature status is Serious or Critical, it is considered a low-performance state. If all the above checks pass, the video playback terminal performs well and can be considered a high-performance state.
[0083] It's important to note that the process of determining the current device performance status of a video playback terminal follows a strict sequence. If any condition is not met, the device will be immediately classified as low-performance, avoiding further checks. The checks prioritize conditions with lower computational costs (such as memory and CPU), and then check more time-consuming conditions (such as temperature) last. The process for determining the current device performance status of the video playback terminal also features compatibility with dynamic thresholds, allowing adjustments to the CPU core count requirement based on device type (e.g., modern versus older devices) to improve flexibility.
[0084] This invention, through a systematic evaluation of the performance status of the video playback terminal, can provide a reliable basis for the subsequent display of the short video playlist, thereby achieving smooth playback of short videos and ensuring the smoothness and stability of the user experience.
[0085] Optionally, in this embodiment of the invention, it can determine whether the number of CPU cores is greater than or equal to a second preset CPU core threshold. If not, the current device performance state of the video playback terminal is determined to be medium performance. If the number of CPU cores is greater than or equal to the second preset CPU core threshold, it can determine whether battery charging is enabled. If yes, the current device performance state of the video playback terminal is determined to be medium performance. If battery charging is not enabled, it can determine whether the battery level is greater than a second preset remaining battery level threshold. If no, the current device performance state of the video playback terminal is determined to be medium performance. If the battery level is greater than the second preset remaining battery level threshold, it can determine whether low-power mode is enabled. If yes, the current device performance state of the video playback terminal is determined to be low performance. If low-power mode is not enabled, it can determine whether the temperature is within a second preset reasonable temperature range. If no, the current device performance state of the video playback terminal is determined to be low performance; if yes, the current device performance state of the video playback terminal is determined to be high performance.
[0086] The second preset CPU core threshold refers to the standard that the number of CPU cores should meet when evaluating the performance of a video playback terminal. If the number of CPU cores is less than the second preset CPU core threshold, the video playback terminal is judged to be in a medium performance state.
[0087] The second preset remaining battery power threshold refers to the minimum battery level that should be reached when evaluating the performance of the video playback terminal. If the battery power is lower than the second preset remaining battery power threshold, the video playback terminal is determined to be in a low-performance state.
[0088] The second preset reasonable temperature range refers to the safe and effective operating range that the video playback terminal's temperature should maintain when evaluating its performance. If the video playback terminal's temperature is outside the second preset reasonable temperature range, the video playback terminal is judged to be in a low-performance state.
[0089] As some examples, see Figure 3The diagram illustrates another process for determining the device performance status. In this embodiment of the invention, if the video playback terminal is confirmed to be a modern device, it can first determine whether the physical memory of the video playback terminal is greater than or equal to 6GB. If so, it then checks whether the video playback terminal is charging and whether its battery level is greater than 25%. If the physical memory of the video playback terminal is less than 6GB, or the video playback terminal is charging, or its battery level is less than or equal to 25%, it is directly determined that the video playback terminal is in a medium performance state. If the battery level of the video playback terminal is greater than 25%, it checks whether the video playback terminal is in low-power mode and its temperature status. If the video playback terminal is in low-power mode or its temperature status is Serious or Critical, it is determined to be in a low performance state. If all the above checks pass, the video playback terminal has good performance and can be determined to be in a high performance state.
[0090] This invention supports three performance levels—low, medium, and high—for the device, which more accurately reflects the performance of the video playback terminal under different loads and usage scenarios. This allows for the adoption of more diverse resource management strategies to support short video display, improving resource management efficiency, optimizing user experience, and providing more flexible strategies for adjusting the performance of short video applications, thus balancing the smoothness of short video display with energy consumption.
[0091] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S120 may specifically include:
[0092] The number of reusable short video player views is determined by the current device performance status. Pagination attributes, delegates, layout attributes, and sliding direction are configured for the sliding container containing each short video player view. A continuous and unique identifier is set for each short video player view.
[0093] In this context, paging refers to the functionality implemented by a scrollable view control, allowing content to automatically align to specific page boundaries as the user scrolls. For example, in iOS, the `pagingEnabled` property of `UIScrollView` is used to set paging functionality. When this property is set to `YES`, the scroll view automatically aligns to the nearest content boundary as the user scrolls. In Android, `ViewPager` or `ViewPager2` implements the paging effect, allowing users to switch between multiple pages using swipe gestures.
[0094] In this context, delegation refers to a design pattern that allows one object to send messages to another, used for handling events or data transfer. For example, in iOS, the UIScrollViewDelegate protocol defines a series of methods that, when implemented, respond to scroll events, end scrolling, and perform other operations. By setting a delegate, scrolling behavior and page transition effects can be controlled. In Android, ViewPager implements the ViewPager.OnPageChangeListener interface to set up listeners for page changes, receiving callbacks when pages switch to handle corresponding logic, such as loading new content or updating the interface.
[0095] In this context, layout attributes define the position and size of the short video player view within the sliding container. In iOS, the `frame` attribute is a `CGRect` structure containing `origin` (position) and `size` (size) properties. Setting the `frame` determines the view's specific position and space on the screen. In Android, the `LayoutParams` attribute defines how the short video player view is laid out within the sliding container. The specific layout method may vary depending on the layout type used (such as `LinearLayout`, `RelativeLayout`, or `ConstraintLayout`).
[0096] The swipe direction refers to the direction in which content moves when the user scrolls or swipes, and can be divided into horizontal and vertical. For example, in iOS, UIScrollView supports both horizontal and vertical swipes, and the contentSize can be set according to the content layout to achieve the desired swipe direction. In Android, ScrollView is used for vertical swipes, while HorizontalScrollView is used for horizontal swipes. The appropriate component can be selected as needed, and its scroll property can be set to meet different swipe requirements.
[0097] As examples, embodiments of the present invention can initialize a list of short video player objects based on the current device performance state. If the video playback terminal is in a high-performance state, the number of reusable short video player views can be set to 5; while in a medium or low-performance state, it can be set to 3. Next, a sliding container view object is created (e.g., UIScrollView in iOS). The number of short video player views in the sliding container is dynamically set according to the different performance states of the video playback terminal. Then, the sliding container properties are configured: enabling the sliding container's pagination function so that users can quickly jump to each player view while sliding. A delegate for the sliding container is set to handle sliding events and page changes. A frame is configured for the sliding container to ensure its position and size are appropriate within the parent view. The sliding direction is configured according to the application's needs. If vertical sliding is required, contentSize is set to CGSizeMake(frame.size.width, count*frame.size.height); if horizontal sliding is required, it is set to CGSizeMake(count*frame.size.width, frame.size.height). The initial value of the sliding container's contentOffset is set to CGPointZero to ensure that the user sees the first short video player view at the beginning. Reference Figure 4 The diagram illustrates the unique identifier settings for each short video player view. In this embodiment of the invention, a unique tag identifier can be assigned sequentially to each short video player view. For example, when the number of short video player views is 3, the tags for each view can be set to 10001 to 10003; if the number is 5, they are set to 10001 to 10005. Finally, all the frame-based short video player views are added to the sliding container to form the initial view hierarchy, ensuring that users can smoothly slide between different video players.
[0098] By making reasonable use of pagination attributes, delegates, layout attributes, and scrolling direction, this invention can create an efficient and user-friendly short video player view, thereby helping to achieve a smooth visual experience for short video display.
[0099] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S140 may specifically include:
[0100] The current index value is converted into a target identifier value according to preset rules; the target identifier value is used to locate the short video player view in the visible area of the video playback terminal for playback, while the short video player view in the non-visible area of the video playback terminal is paused.
[0101] Specifically, in this embodiment of the invention, after the user finishes swiping, the `contentOffset` property of the swiping container can be used to calculate the currently displayed `currentIndex` index value. `currentIndex` represents the index of the short video player view currently displayed in the visible area. If the calculated `currentIndex` is the same as the index value before swiping, no operation is performed, and the current playback state is maintained. When `currentIndex` is different from the previous index, the current index value is converted into a target identifier value (tag) according to a preset rule. For example, the starting value of the index value is set to 1, which is used as the index of the currently visible short video player view. Using the preset rule: `tag = 10000 + currentIndex`, the unique identifier of the short video player view corresponding to the current index can be obtained. Using the calculated `targetTag` value, the corresponding short video player view can be quickly located. The `viewWithTag(targetTag)` method (iOS) or the `findViewById(targetTag)` method (Android) can be used to directly obtain the short video player view in the currently visible area. Once the corresponding short video player view is found, it will begin playing the video. At the same time, pause all other short video player views in non-visible areas to optimize performance and conserve device resources, ensuring users only hear and see the currently playing video, thus improving user experience. In practical applications, this can be achieved by maintaining a list of short video player views, setting the playback status of short video player views in non-visible areas to pause, and keeping only the short video player views in the currently visible area in "playing" mode.
[0102] This invention effectively controls the playback and pause of the short video player view by calculating the index after the user finishes swiping and transforming the target identifier value. This not only improves application performance but also ensures the user's viewing experience, allowing for smooth switching when browsing multiple short videos in succession.
[0103] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the method may further include:
[0104] If the current index value exceeds the preset index threshold, the short video player view at the top will be moved to the bottom to achieve the effect of a circular list.
[0105] Specifically, in this embodiment of the invention, when the current index value exceeds a preset index threshold, the short video player view will be cyclically moved. For example, when the number of short video player views is 3, the preset index threshold can be 2; and when the number of short video player views is 5, the preset index threshold can be 3. If the currently visible short video player view is the first view at the top, it will be moved to the bottom, thereby achieving the effect of a circular list. For the case where the number of short video player views is 3, the short video player views are [1,2,3]. If the current index value changes and exceeds the preset index threshold, the view will be adjusted to [2,3,1]. For the case where the number of short video player views is 5, the short video player views are [1,2,3,4,5]. If the current index value changes and exceeds the preset index threshold, the short video player views can be adjusted accordingly to [2,3,4,5,1] or [3,4,5,1,2]. After moving the short video player view, the tag values of all short video player views are reset and the contentOffset property is updated to center the currently visible short video player view. This not only avoids unnecessary playback state switching, but also ensures smooth scrolling and visual continuity through view reuse and position correction.
[0106] As some examples, see Figure 5 The illustration shows the movement of a single view. Assume the short video player views are initially ordered as [10001, 10002, 10003, 10004, 10005], with short video player view 10003 being the visible area. After the slide, the visible area becomes short video player view 10004, and then short video player view 10001 is moved to the bottom. The final order of the short video player views becomes [10002, 10003, 10004, 10005, 10001]. Finally, the unique identifier value is reset, and the original order is restored to [10001, 10002, 10003, 10004, 10005].
[0107] As some other examples, see Figure 6The diagram illustrating the multi-view movement assumes that the short video player views are initially ordered as [10001, 10002, 10003, 10004, 10005], with short video player view 10003 being the visible area. After the slide, the visible area becomes short video player view 10005. Subsequently, short video player views 10001 and 10002 are moved to the bottom, resulting in the final order of the short video player views as [10003, 10004, 10005, 10001, 10002]. Finally, the unique identifier value is reset, restoring the original order to [10001, 10002, 10003, 10004, 10005].
[0108] This invention achieves a looping effect by moving the view, ensuring a smooth experience for users watching short videos and avoiding stuttering or interruptions.
[0109] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the method may further include:
[0110] When the current device performance status changes, dynamically adjust the number of views, preload range and / or video resolution of the short video player, and perform resource reclamation or expansion operations.
[0111] Specifically, embodiments of the present invention can periodically monitor the current device performance status of the video playback terminal through periodic detection and event triggering mechanisms.
[0112] As some examples, the periodic detection process could be: setting a timer to check the current device performance status of the video playback terminal every 5 minutes, which could include indicators such as physical memory, number of CPU cores, battery charging status, battery level, low power mode, and temperature status.
[0113] As some examples, an event-triggered mechanism could be to immediately check the current device performance status of the video playback terminal when a specific event occurs (such as a user switching to the background or foreground, or a delay in the response time of the application interface).
[0114] Specifically, in the event of a performance degradation in the current device performance state, this embodiment of the invention can immediately perform a resource reclamation operation, reduce the number of player instances, remove unnecessary short video player views, and then update the unique identifier value of the remaining player instances.
[0115] As some examples, see Figure 7The illustrated diagram illustrates resource reclamation. If the current device performance status changes from high performance to low performance, a resource reclamation operation is immediately performed: the number of player instances is reduced from 5 to 3, and the short video player views with unique identifiers of 10001 and 10005 at the beginning and end are removed. The unique identifiers of the remaining short video player views are remapped from [10002, 10003, 10004] to [10001, 10002, 10003].
[0116] Specifically, in the case of a performance upgrade in the current device performance state, the embodiments of the present invention can immediately perform a dynamic expansion operation, add player instances, add short video player views, and then reset the unique identifier value of the corresponding short video player view to a continuous sequence based on the current player instance.
[0117] As some examples, see Figure 8 The illustration shows the dynamic expansion process. If the current device performance status changes from low performance to high performance, a dynamic expansion operation is immediately performed: the number of player instances is expanded from 3 to 5, and short video player views with unique identifiers of 10004 and 10005 are added. The unique identifiers of each short video player view are reset to a continuous sequence [10001, 10002, 10003, 10004, 10005].
[0118] Specifically, the dynamic adjustment of the preloading range of the short video player view in this embodiment of the invention can be as follows: In low-performance mode, the preloading operation of the short video player view in non-visible areas is disabled to save bandwidth resources. In medium-performance mode, normal preloading operation of the short video player view is allowed. In high-performance mode, the preloading operation of the short video player view in non-visible areas can be restored to ensure that the user experience is not affected.
[0119] As examples, the preloading range of short video player views is intelligently adjusted based on the dynamically set number of short video player views to optimize the user experience. When the number of short video player views is 3, one short video player view is preloaded above and below the current visible area; while when the number of short video player views is 5, two short video player views are preloaded above and below to ensure that users can quickly access video content while swiping and avoid delays.
[0120] Specifically, in this embodiment of the invention, the dynamic adjustment of the video resolution of the short video player view can be as follows: when the current device performance degrades, the video resolution is automatically reduced (e.g., from 1080p to 720p) to alleviate the burden on the video playback terminal. When the current device performance upgrades, the video resolution is intelligently increased (e.g., from 720p to 1080p) to optimize the user viewing experience.
[0121] Furthermore, embodiments of the present invention can utilize intelligent memory reclamation and pre-allocation mechanisms to ensure optimal resource utilization when the current device performance changes: during performance degradation, unnecessary resources are promptly reclaimed and memory is released. During performance upgrades, a certain amount of resources can be pre-allocated to quickly respond to user needs.
[0122] This invention dynamically adjusts the resource configuration of the short video player view when the current device performance state changes, ensuring a good user experience under different performance states, while extending device battery life and resource utilization, so as to achieve the optimal balance between performance and energy efficiency while ensuring user experience.
[0123] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0124] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0125] Corresponding to the above method embodiments, this invention also provides a short video display device, the structure of which is as follows: Figure 9 As shown, it may include: a current device information acquisition unit 10, a current device performance status judgment unit 20, a short video player initialization unit 30, a sliding processing unit 40, and a short video player view control unit 50.
[0126] The current device information acquisition unit 10 is used to acquire the current device information of the video playback terminal.
[0127] The current device performance status judgment unit 20 is used to judge the current device performance status of the video playback terminal based on the current device information.
[0128] The short video player initialization unit 30 is used to set the number of reusable short video player views based on the current device performance status, initialize the sliding container containing each short video player view, and set a unique identifier value for each short video player view.
[0129] The sliding processing unit 40 is used to calculate the current index value based on the current content offset of the sliding container in response to the user's sliding operation.
[0130] The short video player view control unit 50 is used to locate the short video player view in the visible area of the video playback terminal according to the current index value and preset rules for playback, while pausing the short video player view in the non-visible area of the video playback terminal.
[0131] Optionally, the short video display device may also include a dynamic adjustment unit.
[0132] The dynamic adjustment unit is used to dynamically adjust the number of views, preload range, and / or video resolution of the short video player when the current device performance status changes, and to perform resource reclamation or expansion operations.
[0133] Optionally, the current device performance status judgment unit 20 is specifically used to judge the current device performance status of the video playback terminal based on a combination of multiple device parameters in the current device information and through a preset evaluation logic. The preset evaluation logic is used to dynamically classify the performance status level according to the changes in device parameters, and the current device performance status is low performance status, medium performance status or high performance status.
[0134] Optionally, the current device information includes the video playback terminal's physical memory, number of CPU cores, battery charging status, battery level, low-power mode, and temperature status at the current moment.
[0135] Optionally, the short video player initialization unit 30 can be used to set the number of reusable short video player views based on the current device performance status, configure pagination attributes, delegates, layout attributes and sliding direction for the sliding container containing each short video player view, and set a continuous unique identifier for each short video player view.
[0136] Optionally, the short video player view control unit 50 can be used to convert the current index value into a target identifier value according to a preset rule; use the target identifier value to locate the short video player view in the visible area of the video playback terminal for playback, while pausing the short video player view in the non-visible area of the video playback terminal.
[0137] Optionally, the short video display device may also include a view movement unit.
[0138] The view movement unit is used to move the short video player view at the top to the bottom when the current index value exceeds a preset index threshold, so as to achieve the effect of a circular list.
[0139] This invention provides a short video display device, which is used to: obtain the current device information of a video playback terminal; determine the current device performance status of the video playback terminal based on the current device information; set the number of reusable short video player views using the current device performance status, initialize a sliding container containing each short video player view, and set a unique identifier value for each short video player view; respond to the user's sliding operation, calculate the current index value through the current content offset of the sliding container; locate and play the short video player views in the visible area of the video playback terminal according to the current index value and preset rules, while pausing the short video player views in the non-visible areas of the video playback terminal. This invention effectively reduces resource waste and memory jitter by dynamically evaluating the device performance of the video playback terminal, dynamically setting the number of reusable short video player views, and optimizing playback strategies, thereby achieving smooth playback of short videos and improving the user's viewing experience.
[0140] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0141] The short video display device includes a processor and a memory. The aforementioned current device information acquisition unit 10, current device performance status judgment unit 20, short video player initialization unit 30, sliding processing unit 40, and short video player view control unit 50 are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0142] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, device performance can be dynamically evaluated, player view usage and playback strategies optimized, effectively reducing resource waste and memory jitter, thereby achieving smoother playback of short videos and significantly improving the user viewing experience.
[0143] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the short video display method.
[0144] This invention provides a processor for running a program, wherein the program executes the short video display method during runtime.
[0145] like Figure 10As shown, this embodiment of the invention provides an electronic device 1000, which includes at least one processor 1001, at least one memory 1002 connected to the processor 1001, and a bus 1003. The processor 1001 and the memory 1002 communicate with each other via the bus 1003. The processor 1001 is used to call program instructions in the memory 1002 to execute the aforementioned short video display method. The electronic device in this document can be a server, PC, PAD, mobile phone, etc.
[0146] The present invention also provides a computer program product that, when executed on an electronic device, is suitable for executing a program that initializes a short video display method step.
[0147] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0148] In a typical configuration, an electronic device includes one or more processors (CPUs), memory, and a bus. The electronic device may also include input / output interfaces, network interfaces, etc.
[0149] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM, and memory includes at least one memory chip. Memory is an example of computer-readable media.
[0150] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0151] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0152] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0153] In the description of this invention, it should be understood that if the terms "upper", "lower", "front", "rear", "left" and "right" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the position or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0154] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0155] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0156] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the present invention.
Claims
1. A method for displaying short videos, characterized in that, include: Obtain the current device information of the video playback terminal; The current device performance status of the video playback terminal is determined based on the current device information; The number of reusable short video player views is set using the current device performance status, a sliding container containing each short video player view is initialized, and a unique identifier value is set for each short video player view. In response to the user's swipe gesture, the current index value is calculated based on the current content offset of the swipe container; Based on the current index value and preset rules, the short video player view in the visible area of the video playback terminal is located and played, while the short video player view in the non-visible area of the video playback terminal is paused.
2. The method according to claim 1, characterized in that, Also includes: If the current device performance status changes, dynamically adjust the number of short video player views, preload range, and / or video resolution, and perform resource reclamation or expansion operations.
3. The method according to claim 1, characterized in that, The step of determining the current device performance status of the video playback terminal based on the current device information includes: Based on the combination of multiple device parameters in the current device information, the current device performance status of the video playback terminal is determined by a preset evaluation logic. The preset evaluation logic is used to dynamically classify the performance status level according to the changes in the device parameters. The current device performance status is low performance, medium performance, or high performance.
4. The method according to claim 3, characterized in that, The current device information includes the video playback terminal's physical memory, number of CPU cores, battery charging status, battery level, low power mode, and temperature status at the current moment.
5. The method according to claim 1, characterized in that, The process of determining the number of reusable short video player views based on the current device performance status, initializing a sliding container containing each short video player view, and setting a unique identifier for each short video player view includes: The number of reusable short video player views is set using the current device performance status. Pagination attributes, delegates, layout attributes, and sliding directions are configured for the sliding container containing each short video player view. A continuous and unique identifier is set for each short video player view.
6. The method according to claim 1, characterized in that, The step of locating and playing the short video player view of the visible area of the video playback terminal according to the current index value and preset rules, while pausing the short video player view of the non-visible area of the video playback terminal, includes: The current index value is converted into a target identifier value according to preset rules; The target identifier value is used to locate and play the short video player view in the visible area of the video playback terminal, while pausing the short video player view in the non-visible area of the video playback terminal.
7. The method according to claim 1, characterized in that, Also includes: If the current index value exceeds a preset index threshold, the short video player view at the top will be moved to the bottom to achieve the effect of a circular list.
8. A short video display device, characterized in that, include: The system comprises a current device information acquisition unit, a current device performance status judgment unit, a short video player initialization unit, a sliding processing unit, and a short video player view control unit. The current device information acquisition unit is used to acquire the current device information of the video playback terminal; The current device performance status determination unit is used to determine the current device performance status of the video playback terminal based on the current device information; The short video player initialization unit is used to set the number of reusable short video player views using the current device performance status, initialize a sliding container containing each short video player view, and set a unique identifier value for each short video player view. The sliding processing unit is used to calculate the current index value based on the current content offset of the sliding container in response to the user's sliding operation. The short video player view control unit is used to locate and play the short video player view in the visible area of the video playback terminal according to the current index value and preset rules, while pausing the short video player view in the non-visible area of the video playback terminal.
9. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the short video display method as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the short video display method as described in any one of claims 1 to 7.