Subtitle display method and electronic device
Patent Information
- Application Number
- CN202610717184.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]然而,现有技术采用多组件独立计算、独立维护状态的架构,从根本上无法避免多视图间因计算时序、主线程调度差异引发的字幕状态撕裂问题,难以实现多行与单行字幕的同步,无法满足车载座舱对字幕显示稳定性与一致性的要求
[0009] Thirdly, an electronic device is provided, including a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, causing the electronic device to perform the methods of the first aspect or any possible implementation thereof.
Smart Images

Figure CN122593890A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart cockpit technology, and more specifically, to a caption display method and electronic device. Background Technology
[0002] With the rapid popularization of smart in-vehicle cockpits, audio playback has become one of the cockpit interaction scenarios. In order to adapt to the diverse display spaces and different viewing needs in the cockpit, the subtitle display needs to have multimodal adaptation capabilities. The industry generally adopts a dual-mode design of multi-line subtitle view and single-line subtitle view. Among them, the multi-line view is used to present the complete subtitle context on the main interface, while the single-line view is adapted to the simplified display in limited spaces such as desktop widgets and navigation split screens.
[0003] In existing in-vehicle subtitle display systems, multi-line subtitle views and single-line subtitle views typically adopt an independent and decoupled design approach. Both types of views directly listen to the player's time update event, and each independently performs subtitle time matching, index calculation, and status update. They achieve subtitle highlighting and switching through their own maintained calculation logic to complete the subtitle display function of dual views.
[0004] However, existing technologies employ an architecture where multiple components are independently computed and maintained, which fundamentally cannot avoid the problem of subtitle state tearing caused by differences in computation timing and main thread scheduling between multiple views. This makes it difficult to achieve synchronization between multi-line and single-line subtitles and fails to meet the requirements of vehicle cockpits for the stability and consistency of subtitle display. Summary of the Invention
[0005] This application provides a subtitle display method and electronic device. The method avoids the problem of subtitle state tearing caused by the difference in the calculation timing of multiple components and the deviation of the main thread scheduling by using a single subject for unified calculation and one-way instruction synchronous distribution. It realizes real-time linkage and synchronization between multi-line subtitle view and single-line subtitle view, and meets the needs of vehicle cockpit for stability of subtitle display effect and consistency of content.
[0006] In a first aspect, a subtitle display method is provided, executed by a first display container. The method includes: determining the current subtitle line corresponding to the playback progress of the target audio during playback; if a second display container for displaying subtitles of the target audio exists, determining the changed subtitle line in response to a change in the current subtitle line, wherein both the second and first display containers are used to display the subtitle line corresponding to the playback progress, and the first display container is also used to display other subtitle lines adjacent to the subtitle line corresponding to the playback progress; and sending the changed subtitle line to the second display container so that the second display container replaces the displayed subtitle line with the changed subtitle line.
[0007] In the above technical solution, the first display container executes the process of matching and determining the corresponding current subtitle line based solely on the playback progress of the target audio during playback. When the second display container, used for simplified subtitle display, is in operation, the first display container uniformly monitors and responds to changes in the current subtitle line, determines the changed subtitle content, and distinguishes between the dual-container display modes. This allows the first display container to fully present the current subtitle line and adjacent context subtitles, while the second display container only displays the corresponding single subtitle line due to space limitations. The first display container then uniformly sends the changed subtitle line to the second display container, allowing the second display container to directly update the subtitle content. Therefore, this application overcomes the shortcomings of existing technologies where multiple views are independently calculated and maintain their own operational states. By using a single entity for unified calculation and unidirectional instruction synchronous distribution, it avoids the subtitle state tearing problem caused by differences in the calculation timing of multiple components and deviations in main thread scheduling. This effectively achieves real-time linkage and synchronization between multi-line subtitle views and single-line subtitle views, meeting the requirements of vehicle cockpits for stable subtitle display effects and consistent content.
[0008] Secondly, a subtitle display device is provided, executed by a first display container. The device includes: a first determining module, configured to determine the current subtitle line corresponding to the playback progress of the target audio during playback; a second determining module, configured to determine the changed subtitle line in response to a change in the current subtitle line, provided that a second display container for displaying subtitles of the target audio exists; both the second and first display containers are used to display the subtitle line corresponding to the playback progress, and the first display container is also used to display other subtitle lines adjacent to the subtitle line corresponding to the playback progress; and a changing module, configured to send the changed subtitle line to the second display container so that the second display container changes the displayed subtitle line to the changed subtitle line.
[0009] Thirdly, an electronic device is provided, including a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, causing the electronic device to perform the methods of the first aspect or any possible implementation thereof.
[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of this application more easily understood, specific embodiments of this application are given below. Attached Figure Description
[0011] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A schematic diagram of a subtitle display system provided in an embodiment of this application; Figure 2 A schematic diagram of the structure of a first display container and a second display container provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; Figure 4 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 1 ; Figure 5 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 2 ; Figure 6 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 3 ; Figure 7 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 4 ; Figure 8 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 5 ; Figure 9 This is a schematic diagram of the structure of a subtitle display device provided in an embodiment of this application. Detailed Implementation
[0012] The technical solutions of this application will now be described clearly and in detail with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B. "And / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A alone, A and B simultaneously, and B alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more.
[0013] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying relative importance or implicitly indicating the number of indicated technical features. Furthermore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0014] In current intelligent vehicle cockpit audio playback scenarios, to adapt to different display spaces and viewing needs, subtitle display generally adopts a dual-mode design of multi-line and single-line. Existing vehicle subtitle display systems use a decoupled implementation method for multi-line and single-line views. Both types of views directly monitor the playback progress and independently complete subtitle matching calculations and status updates. However, its architecture of independent calculation and independent status maintenance by multiple components is prone to subtitle state tearing due to differences in calculation timing and main thread scheduling, making it impossible to achieve synchronization of subtitles in both views. This makes it difficult to meet the requirements of vehicle cockpits for the stability and consistency of subtitle display. Based on this, this application proposes a subtitle display scheme to solve the above-mentioned technical problems.
[0015] Before elaborating on the technical solution, the technical terms used in this application will be explained to facilitate subsequent understanding.
[0016] Single Source of Truth (SSOT) is a software architecture pattern that avoids state discrepancies caused by independent calculations by multiple nodes by providing a unique source of state for a specific data segment in a captioning system.
[0017] Progressive Compensation is a technical mechanism that temporarily stores newly received state requests during the execution of time-consuming UI (User Interface) animations that are blocked, and resumes execution immediately after the current animation is completed.
[0018] The following detailed description of the subtitle display method and electronic device according to embodiments of this application, with reference to the accompanying drawings and multiple examples, will be provided in detail.
[0019] Figure 1 This is a schematic diagram of a subtitle display system provided in an embodiment of this application. Figure 1 As shown, the subtitle display system 100 includes at least: a first display container 110, a second display container 120, and a switching control container 130.
[0020] The first display container 110 includes at least: a subtitle data receiving unit 111, a current subtitle positioning unit 112, an animation determination unit 113, and a linkage notification unit 114.
[0021] The subtitle data receiving unit 111, the current subtitle positioning unit 112, the animation judgment unit 113, and the linkage notification unit 114 are sequentially connected to form a unidirectional, irreversible data flow processing link. This connection relationship follows the master-slave state source architecture and single fact source design principle of this application. All subtitle data, playback timing, animation judgment, and linkage instructions are processed step by step and transmitted unidirectionally along this serial link, without any reverse data interaction. Based on the above architecture, the first display container 110 can constitute the main control module of this application. As the sole computing source, it independently completes all subtitle calculations and state judgments, only sending instructions unidirectionally to the subordinate rendering module (i.e., the second display container), without bidirectional data interaction with the subordinate rendering module. This eliminates state discrepancies caused by multi-path parallel computing at the data link level, ensuring the uniqueness and consistency of the subtitle display state.
[0022] The subtitle data receiving unit 111 is the data input port of the first display container 110, responsible for obtaining the subtitle set data to be played from the local storage module, network parsing module, or player subtitle parsing component of the subtitle display system. This subtitle set data to be played includes at least the following complete information: line-by-line subtitle text, playback timestamp corresponding to each line of subtitle, and total number of subtitle lines, providing basic data support for subsequent subtitle positioning calculations.
[0023] It should be noted that the subtitle data receiving unit 111 only performs data acquisition and caching operations, and does not participate in any time matching, index calculation or other logical processing. After acquisition, it directly transmits the complete subtitle data to the next-level current subtitle positioning unit 112.
[0024] The current subtitle positioning unit 112 is the calculation unit of the first display container 110. As the sole calculation entity, it exclusively listens to the time update timing signal sent by the in-vehicle player and collects the current playback timestamp in real time. When the current subtitle positioning unit 112 receives the data transmitted by the subtitle data receiving unit 111, it internally traverses the timestamp of each line of subtitle data, matches and compares the real-time playback timestamp with the subtitle timestamp, and completes the unique calculation of the current subtitle line index through a preset time threshold matching rule. At the same time, it completes the highlight positioning and vertical scroll offset (Offset) calculation of multiple lines of subtitles within the first display container 110. The current subtitle positioning unit 112 deprives the second display container 120 of its subtitle calculation authority. All subtitle index calculations are performed only once by the current subtitle positioning unit 112 to avoid state tearing caused by independent calculations by multiple components. The preset time threshold matching rule is that if the playback timestamp falls within the time interval of a certain line of subtitles, then that line is determined to be the current subtitle line that should be displayed.
[0025] The animation determination unit 113 starts working after the current subtitle positioning unit 112 determines that the subtitle line has changed. It performs contextual source determination on the event source type that triggered the subtitle line switch. By tracing the callback source of the player's underlying media control flow, it distinguishes between two types of triggering events: the first type is natural playback progression events, which are continuous smooth timestamp out-of-bounds events of the player's fixed progress heartbeat every 200ms; the second type is non-natural playback triggering events, which are sudden pulse reset events such as user-initiated dragging of the progress bar (Seek), song switching, subtitle initialization loading, and network fetch completion. Based on the above event type determination results, a corresponding animation control flag (shouldAnimate) is generated: if it is a natural playback progression event, an animation execution flag (shouldAnimate=true) is generated; if it is a non-natural playback triggering event, an animation prohibition flag (shouldAnimate=false) is generated. This achieves scene-specific animation separation triggering, avoiding visual interference caused by indiscriminate animation from the source.
[0026] The linkage notification unit 114, as the data output unit of the first display container 110, is triggered only when the current subtitle positioning unit 112 determines that the current subtitle line to be displayed has changed, and remains silent when there is no change in the subtitle line. The linkage notification unit 114 receives the animation control identifier generated by the animation judgment unit 113 and the current subtitle line text content determined by the current subtitle positioning unit 112, and encapsulates the two types of data into a standardized linkage instruction data packet. The linkage instruction data packet does not contain redundant calculation data such as playback timestamps and index values, but only carries absolute display results and animation control instructions. After encapsulation, the linkage notification unit 114 uses the linkage instructions to drive the multi-line subtitle view of the first display container 110 to complete the highlight display and scrolling update, and broadcasts the linkage instructions unidirectionally to the single-line subtitle subordinate view. Among them, the multi-line subtitle view of the first display container 110, as the master end, autonomously completes its own rendering, while the single-line subtitle subordinate view only acts as a pure renderer to receive the linkage instructions and execute the display, without the need for independent calculation, thereby realizing the global state synchronization between the multi-line subtitle view and the single-line subtitle subordinate view under the master-slave architecture.
[0027] The second display container 120 is connected to the linkage notification unit 114 of the first display container 110, and is used to receive linkage instructions and update the display content based on the text content and animation control marks in the linkage instructions.
[0028] The second display container 120, as a slave device, establishes a one-way receiving connection only with the linkage notification unit 114 of the first display container 110. It does not transmit any computational data, control commands, or status feedback information in reverse. This connection relationship follows the master-slave state source architecture and single source of fact design principle of this application. The second display container 120 passively receives the standardized linkage command data packets broadcast by the linkage notification unit 114 through this connection. It does not directly listen to the player time update event, does not independently obtain the original subtitle data, and does not perform any subtitle index calculation and time matching logic. As a slave rendering end of the first display container 110, it ensures the uniqueness of the data source at the connection level and avoids the state tearing problem caused by multiple data sources.
[0029] After receiving the linkage command, the second display container 120 performs the display update operation in pure renderer mode, without participating in any data calculation or logical judgment. The update process is implemented step by step according to the text content and animation control flag in the linkage command: First, the text content of the current subtitle line in the linkage command is extracted and used as the text data to be displayed; second, the animation control flag (shouldAnimate) in the command is parsed. If the animation control flag is true, it is determined that this update is triggered by the natural playback sequence, and the second display container 120 executes the preset text exit and entrance animation pipeline to complete the display update; if the animation control flag is false, it is determined that this update is triggered by non-natural playback events such as dragging progress, changing songs, initial loading, etc., and the second display container 120 directly forces a redraw of the text, skipping all transition animations to avoid visual interference; at the same time, the second display container 120 has a built-in three-state machine of Idle (idle state) / Animating (animation execution state) / PendingNext (suspended waiting state) and a compensation update mechanism. If a new linkage instruction is received during the execution of the animation, the latest linkage instruction is temporarily stored using the Last-Write-Wins caching strategy. Once the current animation is completed, the update is immediately executed to ensure no state loss or display lag in high-frequency subtitle scenarios. This achieves a display effect that is completely synchronized with the multi-line subtitle view of the first display container 110, meeting the stability and consistency requirements of in-vehicle cockpit subtitle display.
[0030] For example, this application also provides a structural schematic diagram of a first display container 110 and a second display container 120. Figure 2 This is a schematic diagram of the structure of a first display container and a second display container provided in an embodiment of this application. Figure 2 As shown, in actual audio playback scenarios such as in-vehicle central control screens and mobile music applications, the user interface mainly includes two logical containers: the first display container 110 and the second display container 120.
[0031] The first display container 110 typically corresponds to the application's main playback interface or full-screen lyrics view. Its interface includes: a record control 115, a song information display area 116, and a multi-line lyrics display area 117.
[0032] The record control 115 is a user-interactive component used to control playback. The song information area 112 displays information such as the song title and artist. The multi-line lyrics display area 117 scrolls through multiple lines of lyrics and highlights the currently playing line.
[0033] It should be noted that the main control module of this application is deployed in the logical layer of the first display container 110. This main control module is the sole computing and decision-making center of the system. Although it is invisible, it drives the update of the visible multi-line lyrics display area 117. The main control module includes, in order of function, the aforementioned subtitle data receiving unit 111, current subtitle positioning unit 112, animation determination unit 113, and linkage notification unit 114.
[0034] The subtitle (i.e., lyrics) data receiving unit 111 is used to acquire and parse lyrics data. The current subtitle positioning unit 112 is used to monitor the playback progress, calculate and determine the current line that should be highlighted in the multi-line lyrics display area 117. The animation determination unit 113 is used to decide whether to enable the switching animation based on the type of event that causes the lyrics line to change. The linkage notification unit 114 is used to encapsulate the calculated current lyrics line text and animation decision into a linkage instruction.
[0035] The second display container 120 corresponds to the single-line lyrics display area on interfaces such as the mini play bar, lock screen page, and vehicle dashboard. Its interface includes: a record control 121, a song information display area 122, and a single-line lyrics display area 123.
[0036] The record control 121 and the song information display area 122 are used for simplified control and information display. The single-line lyrics display area 123 is only used to display single-line lyrics.
[0037] It should be noted that the logical layer of the second display container 120 is equipped with the subordinate rendering module of this application. This subordinate rendering module does not have the ability to calculate lyrics; it is only used to passively receive linkage instructions from the main control module in the first display container 110 and drive the single-line lyrics display area 123 to update according to the linkage instructions.
[0038] Furthermore, it should be noted that in traditional solutions, the two types of display containers monitor the playback progress and calculate the lyrics position independently. This is a multi-data source parallel processing mode, which is prone to display state deviations during view switching and simultaneous dual-view display, leading to problems such as missing lyrics context and content disorder. A typical manifestation is that after switching from full-screen lyrics to the mini playback bar, the single-line lyrics display content is mismatched. However, this application adopts... Figure 2 The master-slave control architecture shown allows the current lyrics line status output by the current subtitle positioning unit 112 within the first display container 110 to be the system's sole factual data source. This baseline status directly updates the content of its own multi-line lyrics display area 117, and is also pushed unidirectionally to the second display container 120 by the linkage notification unit 114, which encapsulates linkage instructions carrying lyrics text and animation control identifiers. The single-line lyrics display area 123 passively receives instructions and completes interface rendering, ensuring consistent display status at both ends from an architectural perspective. Therefore, regardless of whether the user switches between display views or both views are presented synchronously, the lyrics display uses the first display container 110 as the unified data source, achieving smooth and consistent screen transitions and highly consistent display status. This eliminates screen tearing and loss of lyrics context caused by independent calculations of multiple components, improving the user experience.
[0039] The switching control container 130, serving as the mode scheduling hub of the subtitle display system, establishes independent communication connections with the first display container 110 (the main control module) and the second display container 120 (the subordinate rendering module) at both the logical link and functional levels to respond to user switching operations. Independent of the two display containers, the switching control container 130 does not participate in subtitle data parsing, time matching, subtitle index calculation, or animation determination; it only handles the scheduling and content transfer functions for view mode switching. Relying on the stable connection between the two types of display containers, it enables cross-container data retrieval and targeted content injection, providing the link foundation for seamless switching between dual-mode subtitle views. The overall architecture still adheres to the design principle of a single source of fact, ensuring unified control of global subtitle data.
[0040] The switching control container 130 monitors in real time the view switching commands issued by the upper layer of the subtitle display system and the subtitle mode switching operations actively triggered by the user. These subtitle mode switching operations include at least the switching between multi-line subtitle display mode and single-line subtitle display mode. Upon detecting a valid switching operation, the switching control container 130 uses only the first display container 110 as the sole legitimate data source, actively retrieving the currently active and highlighted subtitle line text content from the first display container 110. It does not request any subtitle data from the second display container 120 throughout the process, avoiding data discrepancies caused by independent storage and asynchronous updates at both ends. Since the first display container 110 is the globally unique calculation and state management entity, the current subtitle line text it stores possesses real-time accuracy, thus ensuring the authenticity and validity of the retrieved content during mode switching and mitigating the technical defects of subtitle content misalignment and missing content at the moment of switching.
[0041] The switching control container 130 determines the target container for content injection based on the target display mode corresponding to the user's switching operation: if the user operation triggers a switch to single-line subtitle display mode, the current subtitle line text obtained from the first display container 110 is injected into the second display container 120, and the subordinate rendering module (i.e., the second display container 120) completes the synchronous rendering and display of the single-line subtitle; if the user operation triggers a switch to multi-line subtitle display mode, the retrieved current subtitle line text is injected back into the first display container 110, assisting the main control module (i.e., the first display container 110) in completing the content refresh and interface state reset of its own view; through targeted content injection, the subtitle content is quickly migrated and synchronously inherited between the first display container 110 and the second display container 120. The entire mode switching process does not require repeated subtitle time matching and index recalculation. Combined with the preceding linkage instructions and animation control mechanism, the problems of lag, white screen, and subtitle state discontinuity in dual-view switching in traditional solutions are solved, further enhancing the consistency and smoothness of dual-subtitle view display under the master-slave architecture.
[0042] The subtitle display system provided in this application includes at least a first display container, a second display container, and a switching control container. The first display container, which undertakes the main control scheduling and unified calculation functions, is sequentially connected and deployed by a subtitle data receiving unit, a current subtitle positioning unit, an animation judgment unit, and a linkage notification unit to form a standardized and orderly unidirectional data flow processing link. Based on the master-slave architecture and single source of fact design, it centrally carries all subtitle parsing and state operation logic, thus avoiding the data deviation problem caused by parallel calculation of multiple modules from the architecture level. The subtitle data receiving unit is used to uniformly acquire complete subtitle data, providing a complete raw data foundation for subsequent subtitle positioning and status updates. The current subtitle positioning unit monitors the player's running time in real time and compares and matches it with the global subtitle data to determine the subtitle line that should be displayed at the current moment, thus controlling the subtitle display sequence. The animation judgment unit can trace and identify the event type that triggers the subtitle line switching and generate animation control identifiers that match the current scene, achieving differentiated control of animation start and stop and reducing visual clutter caused by abnormal switching. The linkage notification unit integrates the current subtitle line text content and animation control identifiers when the currently displayed subtitle line changes, generating and outputting standardized linkage instructions to ensure the integrity and effectiveness of the linkage instruction information. The second display container, as a subordinate rendering end, establishes a communication connection with the linkage notification unit of the first display container. It only passively receives the issued linkage instructions and completes the adaptive update of its own display content based on the subtitle text content and animation control identifiers in the linkage instructions. It does not need to independently monitor the playback sequence or calculate the subtitle index, thus eliminating the subtitle state tearing phenomenon caused by differences in multi-view timing. The switching control container establishes connections and interactions with the first and second display containers respectively, and can respond to the user's view switching operations in real time. Throughout the process, the first display container is the sole data source, retrieving the text of the currently highlighted subtitle line and injecting it into the second or first display container according to the switching scenario. This achieves seamless continuity of subtitle content and smooth transition of state during the switching between multi-line subtitle display mode and single-line subtitle display mode. Through the coordinated cooperation of unified main control calculation, subordinate passive rendering, and switching continuation, this subtitle display system effectively improves the synchronization and stability of dual-mode subtitle display, adapting to the display needs of multiple cockpit scenarios.
[0043] Optionally, Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device 200 may include a processor 210 and a memory 220.
[0044] The memory 220 stores machine-executable instructions that can be executed by the processor 210. When the electronic device 200 is running, these machine-executable instructions are executed. The processor 210 and the memory 220 communicate via a bus. The processor 210 can execute these machine-executable instructions to implement the subtitle display method.
[0045] The memory 220, processor 210, and bus components are electrically connected directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected via one or more communication buses or signal lines. The memory 220 includes at least one software functional module, which is stored or embedded in the operating system (OS) of the electronic device in the form of software or firmware. This software functional module includes at least one executable module. The processor 210 is used to execute the executable modules stored in the memory 220, such as the software functional modules and computer programs included in the subtitle display method.
[0046] The memory 220 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0047] The electronic device 200 can be selected according to the actual situation; for example, it can be selected as a vehicle controller or a computer device. Furthermore, the electronic device 200 has software capable of executing a subtitle display method or is configured with a subtitle display system, and executes the subtitle display method based on the subtitle display system.
[0048] The subtitle display method provided in this application embodiment can be executed by a processor in the electronic device 200. The subtitle display method provided in this application embodiment will be explained further below. Figure 4 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 1 .like Figure 4 As shown, the method may include: S310. During the playback of the target audio, determine the current subtitle line corresponding to the playback progress of the target audio.
[0049] In one possible implementation, during the continuous playback of the target audio, based on the single source of fact design principle under the master-slave architecture, the first display container, acting as the master control module, monitors the operating status of the in-vehicle audio player in real time, continuously collecting real-time playback progress data of the target audio. This playback progress is continuously and synchronously output in the form of high-precision timestamps. Simultaneously, the master control module pre-stores complete and structured full-volume subtitle data. Each subtitle line is pre-bound with a dedicated valid display time interval, which is jointly defined by the subtitle start time node and the subtitle end time node, representing the playback period during which a single subtitle line can be displayed normally. Based on this, the master control module iterates, compares, and matches the real-time acquired audio playback progress timestamps with the valid time intervals corresponding to all subtitle lines, filtering out subtitle lines whose playback progress timestamps fall within their valid time intervals. This successfully matched subtitle line is uniquely identified as the current subtitle line corresponding to the current playback progress.
[0050] It should be noted that in this step, the main control module independently completes all the calculation logic for progress monitoring, data comparison, and subtitle positioning. The subordinate rendering module does not participate in any playback progress acquisition or subtitle matching calculation. This effectively avoids the timing deviation and scheduling differences caused by independent calculation of multiple nodes, ensuring the uniqueness, accuracy, and real-time nature of the current subtitle line judgment result. This lays the data foundation for subsequent subtitle highlighting, view linkage synchronization, and mode switching.
[0051] Additionally, it's important to note that during the playback of the target audio, the audio playback progress serves as the baseline for subtitle timing matching. The subtitle display logic needs to be bound to and aligned with the audio playback rhythm in real time. Therefore, it's crucial to determine the current subtitle line that matches the current playback progress in real time. On one hand, to synchronize the subtitle display with audio performances, voiceovers, and other content, matching and positioning based on the playback progress is essential to ensure that the subtitle content switches in real time with the audio playback. This avoids issues like subtitles appearing ahead of time, lagging behind, misaligned content, or content jumping around, ensuring a smooth viewing experience in in-vehicle cabin audio playback scenarios. On the other hand, the master-slave architecture, with unified scheduling by the main control module (i.e., the first display container) and linked rendering by subordinate rendering modules, is designed with a single source of fact. It requires unified calculation and locking of the globally unique current subtitle line based on the playback progress, using it as the unified data benchmark for subsequent subtitle highlighting, animation type determination, dual-view linkage command issuance, and content migration during view mode switching. Without this positioning step, the multi-line subtitle view and the single-line subtitle view will lack a unified update basis, easily reproducing the defects in existing technologies caused by independent calculations of multiple modules, such as timing deviations, state tearing, and inconsistent display between the two views. Therefore, real-time matching of playback progress and determination of the current subtitle line are the prerequisite and necessary foundation for realizing synchronous display of subtitles in both modes and ensuring the stability and consistency of subtitle display.
[0052] S320. If a second display container exists that displays subtitles for the target audio, determine the changed subtitle line in response to a change in the current subtitle line.
[0053] The second display container and the first display container are both used to display the subtitle line corresponding to the playback progress. The first display container is also used to display other subtitle lines adjacent to the subtitle line corresponding to the playback progress, so as to adapt to the subtitle display needs of multiple scenarios in the vehicle cockpit.
[0054] At the functional commonality level, both the first display container (as the main control module) and the second display container (as the subordinate rendering module) possess basic subtitle rendering capabilities. They can synchronously display the matching current subtitle line according to the real-time audio playback progress, ensuring the basic consistency of the core subtitle content in both views. At the functional difference level, the first display container is a multi-line subtitle display carrier. In addition to rendering the subtitle line corresponding to the current playback progress, it can also synchronously load and display the context content of multiple adjacent subtitle lines before and after the current subtitle line, presenting the full text of the subtitles and meeting the user's complete reading needs. The second display container, on the other hand, is a single-line simplified display carrier. Limited by the small display space of navigation split screens and desktop widgets, it only retains the ability to display a single current subtitle line, without loading or displaying adjacent subtitle content. Therefore, by using a division of labor where the first display container handles the full subtitle display and the second display container handles the simplified subtitle display, multimodal subtitle adaptation capabilities are achieved in in-vehicle scenarios. Simultaneously, relying on a master-slave linkage mechanism, the synchronous and unified display content of the two types of containers is ensured.
[0055] In one possible implementation, preconditions are defined: the second display container must be in normal working order and displaying the subtitle content corresponding to the target audio in real time, completing the interface rendering of the single-line subtitle. Under these conditions, the first display container, acting as the main control module, continuously monitors the changes in the subtitle matching results globally. It compares the audio playback progress with the subtitle time interval in real time using its internal current subtitle positioning unit. If the playback progress crosses a subtitle time node, causing the previously matched current subtitle line to become invalid, it is determined that the current subtitle line has changed. The main control module immediately responds to this subtitle line change event, re-completing the global subtitle traversal and filtering calculation based on a unified time matching rule, uniquely locking and determining the new target subtitle line after the change. The entire change detection and new subtitle line determination process is completed independently by the first display container; the second display container does not participate in any detection, judgment, or calculation actions. This adheres to a single source of fact architecture design to ensure the consistency and accuracy of subtitle line change determination.
[0056] It should be noted that when the second display container is open and displaying the target audio subtitles normally, the system still uses the first display container as the sole global calculation source. It independently and continuously monitors the real-time playback progress of the audio player and continuously performs real-time matching calculations between the playback timestamp and the effective time intervals of all subtitle lines. This positioning calculation logic runs independently and is not affected or constrained by the working state of the second display container. The second display container is merely a subordinate rendering carrier, responsible only for receiving instructions and completing the interface display. It does not participate in any subtitle timing comparison, subtitle line index calculation, or other logic. Its normal display of subtitles only indicates that the system is in a dual-view linkage working mode and does not change the subtitle positioning mechanism of the main control module. As the audio continues to play, the playback progress will continuously advance. When the playback time deviates from the effective time range of the current subtitle line, the main control module can capture the trigger condition for subtitle line switching in real time, automatically determine that the current subtitle line has changed, and re-traverse and compare all subtitle data based on a unified time matching rule to filter out a new subtitle line that matches the current playback progress. Therefore, even if the second display container is in the subtitle display state, as long as the subtitle playback sequence changes or the subtitle line switches, the main control module can stably and accurately determine the changed subtitle line, ensuring the effectiveness and inevitability of the subtitle update judgment from the architecture level.
[0057] S330. Send the changed subtitle line to the second display container so that the second display container replaces the displayed subtitle line with the changed subtitle line.
[0058] In one possible implementation, the first display container acts as the main control module. After determining and confirming the new subtitle line content, its internal linkage notification unit completes the data encapsulation and targeted push. The first display container, relying on a pre-established dedicated communication link with the second display container, uniformly encapsulates the complete text content of the changed subtitle line and integrates it with synchronously generated animation control identifiers into a linkage command. This command is stably sent to the second display container, which acts as a subordinate rendering module, via unidirectional data transmission. Throughout this process, the second display container does not need to actively request data, listen to player time signals, or independently perform subtitle time matching calculations, adhering to a single source of fact design logic. The second display container continuously and passively listens to the linkage commands issued by the main control module. Upon successfully receiving command data containing updated subtitle content, it immediately parses and processes the linkage command information, terminating the rendering and visual display of the original old subtitle line. Combining the animation control identifiers with the corresponding interface refresh strategy, it reasonably distinguishes the display logic of different trigger scenarios such as natural playback switching, progress dragging, and song switching. Based on adapting to interface animation effects or static direct refresh, it completes a full replacement of the interface content, completely replacing its currently displayed original subtitle line with the changed latest subtitle line. This linkage mechanism between command issuance and view update allows for unified control over the timing of subtitle updates and the content displayed from the data source. It avoids the timing deviations and display tearing defects caused by independent calculation and asynchronous updates of dual views in existing technologies, ensuring that the update actions of single-line subtitle views and multi-line subtitle views are synchronized and the displayed content is consistent, thereby improving the overall stability and visual experience of multimodal subtitle switching in in-vehicle scenarios.
[0059] It should be noted that the second display container, as a subordinate rendering module, does not possess the ability to independently monitor playback progress, match subtitle timing, or autonomously calculate and update subtitle lines. It cannot proactively identify subtitle switching moments or solve for changed subtitle content. All its subtitle display content and update actions rely on the unified scheduling and data distribution of the first display container (i.e., the main control module). The second display container has a pre-defined, fixed rendering and update logic, using externally received subtitle text data as the sole data source for interface rendering, and only performing pure display actions of receiving, parsing, and rendering the interface. When the first display container determines the new subtitle line and distributes it to the second display container, it directly overwrites the old subtitle line data cached locally in the second display container. The second display container listens for data push events from the main control side in real time. Upon capturing new subtitle line data, it automatically triggers a UI redraw and content refresh mechanism, replacing the original display content based on the newly received subtitle text. Therefore, the main control module only needs to send the changed subtitle line to the second display container to drive the second display container to automatically complete the content replacement and stably update the currently displayed subtitle line to the changed subtitle line. The entire process does not require the subordinate rendering module to participate in complex calculations, which not only ensures the synchronization of subtitles in the two views, but also avoids the display disorder problem caused by independent calculations on multiple terminals.
[0060] The subtitle display method provided in this application is executed by a first display container. During the playback of the target audio, the corresponding current subtitle line is matched and determined separately based on the playback progress of the target audio. When the second display container, used for simplified subtitle display, is in working state, the first display container uniformly monitors and responds to changes in the current subtitle line, determines the changed subtitle content, and distinguishes between the two container display modes. This allows the first display container to fully display the current subtitle line and adjacent context subtitles, while the second display container only displays the corresponding single subtitle line due to space limitations. The first display container then uniformly sends the changed subtitle line to the second display container, allowing the second display container to directly complete the replacement and update of the subtitle content. Thus, this application overcomes the shortcomings of existing technologies where multiple views are independently calculated and each maintains its own operating state. By using a single entity for unified calculation and unidirectional synchronous distribution of instructions, it avoids the subtitle state tearing problem caused by differences in the calculation timing of multiple components and deviations in the main thread scheduling. This effectively achieves real-time linkage and synchronization between multi-line subtitle views and single-line subtitle views, meeting the requirements of vehicle cockpits for stability and consistency in subtitle display effects.
[0061] Figure 5 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 2 .like Figure 5 As shown, the method described above for determining the current subtitle line corresponding to the playback progress of the target audio includes: S410. Obtain the current playback timestamp corresponding to the playback progress of the target audio.
[0062] The playback timestamp is a quantized timing parameter that represents the real-time playback position of the audio. It is continuously output by the player at a fixed refresh rate to record the duration of the audio playback.
[0063] In one possible implementation, during the playback of the target audio, the first display container acts as the sole data calculation and acquisition entity, continuously establishing real-time data interaction with the in-vehicle audio player. It actively reads and captures the current playback timestamp corresponding to the real-time playback progress of the target audio. The first display container collects this playback timestamp in real time and caches it locally, using it as the benchmark for subsequent subtitle matching calculations.
[0064] It should be noted that, since the current playback timestamp can objectively and in real-time represent the playback position and progress of the target audio in the form of standardized and quantifiable timing parameters, only by relying on a unified current playback timestamp can the real-time playback sequence of the audio be compared horizontally with the preset start time of each line of subtitles and the interval be determined. This allows for the division of the effective display period of a single subtitle, thereby accurately filtering and locking the current subtitle line that matches the playback progress. At the same time, using the unified timestamp output by the player as the sole calculation benchmark can unify the calculation standard of the first display container, which conforms to the master-slave architecture design of the single source of fact in this application. This avoids calculation deviations caused by inconsistent timing references and ensures the consistency and accuracy of the subtitle display timing between the first and second display containers.
[0065] S420, Traverse the preset subtitle timestamp set.
[0066] The preset subtitle timestamp set is a pre-organized and structured subtitle timing dataset, which includes at least the starting time point corresponding to each line of subtitles in the multi-line subtitles, and the starting time points of each line of subtitles are arranged and stored in order according to the audio playback sequence.
[0067] In one possible implementation, after obtaining the current playback timestamp, the first display container retrieves a pre-parsed and stored set of preset subtitle timestamps. Then, according to the playback order of the subtitles, it iterates through this set of preset subtitle timestamps line by line, reading the start time parameter corresponding to each line of subtitles one by one, thus completing the retrieval and recognition of all subtitle timing information in an orderly manner. This traversal process is executed independently within the first display container, without relying on the data and computing resources of the second display container. Furthermore, the orderly traversal method ensures the orderliness and completeness of the subtitle time comparison, avoiding subtitle omissions and mismatches.
[0068] It should be noted that since the multiple lines of subtitles corresponding to the target audio are arranged sequentially according to the playback time, and each line of subtitles is configured with an independent start time point, only by traversing in an ordered manner can the timing parameters of all subtitle lines be read completely and one by one. This provides a complete data source for the subsequent item-by-item comparison between the current playback timestamp and the start time point of each line of subtitles, avoiding matching omissions or judgment deviations caused by partially truncated subtitle data. At the same time, relying on the first display container to uniformly complete the set traversal processing can ensure the uniformity of global subtitle timing retrieval rules. Combined with the time interval judgment logic of adjacent subtitles, the effective display period of each line of subtitles can be accurately divided, thereby reliably filtering out the current subtitle line that matches the playback progress. This provides a rigorous and complete timing calculation basis for the synchronous display of subtitles in the dual-container architecture.
[0069] S430. Compare the current playback timestamp with the start time of each line of subtitles in the subtitle timestamp set.
[0070] In one possible implementation, the first display container simultaneously performs timing comparison calculations while iterating through the subtitle timestamp set line by line. It compares and verifies the current playback timestamp obtained in real-time with the start time point corresponding to each line of subtitles in the subtitle timestamp set. This comparison operation employs unified timing value calculation rules, using standardized timestamp values as the comparison benchmark to avoid judgment errors caused by differences in timing formats. By comparing line by line independently, it quantifies and distinguishes the subtitle timing interval at the current playback moment, determining the subtitle playback stage of the audio playback progress. This comparison logic is uniformly executed within the first display container, ensuring consistent global comparison rules, calculation standards, and operational logic.
[0071] It should be noted that by comparing the current playback timestamp with the start time of each line of subtitles in the subtitle timestamp set one by one, standardized and quantifiable timing values can be used as the basis for judgment to divide the effective display time interval corresponding to each line of subtitles. This objectively and accurately locates the timing stage of the real-time audio playback progress, avoiding problems such as subtitle misalignment and display delay caused by fuzzy matching. At the same time, this unified timing comparison operation is performed centrally within the first display container, which can ensure that the calculation rules and judgment criteria for global subtitle matching are consistent. This meets the master-slave architecture design requirements of the single fact source in this application, providing reliable computational support for subsequent screening and determination of the unique current subtitle line, generation of standardized linkage instructions, and realization of synchronized subtitle rendering between the first and second display containers. This effectively avoids subtitle status discrepancies and display anomalies caused by independent timing judgments in multiple views.
[0072] S440. When the current playback timestamp is greater than or equal to the start time of the i-th line of subtitles and less than the start time of the (i+1)-th line of subtitles, the i-th line of subtitles is determined as the current subtitle line.
[0073] Where i is a positive integer.
[0074] In one possible implementation, matching constraints are first set, i.e., let T be the current playback timestamp. Let i be the starting time point of the i-th line of subtitles. Let i be the starting time point of the (i+1)th line of subtitles, where i is a positive integer. The current subtitle line is determined by satisfying the following formula (1).
[0075] ≤T< Formula (1) According to the above formula (1), if and only if the current playback timestamp is greater than or equal to the start time of the i-th line of subtitles and less than the start time of the next line, i.e., the (i+1)-th line of subtitles, the current audio playback progress is determined to fall into the valid display time interval of the i-th line of subtitles, thus uniquely determining the i-th line of subtitles as the current subtitle line that needs to be highlighted. This interval determination method divides the independent playback time period by the start time of two adjacent lines of subtitles, realizing the continuous and orderly switching of multiple lines of subtitles; the determination logic is uniformly calculated and outputs a unique result by the first display container, and the second display container does not participate in any threshold judgment or interval calculation, but only passively receives the final subtitle line result for rendering and display, so as to lock the subtitle content corresponding to the playback progress in real time, ensuring the continuity and synchronization of the switching between the multi-line subtitle view and the single-line subtitle view, effectively solving the technical defects of chaotic timing determination and asynchronous subtitle display in the existing technology.
[0076] It should be noted that since all subtitle lines are arranged sequentially according to the audio playback time, adjacent subtitle lines are divided into independent and effective display intervals that are connected and do not overlap, based on their respective start times. The real-time audio playback timestamp is used as a unified judgment benchmark. When the current playback timestamp is greater than or equal to the start time of the i-th subtitle line, it indicates that the audio playback progress has entered the display period of the i-th subtitle line. At the same time, if the playback timestamp is less than the start time of the (i+1)-th subtitle line, it means that the display cycle of the next subtitle line has not yet started. Only the i-th subtitle line meets the timing matching requirements within this time interval. Therefore, the i-th subtitle line is uniquely identified as the current subtitle line corresponding to the current playback progress.
[0077] The subtitle display method provided in this application acquires the current playback timestamp corresponding to the audio playback progress in real time during the target audio playback process, and traverses a preset subtitle timestamp set. This preset subtitle timestamp set contains at least the start time point corresponding to each line of subtitles in multiple lines. Then, the current playback timestamp is compared with the start time point of each line of subtitles in the subtitle timestamp set one by one. When the current playback timestamp is greater than or equal to the start time point of the i-th line of subtitles and less than the start time point of the (i+1)-th line of subtitles, the i-th line of subtitles can be determined as the current subtitle line, where i is a positive integer. Thus, this application completes subtitle positioning by uniformly collecting playback timestamps, centrally traversing subtitle timing data, and using standardized interval comparison rules. The entire process uses a single computing source for logical operations, effectively unifying the subtitle matching judgment standard, avoiding timing differences and data deviations caused by independent calculations on multiple terminals, eliminating problems such as subtitle recognition errors and display misalignments, improving the real-time performance and accuracy of current subtitle line determination, and providing reliable underlying timing calculation support for the synchronous rendering and stable linkage of subtitle content in dual display containers under a master-slave architecture.
[0078] Figure 6 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 3 .like Figure 6 As shown, the above method also includes: S510. Compare the current subtitle line with the subtitle line from the previous moment.
[0079] The previous moment refers to the moment when the first display container last sent a subtitle line to the second display container.
[0080] In one possible implementation, the first display container persistently stores historical subtitle line data from the previous round of synchronized pushes, relying on its internal cache area. After determining the current subtitle line corresponding to the current time through timestamp interval matching, the first display container actively retrieves the historical subtitle line data stored in its local cache. It then compares and verifies the real-time updated current subtitle line with the cached previous subtitle lines from multiple dimensions, including subtitle line index, subtitle text content, and subtitle identification information. This comparison and verification process is completed independently within the first display container. The second display container, as a subordinate rendering module, does not participate in data caching, data retrieval, or content comparison operations. Following the master-slave architecture design of the single source of fact in this application, it provides a preliminary judgment basis for identifying subtitle line switching behavior, avoiding invalid updates and redundant command issuance.
[0081] It should be noted that, under the master-slave architecture and single source of fact design framework, comparing the current subtitle line with the previous subtitle line aims to identify whether the subtitle line has undergone substantial changes, filtering out ineffective change factors such as minor fluctuations in audio playback timing and deviations in system thread scheduling. This avoids situations where the first display container frequently and redundantly issues linkage commands, and the first and second display containers continuously and ineffectively redraw and refresh. At the same time, relying on this comparison mechanism, the state judgment benchmark of the first and second display containers is unified. Only when the subtitle line actually switches and changes will subsequent processing processes such as animation identifier generation, linkage command encapsulation, and cross-container data synchronization be triggered. This can reduce the consumption of overall computing resources and optimize the operating performance of the in-vehicle system. It can also logically avoid problems such as subtitle state tearing, content misalignment, and display asynchrony caused by asynchronous updates of dual views, and stably ensure the display consistency and interface smoothness of multi-line subtitle views and single-line subtitle views during mode switching and playback.
[0082] S520. If the current subtitle line is different from the previous subtitle line, then confirm that the current subtitle line has changed.
[0083] In one possible implementation, after the first display container completes a comprehensive comparison of the preceding and following subtitle lines, it executes a differential result determination logic. Specifically, if the current subtitle line obtained through real-time matching is found to have any substantial difference, such as index number or text content, compared to the subtitle line from the previous time frame (based on the previous round of distribution), it can be determined and confirmed that the current subtitle line has undergone a valid change. Conversely, if the preceding and following subtitle lines are completely identical, it is determined that the subtitle line has not changed, and the system maintains its current display state without triggering subsequent animation determination, instruction encapsulation, view refresh, or other operations. This determination rule is simple, clear, and logically defined. It can filter out invalid data disturbances caused by minute time-series fluctuations during audio playback, triggering the linked update process only when the subtitle content actually switches. This ensures the real-time synchronization of multi-line and single-line subtitle views, reduces invalid device calculations and frequent UI redraws, improves the operational stability and resource utilization of the in-vehicle subtitle display system, and provides accurate triggering conditions for subsequent animation control, cross-container linked instruction distribution, and other steps.
[0084] The subtitle display method provided in this application compares the current subtitle line, determined in real time, with the corresponding historical subtitle line from the previous moment. The previous moment specifically refers to the time when the first display container (the main control module) last sent subtitle line data to the second display container (the subordinate rendering module), thus unifying the state recording benchmark between the master and slave ends and eliminating differences in timing statistics rules. If the comparison determines that the current subtitle line is inconsistent with the subtitle line content stored from the previous moment, then the change in the current subtitle line is confirmed. Therefore, this application's determination method relies on a unified state traceability standard based on a single fact source architecture, avoiding problems such as misjudgment of changes and recognition lag caused by independent state recording at multiple ends in traditional solutions. It can capture subtitle line switching nodes, providing accurate and reliable triggering conditions for subsequent linkage instruction generation, dual-view synchronous rendering, and animation strategy adaptation, effectively improving the overall stability of dual-container subtitle linkage updates.
[0085] Optionally, in response to a change in the current subtitle line, after determining the changed subtitle line, the method further includes: The value of the animation control flag is determined based on the type of event that causes the current subtitle line to change.
[0086] The animation control identifier is used to indicate whether the second display container updates its display with animation. This unidirectional constraint and indication of the second display container's interface update behavior defines the UI rendering mode of the second display container during the subtitle line switching process. The animation control identifier sets two types of instruction logic, corresponding to the animated update mode and the non-animated real-time update mode, respectively. It only applies to the second display container displaying a single line of subtitles. The multi-line subtitle view of the first display container can independently adapt to its own display logic to complete the interface switching, while the second display container must completely comply with the instructions of the animation control identifier. This unifies the update strategy of the two display containers, eliminates the timing differences and display fragmentation caused by the subordinate container's independent determination of animation logic, and ensures the overall coordination of the subtitle display effect in the vehicle scenario.
[0087] In one possible implementation, since the different types of events that trigger the switching of the current subtitle line result in fundamental differences in the corresponding screen display scenarios, user viewing needs, and interface rendering constraints, the specific value of the animation control flag can be determined based on the differences in event types. Among them, the subtitle line switching triggered by the normal and uniform playback of audio belongs to the continuous and stable normal playback scenario, which is suitable for the dynamic display effect with a smooth transition. The corresponding flag value that allows the execution of animation is configured. However, sudden forced jump events such as user dragging the playback progress, changing songs, view initialization, and mode switching will cause the subtitle state to change abruptly. Continuous playback of animation is prone to causing screen stuttering, visual fragmentation, and display misalignment. Therefore, the corresponding flag value that prohibits the execution of animation is configured. In this way, the subtitle update rendering logic of the two views is controlled according to the actual triggering scenario, balancing the visual experience and the stability of the interface display. Based on this, after detecting and confirming a change in the current subtitle line, the first display container uses its internal animation judgment unit to trace and identify the trigger source that caused the subtitle line switching, distinguishing different event types. These event types are mainly divided into regular timing change events that occur during natural, continuous audio playback, and sudden change events caused by user intervention, such as dragging playback progress, switching songs, page initialization, and playback status reset. The first display container sets differentiated judgment rules according to different event types and assigns different values to the corresponding animation control identifiers. These animation control identifiers are defined using standardized state parameters and are calculated and assigned values solely by the first display container, without relying on the logical judgments of the second display container. This adheres to the single-fact-source architecture design of this application, achieving differentiated configuration of animation strategies through an event classification and judgment mechanism, and providing a unified control benchmark for the display update methods of subsequent subordinate containers.
[0088] The above method involves sending the modified subtitle line to the second display container, including: Send the changed subtitle lines and animation control values to the second display container.
[0089] In one possible implementation, after confirming the subtitle line change and assigning the animation control identifier, the linkage notification unit of the first display container encapsulates the newly changed subtitle line content, subtitle line index information, and the determined animation control identifier value, integrating them into a complete linkage instruction data packet. The first display container, relying on a preset unidirectional communication link, stably sends the encapsulated linkage instruction to the second display container. The overall data transmission follows a master-to-slave unidirectional transmission mode, with no interactive behavior where the second display container sends data back to the first display container or requests calculations. This ensures that the second display container can completely and accurately obtain the updated subtitle content and animation control instructions.
[0090] It should be noted that the first display container is the globally unique entity responsible for subtitle calculation and logic determination, centrally handling the current subtitle line location, subtitle change recognition, and differentiation of subtitle switching event types. The second display container, on the other hand, serves only as a subordinate rendering carrier and lacks independent subtitle calculation, status judgment, and animation strategy selection capabilities. Therefore, it is necessary to uniformly send the changed subtitle line content and the corresponding scene-generated animation control identifiers to the second display container. This not only provides the second display container with unified standard rendering data, ensuring high synchronization between the single-line subtitle view and the multi-line subtitle view on the main control end, but also uniformly constrains the interface update logic of the subordinate end through animation control identifiers. This allows for differentiated adaptation to the display requirements of different trigger scenarios such as natural playback, progress dragging, and song switching, avoiding issues such as timing differences, subtitle misalignment, screen tearing, and inconsistent switching effects caused by independent calculation and autonomous rendering on both ends. This simplifies the computational burden of the subordinate container and effectively improves the stability, coherence, and visual consistency of the overall dual-mode subtitle display.
[0091] In the above method, the second display container replaces the displayed subtitle lines with the modified subtitle lines, including: The second display container selects to replace the displayed subtitle lines with the changed subtitle lines by executing a preset switching animation or redrawing, based on the value of the animation control identifier.
[0092] In one possible implementation, the second display container, acting as a pure rendering subordinate unit, passively receives the linkage instructions from the first display container. It prioritizes parsing the values of the animation control flags within the instructions and automatically matches the corresponding subtitle update execution method based on the flag values to complete the interface content replacement. When the animation control flag is on (i.e., 1), the second display container retrieves locally preset subtitle switching transition animation resources and executes standardized UI switching animations such as smooth entry and exit, achieving dynamic updates and displays of the subtitle lines. When the animation control flag is off (i.e., 0), the second display container skips all transition animation logic and directly replaces the original subtitle line content with the changed new subtitle line through static interface redrawing. Simultaneously, combined with a compensation update mechanism, if the second display container is in an animation execution blocking phase, it can temporarily store subsequent update instructions and execute them sequentially, effectively avoiding issues such as screen stuttering and state tearing. Ultimately, it achieves synchronization with the subtitle content of the first display container, balancing subtitle switching smoothness and display stability, and adapting to the diverse interface display needs of in-vehicle cockpits.
[0093] It should be noted that, due to the different types of events that trigger changes in subtitle lines, the visual presentation requirements for subtitle switching vary in different scenarios. Therefore, differentiated management is necessary based on animation control identifiers. For example, for subtitle line changes caused by the smooth progression of audio playback, updating the subtitles by executing preset switching animations can ensure a smooth and seamless subtitle switching process, improving the continuity of visual interaction on the in-vehicle interface. For sudden and abrupt subtitle changes such as users dragging playback progress, switching songs, or initializing the interface, the subtitle content can be replaced instantly by redrawing the interface. This avoids problems such as screen distortion, visual incongruity, and animation stacking conflicts caused by redundant transition animations in non-continuous playback scenarios. At the same time, relying on the animation control identifiers uniformly allocated by the first display container, the second display container, as the subordinate end, selects the update method according to unified rules without having to independently determine the switching logic. This not only conforms to the master-slave architecture design of the single source of fact in this application, but also effectively avoids display tearing and synchronization deviation caused by differences in the independent rendering logic of multiple views, adapting to the display needs of multiple scenarios in the in-vehicle cockpit, and taking into account the stability, consistency, and visual experience of subtitle display.
[0094] The subtitle display method provided in this application determines the specific value of an animation control identifier based on the event type that causes the current subtitle line to change. This animation control identifier is used to instruct the second display container whether to use animation to refresh the interface during the subtitle update process. Subsequently, the first display container synchronously sends the changed subtitle line content and the corresponding determined animation control identifier value to the second display container. Relying on the master-slave unidirectional transmission data flow architecture, it ensures that the command is issued uniformly and orderly, avoiding data deviations caused by multi-terminal autonomous calculations. The second display container, as a subordinate rendering unit, adaptively matches the update logic according to the value of the animation control identifier, selectively replacing the currently displayed subtitle line with the changed subtitle line by executing a preset switching animation or directly using interface redrawing. Thus, the design of this application adapts differentiated rendering strategies for different triggering scenarios. It can improve the smoothness of UI display by relying on transition animations in natural audio playback scenarios, and avoid animation conflicts and screen misalignment by using real-time redrawing in sudden change scenarios such as progress dragging, song switching, and initialization. It effectively solves the problems of inconsistent update sequence of dual views and subtitle state tearing in the prior art, and improves the synchronization and overall visual stability of multimodal subtitle display.
[0095] Optionally, the method described above determines the value of the animation control flag based on the type of event that causes the current subtitle line to change, including: If the event type that causes the current subtitle line to change is a playback progress update event triggered by the media player at a preset time interval, then the value of the animation control identifier will be determined as the first value.
[0096] The first value is used to instruct the UI rendering update mode of the second display container to execute a preset switching animation. After the first display container sets the animation control flag to the first value (i.e., 1), this first value is sent to the second display container along with the linkage command, thus informing the second display container that the current subtitle line is in a normal continuous playback scenario. After parsing and recognizing the first value, the second display container calls the locally pre-configured, standardized subtitle preset switching animation resources to fully execute transition animation effects such as subtitle fade-in, fade-out, and smooth displacement, completing the dynamic switching update of the single-line subtitle interface. This setting is suitable for the common usage scenario of continuous playback of in-vehicle audio, improving the visual continuity and viewing comfort of the interface through smooth animation transitions, while maintaining the same animation rhythm between the multi-line subtitle view of the first display container and the single-line subtitle view of the second display container, ensuring consistent display effects on both ends.
[0097] The preset time interval can be selected according to the actual situation.
[0098] In one possible implementation, the first display container uses its internal animation determination unit to identify and classify the source event that triggers the subtitle line change. During audio playback, the in-vehicle media player periodically and proactively pushes playback progress update events at fixed time intervals preset by the system. These playback progress update events are regular time-driven events in the natural continuous playback of audio and are the regular triggering conditions for the smooth and sequential switching of lyrics subtitles. The first display container captures and parses these periodic progress update events in real time. When it determines that the subtitle line change is triggered by the regular progress update behavior of the player's periodic polling, it uniformly marks and assigns the animation control identifier to the first value according to preset control rules. This event identification and parameter assignment process is completed internally within the first display container. The second display container, as a subordinate rendering end, does not participate in event tracing and logical determination, following the single fact source design architecture of this application, and realizing the standardized configuration of animation strategies in natural playback scenarios.
[0099] It should be noted that the playback progress update event triggered periodically by the media player at preset time intervals is a regular time-driven event in the process of smooth and continuous audio playback. The subtitle lines switch smoothly and the change process is coherent to adapt to the visual experience requirements of smooth transition in the in-vehicle interface. Therefore, for this type of subtitle line change scenario caused by natural playback, it is necessary to enable subtitle switching animation to optimize the display effect. Hence, the animation control identifier is uniformly determined to be the first value (such as 1) representing the start of the animation. Standardized control logic is formed by using a fixed value to ensure that the first display container has uniform instruction output rules and clear logical boundaries.
[0100] If the event type that causes the current subtitle line to change is a user-triggered playback progress jump or song switching operation, then the value of the animation control identifier will be determined as the second value.
[0101] The second value instructs the second display container not to execute the preset transition animation. When the second display container receives and parses the second value of the animation control identifier, it will directly block and skip all preset subtitle transition animation logic, prohibiting the loading and running of all transition animations. Since playback progress jumps and song transitions are instantaneous operations, additional animation effects can easily cause problems such as screen overlap, interface lag, and visual fragmentation. By constraining the second value, the second display container can abandon the dynamic animation transition mode, thereby avoiding UI display defects in special operation scenarios from the operating mechanism perspective, and ensuring the immediacy and cleanliness of the interface response.
[0102] The second value is different from the first value. That is, the first value and the second value are two sets of independent, mutually exclusive, and numerically or state-completely distinguishable calibration parameters. There is no overlap in values, crossover in states, or logical compatibility between the two.
[0103] In one possible implementation, the first display container continuously monitors the upper-level interaction commands and user operations of the in-vehicle system, identifying non-routine change events not triggered by the player's scheduled actions. When it detects user-initiated actions such as dragging the playback progress bar, clicking to jump to a specific point in the progress bar, or manual interventions like switching songs, changing tracks, or changing playback sources, the animation judgment unit classifies these actions as sudden subtitle change events, distinguishing them from the player's periodic progress update events. For these manually triggered, non-continuous playback change scenarios, the first display container independently sets the animation control flag to a second value (e.g., 0) based on built-in differentiated control rules. These events are mostly instantaneous and lack continuous temporal characteristics. By independently classifying and assigning differentiated values, the first display container achieves customized display control for special operation scenarios, avoiding logical confusion caused by the second display container's autonomous judgment.
[0104] It should be noted that the first display container executes independently through its internal animation judgment unit. When the event that triggers the switching of the current subtitle line is not a regular playback progress update event triggered by the media player at a preset time interval, but rather a user-initiated playback progress jump (such as dragging the playback progress bar, jumping to a specified playback position) or song switching (such as manually switching songs, changing the playback track), which are artificial intervention events with non-natural playback timing, the first display container will identify and classify the traceability characteristics of such events. Combining the immediacy and suddenness of user-initiated operations in the in-vehicle cockpit interaction scenario, and considering that executing preset switching animations under such sudden operations may easily lead to problems such as screen overlap, visual stuttering, and display state tearing, the value of the animation control identifier is uniformly determined as the second value according to the preset differentiated control rules. The entire judgment process is led by the first display container, and the second display container does not participate in the event traceability and value determination logic, providing a clear and unique control instruction benchmark for the subsequent display update mode of the second display container.
[0105] The subtitle display method provided in this application differentiates the values of animation control identifiers based on different event types that trigger changes in the current subtitle line, thereby achieving refined control over the subtitle update rendering logic. Specifically, if the subtitle line change is a regular playback progress update event triggered periodically by the media player at preset time intervals, indicating that the audio is in a stable and continuous playback state, the animation control identifier is determined to be a first value. This first value is used to instruct the second display container to execute a preset switching animation, ensuring a smooth and natural transition of subtitle switching during normal playback and improving the visual continuity of the interface. If the subtitle line change is a sudden operation such as a playback progress jump or song switching triggered by user intervention, the animation control identifier is set to a second value different from the first value. This second value is used to constrain the second display container not to execute the preset switching animation and directly complete the content refresh. Therefore, this application, through the above-mentioned segmented identifier value differentiation mechanism, can reasonably adapt to the display requirements of different playback conditions of in-vehicle audio, avoid the screen stuttering and visual disharmony caused by the superposition of redundant animations in manual jump and song switching scenarios, and at the same time reduce the consumption of invalid UI rendering, effectively ensuring the consistency of subtitle display in dual display containers and the overall interaction stability under the master-slave architecture.
[0106] Optionally, in the above method, the second display container, based on the value of the animation control identifier, selects to replace the displayed subtitle line with the changed subtitle line by executing a preset switching animation or by redrawing, including: If the value of the animation control identifier of the second display container is the first value, then the subtitle line displayed by the second display container will be changed to the changed subtitle line by executing the preset switching animation.
[0107] In one possible implementation, when the animation control identifier is set to a first value, this first value corresponds to a natural, continuous playback scenario where the media player periodically pushes playback progress updates at fixed time intervals. To adapt to scenarios with smooth audio playback, mitigate the abrupt transitions between subtitles, improve the visual smoothness and viewing comfort of the in-vehicle interface, and ensure coordinated subtitle display rhythm between the second and first display containers, the second display container, upon recognizing the control command of the first value, will proactively invoke locally preset subtitle switching animation resources, fully execute standardized transition animation logic, and then smoothly replace its currently displayed subtitle line with the changed new subtitle line using a soft rendering method that executes the preset switching animation. Based on this, the second display container has successfully received the standardized linkage instruction data packet sent by the first display container, and the value of the animation control identifier within this standardized linkage instruction data packet is parsed as the first value (this first value pre-corresponds to the regular subtitle line switching scenario triggered by the media player's periodic progress update event). Upon receiving the instruction, the second display container first parses and verifies the validity of the animation control identifier to confirm that the current state is a normal switching condition for continuous audio playback. Then, it actively retrieves locally pre-loaded, standardized subtitle preset switching animation resources (such as subtitle fade-in, scrolling, and gradient transition preset animation pipelines) and starts the animation execution process according to the preset animation timing and rendering parameters. During the animation, the second display container gradually replaces the original displayed subtitle line content with the changed subtitle line carried in the linkage instruction until the animation playback is complete, achieving smooth dynamic switching of single-line subtitles. The entire rendering and replacement process follows the unidirectional rendering rules of the master-slave architecture. The second display container does not participate in the determination of animation logic, parameter configuration, or resource loading; it only acts as a pure rendering end to execute the instructions of the main control module. Simultaneously, combined with a compensation update mechanism, if a new linkage instruction is received during animation execution, a last-write-wins caching strategy is used to temporarily store the new instruction, which will be executed after the current animation ends, ensuring the smoothness and consistency of subtitle switching in high-frequency playback scenarios.
[0108] If the value of the animation control identifier of the second display container is the second value, then the subtitle line displayed by the second display container will be replaced with the changed subtitle line by performing a redraw.
[0109] In one possible implementation, when the second display container parses and identifies the animation control identifier as having a second value, which corresponds to unconventional subtitle change scenarios triggered by the user, such as playback progress jumps or song switching, the second display container will directly block and skip the execution logic of all preset subtitle switching animations. Without loading transition animation resources or executing dynamic rendering processes, it directly calls its own UI underlying redrawing capabilities to perform a global static refresh of the current display interface. This quickly clears the previously displayed old subtitle lines and instantly renders the new subtitle lines after the change. This minimalist update method of direct redrawing completes the subtitle line replacement, effectively avoiding issues such as screen overlap, interface lag, and visual tearing caused by redundant animation loading in sudden user operation scenarios, improving interface response speed, and ensuring the simplicity, immediacy, and display stability of single-line subtitle display under special interactive conditions. Based on this, the second display container has received the linkage command issued by the first display container, and the animation control identifier in the command has a second value (this second value pre-corresponds to sudden non-continuous playback scenarios triggered by the user, such as playback progress jumps or song switching). After the second display container completes the parsing of the animation control identifier, it first identifies the current instantaneous operation situation as a user-initiated intervention. Based on the instruction rules, it directly skips the loading, parsing, and execution logic of all preset switching animations, avoiding screen overlap, visual confusion, or interface lag caused by instantaneous operation superimposed with dynamic animation. Subsequently, the second display container directly calls the local UI redraw interface to quickly replace the original displayed subtitle line content with the changed subtitle line carried in the linkage instruction in an instantaneous rendering method without transition animation, completing the real-time update of the interface content.
[0110] The subtitle display method provided in this application, when the second display container identifies the animation control identifier as having the first value, will dynamically replace the currently displayed subtitle line by executing a preset switching animation, smoothly switching to the changed subtitle line. This ensures the visual transition effect of subtitle switching in continuous audio playback scenarios and improves the smoothness of the interface display. When the second display container identifies the animation control identifier as having the second value, the animation transition process is canceled, and the subtitle line content is quickly replaced directly through interface redrawing, updating to the changed subtitle line in a timely manner. This avoids screen tearing, display stuttering, and visual clutter caused by animation rendering in sudden operation scenarios such as user dragging progress or switching tracks. By adaptively matching the animation switching or static redrawing based on different values of the animation control identifier, the method adapts to multiple subtitle change triggering scenarios, effectively balancing the visual experience of regular playback and the response efficiency of special operations, and improving the overall stability and interactive adaptability of in-vehicle dual-mode subtitle display.
[0111] Figure 7 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 4 .like Figure 7 As shown, the above method also includes: S610, in response to an instruction to switch display modes between a single-line caption view and a multi-line caption view, the switching control container obtains the current caption line of the first display container before executing the instruction.
[0112] In one possible implementation, the switching control container listens in real-time to upper-level control commands from the vehicle system and user-triggered interface interactions, capturing display mode switching commands for switching between single-line and multi-line subtitle views. Before formally executing mode switching actions such as view start / stop, interface switching, and container working status changes, this application pre-sets a data retrieval logic to prioritize data synchronization preparation. The switching control container relies on a pre-set communication link to establish data interaction only with the first display container, which serves as the main control module, actively retrieving the currently highlighted subtitle line content that is calculated and cached within the first display container in real time. Since the first display container is the single global source of facts, undertaking all subtitle time matching, index calculation, and status determination work, its stored current subtitle line possesses real-time accuracy and uniqueness. By abandoning the method of obtaining data from the second display container during the switching process, problems such as subtitle content misalignment, blanks, and jump anomalies caused by data inconsistency between the two ends during mode switching can be avoided from the source.
[0113] S620: The switching control container configures the current subtitle line to the corresponding target display container.
[0114] Specifically, if the switching control container recognizes that the current display mode switching instruction is to switch to multi-line subtitle view, the target display container is configured as the first display container; if the switching control container recognizes that the current display mode switching instruction is to switch to single-line subtitle view, the target display container is configured as the second display container.
[0115] In one possible implementation, after reading and caching the current subtitle line text data output by the first display container, the switching control container matches and determines the target display container for content injection based on the target display mode to be switched to, thereby completing the targeted configuration and pre-writing operation of the subtitle line data. This configuration process is a one-way data transmission process, where only the switching control container sends the original subtitle content to the target display container. It does not tamper with or modify the original subtitle data and operating state inside the first display container, nor does it require the target display container to perform additional subtitle parsing, timestamp comparison, index retrieval, or other computational logic. By pre-configuring valid subtitle line content to the target display container, the view container to be activated can directly call the configured subtitle data for rendering and display the moment the mode switch and interface loading are completed. This effectively solves the technical defects of interface lag and content loading delay caused by data loading delay and asynchronous calculation in the traditional dual-view switching process, achieving seamless subtitle content transition.
[0116] S630, the visual transition animation that triggers the display mode switching when switching control containers.
[0117] In one possible implementation, after completing all pre-processing work such as configuring and preloading the subtitle line data for the target display container, the switching control container centrally triggers a dedicated visual transition animation for switching between the multi-line subtitle view and the single-line subtitle view. This type of visual transition animation differs from the content switching animation for subtitle line changes; it is primarily used to achieve UI state transition effects such as interface showing / hiding, layout scaling, window displacement, and interface gradation between the two types of views. It unifies and coordinates the timing of hiding, loading, and showing the interfaces of the first and second display containers, standardizing the interface switching rhythm between the two containers. By adding a dedicated transition animation for mode switching, the abrupt visual disconnect caused by direct, instantaneous switching between the two types of views can be avoided, balancing the visual experience of multimodal interface switching in the vehicle cockpit. Simultaneously, the centralized and unified triggering of the animation by the switching control container ensures synchronized timing and unified action logic for the switching actions between the two containers, preventing interface display chaos caused by asynchronous animation execution across multiple containers.
[0118] The subtitle display method provided in this application responds to a display mode switching command generated between a single-line subtitle view and a multi-line subtitle view. Before formally executing the switching command, the switching control container first obtains the real-time valid current subtitle line content from the first display container, which serves as the globally unique computing source. This ensures that the source of subtitle data before mode switching is unified, effectively avoiding the subtitle content misalignment problem caused by independent values from multiple views. Then, the switching control container uniformly configures the obtained current subtitle line into the target display container adapted to the switching scenario. If the command requires switching to a multi-line subtitle view, the first display container is set as the target display container to complete the subtitle display. Content display is seamless. If the instruction requires switching to a single-line subtitle view, the second display container is configured as the target display container to achieve cross-device synchronous delivery of subtitle content, matching the carrier of different display modes. At the same time, the switching control container synchronously triggers the visual transition animation corresponding to the display mode switch, so that the switching process between the two types of subtitle views is smoothly connected, eliminating the drawbacks of abrupt interface jumps, content gaps, and display stuttering during mode switching. On the basis of achieving seamless switching and content continuity between dual-mode subtitles, it improves the visual smoothness and display consistency of the in-vehicle cockpit subtitle interaction interface, and meets the diverse view switching experience needs of in-vehicle scenarios.
[0119] Figure 8 A flowchart illustrating a subtitle display method provided in this application embodiment. Figure 5 .like Figure 8 As shown, the above method also includes: S710. During the process of the second display container performing a preset switching animation based on the changed subtitle line, if a new changed subtitle line is received, the new changed subtitle line is cached.
[0120] In one possible implementation, during the continuous cycle of the second display container running the preset subtitle switching animation and completing the dynamic transition rendering of the interface according to the first value instruction issued by the first display container, the current UI animation process will cause a brief blockage in the real-time redrawing of the interface. During this animation execution blocking period, if the first display container determines that the subtitle line has changed again based on the audio playback progress and issues new updated subtitle line data and linkage instructions, the second display container will not forcibly interrupt the currently playing switching animation, nor will it directly overwrite the currently displayed subtitle content, thus avoiding visual anomalies such as screen tearing, flickering, and rendering errors caused by forcibly interrupting the animation. At the same time, the second display container opens an independent temporary data cache area, adopts a last-write-wins storage strategy, and temporarily caches the newly received updated subtitle line data, retaining only the latest subtitle update data and discarding redundant historical data. This ensures the complete closed-loop operation of the currently executing animation process while temporarily retaining the subtitle content that needs to be updated later. The compensation update mechanism of this application is constructed based on this cache temporary storage logic.
[0121] S720. When the end callback of the preset switching animation is triggered, check if there is a cached new changed subtitle line.
[0122] In one possible implementation, the second display container synchronously binds a configured animation end callback listener event when each subtitle switching animation is initiated. This callback event is a native triggering mechanism of the UI system, automatically triggered only at the moment when the current entire preset switching animation has finished playing and the animation process has completely terminated. Once the animation end callback is triggered normally, the second display container immediately enters a state detection process, actively accessing and traversing its own preset temporary cache area to retrieve and verify whether the cache space retains any subtitle line data that was temporarily stored in the previous animation execution phase and not processed in time. This detection operation is performed synchronously and with low latency, without consuming excessive computing resources of the vehicle system's main thread. It is a crucial timing node connecting animation execution and subsequent subtitle updates, effectively bridging the animation blocking phase and the normal rendering phase.
[0123] S730. If a new, modified subtitle line exists in the cache, the second display container initiates a new round of display content update operations based on the cached new, modified subtitle line.
[0124] In one possible implementation, after the second display container completes the cache content retrieval and comparison, if it determines that there is indeed unprocessed new subtitle line data remaining in the temporary cache area, it means that the audio playback progress has generated a new subtitle switching requirement that was not responded to in time due to the previous animation blockage. At this time, the second display container extracts the latest valid subtitle line data in the cache area and synchronously matches the animation control flag parameter in the corresponding linkage instruction, clears expired cache data to release storage resources, and uses the latest cached subtitle line as the update benchmark to automatically initiate a new round of complete subtitle display content update process. The new round of update operation follows the control rules issued by the first display container, selects to execute the preset switching animation or directly redraw the interface according to the animation control flag value, and completes the iterative display of subtitle content in an orderly manner, thereby compensating for the backlog of subtitle update requirements during the animation blockage and solving problems such as delayed subtitle updates, content omissions, and asynchronous display of dual views caused by animation timing limitations in continuous playback scenarios.
[0125] The subtitle display method provided in this application, during the execution of a preset switching animation based on the changed subtitle line by the second display container, if it simultaneously receives new subtitle line update data from the main control module, promptly caches the newly added subtitle line content to avoid issues such as screen overlap, UI distortion, or loss of update commands caused by direct execution of new commands during animation rendering blocking. Once the preset switching animation has fully run and triggered the end callback mechanism, the second display container actively searches its local cache space to check for any temporarily stored, unprocessed new subtitle line data. If cached new subtitle line content is detected, the second display container uses the cached data as the update basis and initiates a new round of interface refresh and subtitle content replacement operations in an orderly manner. Through this timing compensation and command caching processing logic, the staggered and orderly execution of animation tasks and subtitle update tasks can be achieved, effectively resolving timing conflicts between high-frequency subtitle switching and animation rendering in continuous playback scenarios, avoiding display anomalies caused by multiple sets of update commands occurring concurrently in a short period, and ensuring the orderliness and smoothness of subtitle updates in single-line subordinate views.
[0126] Optionally, the above method caches the new, modified subtitle lines, including: Using a preset last write truncation rule, the new modified subtitle line is saved to an atomic storage unit.
[0127] The default last-write truncation rule is to replace the existing subtitle lines in the atomic storage unit with the new, updated subtitle lines during cache updates. This is a cache update strategy customized for high-frequency subtitle switching scenarios, and its core logic is equivalent to the last-write-wins mechanism. During the cache refresh and data update process in the atomic storage unit, instead of using a queue-based, sequential cache processing mode, the latest received updated subtitle line is used as the effective data benchmark. This directly overwrites and replaces the old, cached subtitle lines already stored in the atomic storage unit, actively discarding outdated or lagging historical subtitle cache data. This one-to-one direct replacement cache update method ensures that the atomic storage unit always retains only the latest version of the subtitle line data, preventing update disorder and screen jumps caused by the accumulation of multiple sets of expired subtitle instructions. It simplifies the data processing logic of the second display container, reduces the computational power consumption of the vehicle's UI rendering, and ensures the uniqueness and timeliness of the subtitle cache data.
[0128] Among them, the atomic storage unit is a dedicated cache storage area independently set up inside the second display container, which has thread-safe read and write capabilities. It can realize atomic operations of data read and write, effectively avoiding problems such as data corruption and abnormal content overwriting caused by multi-threaded concurrent read and write.
[0129] In one possible implementation, if the second display container continuously receives newly updated subtitle line data sent unilaterally by the first display container during the period when it is executing a preset switching animation and the UI thread is blocked by the animation, the system will use a preset last write truncation rule to complete the data temporary storage process. For the latest subtitle line data arriving successively during the animation execution, the second display container, according to the preset cache management logic, uniformly stores the newly generated and newly sent updated subtitle lines into the atomic storage unit in an orderly manner to complete the temporary cache retention. This achieves temporary storage of update instructions during the animation blocking phase, avoids the direct discarding or invalid accumulation of new subtitle update requests, and provides a cache carrier support for the stable operation of the compensation update mechanism of this application.
[0130] In the above method, when the end callback of the preset switching animation is triggered, it checks whether there is a cached new changed subtitle line, including: When the end callback of the preset transition animation is triggered, check whether the atomic storage unit contains the new changed subtitle line.
[0131] In one possible implementation, each time the second display container responds to the first value command and initiates the preset subtitle switching animation, it simultaneously binds and configures a dedicated animation end callback function. This animation end callback function is deeply bound to the lifecycle of the switching animation and belongs to the post-triggered logic of the animation execution flow. When a single round of preset switching animation has finished playing, animation resources have been released, and the UI rendering thread has been unblocked, the system will automatically trigger the preset animation end callback event. At the moment the callback event is triggered, the second display container immediately initiates a targeted data detection action, actively accesses and reads the internal storage state of the atomic storage unit, and checks whether the atomic storage unit has cached and retained any newly changed subtitle lines that were accessed during the previous round of animation execution but were not executed in time. This detection process is completed synchronously in real time, the detection logic is simple and efficient, there is no extra computational redundancy, and it connects with the subsequent update process after the animation ends, realizing the time-series linkage between the animation cycle and the cache detection action.
[0132] If a cached new modified subtitle line exists in the above method, the second display container initiates a new round of display content update operations based on the cached new modified subtitle line, including: If a new modified subtitle line exists in the atomic storage unit, the new modified subtitle line is retrieved from the atomic storage unit, and a new round of display content update operation is initiated based on the new modified subtitle line.
[0133] In one possible implementation, after completing the state detection of the atomic storage unit, the system executes differentiated processing logic based on the detection result. When the detection confirms that there is a newly changed subtitle line in the cache inside the atomic storage unit that has not yet been executed, the second display container extracts the latest subtitle line content from the cache in an atomic reading manner. At the same time, the cached data in the atomic storage unit can be cleared simultaneously to prevent residual data from interfering with the next round of cache writing. After completing the reading of the latest subtitle line data, the second display container uses this new subtitle line as the update basis, combined with the animation control flag value corresponding to the current linkage instruction, to automatically initiate a new round of complete subtitle display content update operation, cyclically matching and executing preset switching animations or real-time interface redrawing processes, and continuously completing the continuous subtitle switching rendering. If the detection result is that there is no new cached data in the storage unit, no additional update action is triggered, and the current subtitle display state remains unchanged. This closed-loop processing logic effectively solves the technical pain point that instructions cannot be responded to in a timely manner during subtitle animation blocking, improves the compensation update capability under the master-slave architecture, and ensures the synchronization of subtitle display timing and the smooth and stable display of the dual containers.
[0134] The subtitle display method provided in this application employs a preset last-write truncation rule to cache and save newly changed subtitle lines in atomic storage units in real time. During the cache update process, this preset last-write truncation rule directly overwrites the old subtitle line data already cached in the atomic storage unit with the newly generated changed subtitle line, effectively avoiding the problems of multiple rounds of update command accumulation and data redundancy. When the current preset switching animation completes and triggers the end callback, the second display container promptly detects and checks the cached data inside the atomic storage unit to determine whether there is a newly changed subtitle line to be executed temporarily stored in the storage unit. If there is updated subtitle line data stored in the atomic storage unit, the latest changed subtitle line is immediately read and retrieved, and a new round of interface display content update and rendering operation is initiated simultaneously based on the content of the latest subtitle line. Thus, through the above-mentioned linkage mechanism of atomic caching, old data overwriting and replacement, and continuous updates after the animation ends, this application can properly solve the problem of continuous subtitle commands not responding in time during UI animation blocking, achieve temporal decoupling between animation execution and subtitle updates, and prevent adverse phenomena such as subtitle refresh lag, screen tearing, and display errors.
[0135] Based on the same inventive concept, this application also provides a subtitle display device. The principle of the device in this application is similar to the subtitle display method described above in this application. Therefore, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0136] Figure 9 This is a schematic diagram of the structure of a subtitle display device provided in an embodiment of this application. Figure 9As shown, the subtitle display device 800 is operated by a first display container, and the subtitle display device 800 may include: The first determining module 801 is used to determine the current subtitle line corresponding to the playback progress of the target audio during the playback of the target audio. The second determining module 802 is used to determine the changed subtitle line in response to a change in the current subtitle line when a second display container for displaying subtitles of the target audio exists. Both the second display container and the first display container are used to display the subtitle line corresponding to the playback progress. The first display container is also used to display other subtitle lines adjacent to the subtitle line corresponding to the playback progress. The replacement module 803 is used to send the changed subtitle line to the second display container so that the second display container can replace the displayed subtitle line with the changed subtitle line.
[0137] In one optional implementation, the first determining module 801 is specifically used to: obtain the current playback timestamp corresponding to the playback progress of the target audio; traverse a preset subtitle timestamp set, the preset subtitle timestamp set including at least: the start time point corresponding to each line of subtitles in the multi-line subtitles; compare the current playback timestamp with the start time point of each line of subtitles in the subtitle timestamp set; when the current playback timestamp is greater than or equal to the start time point of the i-th line of subtitles and less than the start time point of the (i+1)-th line of subtitles, determine the i-th line of subtitles as the current subtitle line; i is a positive integer.
[0138] In one optional implementation, the subtitle display device 800 is further configured to: compare the current subtitle line with the subtitle line at the previous moment; the previous moment is the moment when the first display container last sent a subtitle line to the second display container; if the current subtitle line is different from the subtitle line at the previous moment, then confirm that the current subtitle line has changed.
[0139] In an optional implementation, the subtitle display device 800 is further configured to: determine the value of an animation control identifier based on the type of event that causes the current subtitle line to change; the animation control identifier is used to indicate whether the second display container updates the display in an animated manner; the replacement module 803 is specifically configured to: send the changed subtitle line and the value of the animation control identifier to the second display container; the second display container, based on the value of the animation control identifier, selects to replace the displayed subtitle line with the changed subtitle line by executing a preset switching animation or by redrawing.
[0140] In one optional implementation, the subtitle display device 800 is specifically configured to: if the event type causing the current subtitle line to change is a playback progress update event triggered by the media player at a preset time interval, then the value of the animation control identifier is determined as a first value; the first value is used to instruct the second display container to execute a preset switching animation; if the event type causing the current subtitle line to change is a playback progress jump or song switching operation triggered by the user, then the value of the animation control identifier is determined as a second value; the second value is used to instruct the second display container not to execute the preset switching animation; the second value is different from the first value.
[0141] In one optional implementation, the subtitle display device 800 is specifically configured to: if the value of the animation control identifier of the second display container is a first value, then select to replace the subtitle line displayed by the second display container with the changed subtitle line by executing a preset switching animation; if the value of the animation control identifier of the second display container is a second value, then select to replace the subtitle line displayed by the second display container with the changed subtitle line by executing a redraw.
[0142] In an optional embodiment, the subtitle display device 800 is further configured to: in response to an instruction to switch display modes between a single-line subtitle view and a multi-line subtitle view, before executing the instruction, obtain the current subtitle line of the first display container by the switching control container; configure the current subtitle line into the corresponding target display container; wherein, if switching to a multi-line subtitle view, the target display container is configured as the first display container; if switching to a single-line subtitle view, the target display container is configured as the second display container; and trigger a visual transition animation for the display mode switching by the switching control container.
[0143] In one optional implementation, the subtitle display device 800 is further configured to: during the process of the second display container performing a preset switching animation based on the changed subtitle line, if a new changed subtitle line is received, cache the new changed subtitle line; when the end callback of the preset switching animation is triggered, check whether there is a cached new changed subtitle line; if there is a cached new changed subtitle line, the second display container initiates a new round of display content update operation based on the cached new changed subtitle line.
[0144] In one optional implementation, the subtitle display device 800 is specifically configured to: save the new modified subtitle line to an atomic storage unit using a preset last write truncation rule; the preset last write truncation rule is to replace the modified subtitle line already stored in the atomic storage unit with the new modified subtitle line when the cache is updated; when the preset end callback of the switching animation is triggered, check whether the atomic storage unit contains the new modified subtitle line; if the atomic storage unit contains the new modified subtitle line, retrieve the new modified subtitle line from the atomic storage unit and initiate a new round of display content update operation based on the new modified subtitle line.
[0145] It should be noted that for details not disclosed in the subtitle display device of this application embodiment, please refer to the details disclosed in the subtitle display method of this application embodiment, which will not be repeated here.
[0146] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0147] Optionally, embodiments of this application also provide a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor performs the steps of the subtitle display method for the mobile storage medium described in the above embodiments. The specific implementation and technical effects are similar and will not be repeated here.
[0148] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the functional units in the various embodiments of this 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 integrated unit described above can be implemented in hardware or in the form of hardware plus software functional units.
[0149] Optionally, this embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement a subtitle display method provided in the above embodiment.
[0150] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0151] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0152] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0153] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for displaying subtitles, characterized in that, Performed by the first display container, the method includes: During the playback of the target audio, the current subtitle line corresponding to the playback progress of the target audio is determined; In the presence of a second display container for displaying subtitles of the target audio, in response to a change in the current subtitle line, the changed subtitle line is determined. Both the second display container and the first display container are used to display subtitle lines corresponding to the playback progress. The first display container is also used to display other subtitle lines adjacent to the subtitle line corresponding to the playback progress. The modified subtitle line is sent to the second display container so that the second display container replaces the displayed subtitle line with the modified subtitle line.
2. The method according to claim 1, characterized in that, Determining the current subtitle line corresponding to the playback progress of the target audio includes: Obtain the current playback timestamp corresponding to the playback progress of the target audio. Traverse the preset subtitle timestamp set, which includes at least the start time point corresponding to each line of subtitles in the multi-line subtitles; The current playback timestamp is compared with the start time of each line of subtitles in the subtitle timestamp set; When the current playback timestamp is greater than or equal to the start time of the i-th line of subtitles and less than the start time of the (i+1)-th line of subtitles, the i-th line of subtitles is determined to be the current subtitle line; i is a positive integer.
3. The method according to claim 1, characterized in that, The method further includes: The current subtitle line is compared with the subtitle line at the previous moment; the previous moment is the moment when the first display container last sent a subtitle line to the second display container; If the current subtitle line is different from the subtitle line at the previous moment, then it is confirmed that the current subtitle line has changed.
4. The method according to claim 1, characterized in that, After responding to a change in the current subtitle line and determining the changed subtitle line, the method further includes: The value of the animation control identifier is determined based on the type of event that causes the current subtitle line to change; the animation control identifier is used to indicate whether the second display container updates its display in an animated manner; Sending the modified subtitle line to the second display container includes: Send the changed subtitle line and the value of the animation control identifier to the second display container; The second display container replaces the displayed subtitle lines with the changed subtitle lines, including: Based on the value of the animation control identifier, the second display container selects to replace the displayed subtitle line with the changed subtitle line by either executing a preset switching animation or redrawing.
5. The method according to claim 4, characterized in that, The determination of the value of the animation control identifier based on the event type that causes the current subtitle line to change includes: If the event type that causes the current subtitle line to change is a playback progress update event triggered by the media player at a preset time interval, then the value of the animation control identifier is determined to be the first value; the first value is used to instruct the second display container to execute the preset switching animation; If the event type that causes the current subtitle line to change is a user-triggered playback progress jump or song switching operation, then the value of the animation control identifier is determined to be the second value; the second value is used to instruct the second display container not to execute the preset switching animation; the second value is different from the first value.
6. The method according to claim 5, characterized in that, The second display container, based on the value of the animation control identifier, selects either to execute a preset switching animation or to redraw to replace the displayed subtitle line with the changed subtitle line, including: If the second display container takes the first value based on the value of the animation control identifier, then the subtitle line displayed by the second display container is replaced with the changed subtitle line by executing the preset switching animation. If the second display container takes the second value based on the value of the animation control identifier, then the subtitle line displayed by the second display container is replaced with the changed subtitle line by performing a redraw.
7. The method according to claim 1, characterized in that, The method further includes: In response to an instruction to switch display modes between a single-line caption view and a multi-line caption view, the switching control container obtains the current caption line of the first display container before executing the instruction; The switching control container configures the current subtitle line into the corresponding target display container; wherein, if switching to the multi-line subtitle view, the target display container is configured as the first display container; if switching to the single-line subtitle view, the target display container is configured as the second display container. The switching control container triggers the visual transition animation for the display mode switching.
8. The method according to claim 1, characterized in that, The method further includes: During the process of the second display container performing a preset switching animation based on the changed subtitle line, if a new changed subtitle line is received, the new changed subtitle line is cached. When the end callback of the preset switching animation is triggered, check if there is a cached new changed subtitle line; If the new, modified subtitle line exists in the cache, the second display container initiates a new round of display content update operations based on the cached new, modified subtitle line.
9. The method according to claim 8, characterized in that, The caching of the newly changed subtitle lines includes: A preset last write truncation rule is used to save the new modified subtitle line to an atomic storage unit; the preset last write truncation rule is that when the cache is updated, the new modified subtitle line replaces the modified subtitle line already stored in the atomic storage unit. When the end callback of the preset switching animation is triggered, checking whether there is a cached new changed subtitle line includes: When the end callback of the preset switching animation is triggered, check whether the atomic storage unit contains the new changed subtitle line; If a cached version of the new, modified subtitle line exists, the second display container initiates a new round of display content update operations based on the cached new, modified subtitle line, including: If the new modified subtitle line exists in the atomic storage unit, the new modified subtitle line is retrieved from the atomic storage unit, and a new round of display content update operation is initiated based on the new modified subtitle line.
10. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable program code; A processor for calling and running the executable program code from the memory, causing the electronic device to perform the method as described in any one of claims 1 to 9.