Cross-device audio playback methods, systems, devices and storage media
By combining multidimensional state vector and difference detection algorithms with device feature recognition and three-way merging strategies, the continuity problem of audio playback applications in multi-device scenarios is solved, achieving seamless cross-device playback, reducing network consumption and improving user experience.
Patent Information
- Application Number
- CN202510850668.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2045-06-24
AI Technical Summary
Existing audio playback applications cannot achieve seamless synchronization of playback status in multi-device usage scenarios, resulting in problems such as excessive volume, mismatched sound effects, and playback stuttering when users switch devices. Furthermore, existing cloud synchronization technologies cannot save playback progress, sound effect settings, and the learning results of personalized recommendation algorithms.
It adopts a multi-dimensional state vector design, uses a difference detection algorithm to locate and compress state difference data, combines a device feature recognition algorithm for intelligent adaptation, and employs a three-way merging strategy when there are state conflicts among multiple devices to achieve intelligent recovery of playback parameters and seamless cross-device continuous playback.
It achieves complete synchronization of the playback queue, significantly reduces network bandwidth consumption and cloud storage costs, improves playback continuity and user experience during device switching, and ensures data consistency and system availability.
Smart Images

Figure CN120499456B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of audio playback technology, and in particular to a cross-device audio playback method, system, device, and storage medium. Background Technology
[0002] With the widespread adoption of mobile internet and smart devices, user consumption of audio content is characterized by multiple devices and scenarios. Traditional audio playback applications are primarily designed for single devices, storing playback queues, user preferences, and other data locally. This architecture reveals significant shortcomings in multi-device usage scenarios. Existing cloud synchronization technologies mainly focus on synchronizing the audio files themselves, offering limited support for synchronizing playback status. They typically only synchronize basic playlist information and cannot save deeper state data such as playback progress, sound effect settings, and the learning results of personalized recommendation algorithms. Furthermore, hardware differences between devices, variations in network environments, and differences in user habits mean that simple data synchronization cannot meet users' demands for a continuous playback experience. Existing technologies lack intelligent state adaptation mechanisms and cannot adjust playback parameters according to the characteristics of the target device, leading to frequent issues such as excessive volume, mismatched sound effects, and playback stuttering when switching devices. Summary of the Invention
[0003] This invention provides a cross-device audio playback method, system, device, and storage medium, achieving a truly seamless cross-device audio playback experience. It ensures the integrity of the playback queue, including full synchronization of playback order, current position, and personalized settings, solving the continuity problem of audio playback applications in cross-device usage scenarios.
[0004] The first aspect of this invention provides a cross-device audio playback method, characterized in that it includes: A playback queue integrity preservation mechanism based on multidimensional state vectors captures playback status in real time; The algorithm for detecting differences in the playlist is used to locate and compress the status difference data in the playlist to the cloud. The playback parameters are intelligently adapted through device feature recognition algorithms, and the optimized cloud playback status is transmitted to the new device according to the intelligent recovery strategy. When multiple device states are detected to conflict, the conflict is merged based on a priority strategy to obtain the final merged playlist, thus enabling seamless continuous playback across devices.
[0005] Preferably, the playback queue integrity preservation mechanism based on multi-dimensional state vectors captures the playback state in real time, including: Create a QueueState data structure that aggregates all information from the current playback queue; The completeness of playback status data is evaluated by using a weighted summation quantization formula for the state vector. The state change monitoring mechanism based on the observer pattern monitors changes in playback state in real time and automatically triggers a state saving operation when the playback state changes.
[0006] Preferably, the status difference data in the playlist located based on the difference detection algorithm includes: The hash values of the local and remote states are calculated using a hash comparison method. If the hash values corresponding to the local and remote devices are different, the compareAudioLists function is called to obtain the state difference data, and the state difference data is added to the StateDifference object. The change in playback position is detected by threshold comparison. When the change in the current playback position reaches or exceeds a preset threshold, a synchronization operation is performed on the state difference data. The StateDifference object includes the list of newly added songs, the changed playback position, and data related to audio changes.
[0007] Preferably, the step of locating the status difference data in the playlist based on the difference detection algorithm and synchronously compressing it to the cloud includes: The state difference data is serialized into a byte array to generate serialized difference data; The LZ4 algorithm is used to compress serialized differential data; Add compression header information to the compressed data to ensure that the data can be correctly decompressed and restored.
[0008] Preferably, the intelligent adaptation of playback parameters through a device feature recognition algorithm includes: A device feature model is constructed based on device hardware information, user usage patterns, and network information to quantify the compatibility or adaptability of the device with the playback task. The hardware information of the device and the user's usage history are received through the createProfile method, and the hardware score, usage pattern score and network score are calculated respectively. The final score representing the device's hardware capabilities is calculated using a weighted scoring model, and a DeviceProfile object is returned. The DeviceProfile object includes the device ID, compatibility score, and audio capability information.
[0009] Preferably, the intelligent recovery strategy includes: The target device characteristics, saved playback status, and current user context are received through the selectStrategy method, and scores for different strategies are calculated respectively. The strategies include scoring strategies related to continuity, adaptability, and performance optimization indicators. A comprehensive score is calculated using a weighted scoring model. The optimal recovery strategy is selected based on the comprehensive score, and the playback status is restored after switching devices and loading the saved playback status.
[0010] Preferably, the multi-device state conflict detection mechanism detects multiple device state conflicts including: When receiving a playback queue status update from another device, or after a local user completes the corresponding operation that caused the conflict, a conflict detection operation is triggered. The time conflict detection mechanism compares the timestamp and the device ID. If the triggering conditions are met, it is marked as a time conflict. The triggering conditions for time conflict detection include that the time difference between the operations of the two devices is less than a threshold and that the device IDs are different. The state conflict detection mechanism compares the version number and the state hash. If the conditions are met, it is marked as a state conflict. The triggering conditions for state conflict detection include two operations based on the same version and different state hash values.
[0011] Preferably, the final playlist obtained by merging conflicts according to the three-way merging strategy includes: Determine the baseline playlist, and merge the local playlist and the remote playlist into the baseline playlist; Compare the local timestamp and the remote timestamp, and select the valid playback position with the latest timestamp; The playlists are merged according to user preferences and the playback status of the merged playlists is synchronized.
[0012] As a preferred option, it also includes: In the event of network unavailability, the local state cache based on the LRU algorithm continues to execute the playback state.
[0013] As a preferred option, it also includes: In the event of network recovery, local offline change and remote change data are acquired based on an incremental recovery mechanism; Compare local offline change data with remote change data, and merge the incremental data after comparison; The merged playback status is applied to the player to ensure that the playback queue and playback position are consistent.
[0014] As a preferred option, it also includes: optimizing playback status and synchronous operation based on asynchronous processing mechanisms.
[0015] As an alternative, it also includes: establishing a key performance indicator monitoring system and evaluating the system status in real time through quantitative performance indicator formulas.
[0016] A second aspect of the present invention provides a cross-device audio playback system based on cloud synchronization, comprising: The state acquisition module is used to capture the playback state in real time based on the playback queue integrity preservation mechanism of multi-dimensional state vector; The incremental synchronization module is used to locate status difference data in the playlist based on the difference detection algorithm and synchronously compress it to the cloud; The adaptation module is used to intelligently adapt playback parameters through device feature recognition algorithms and transmit the optimized cloud playback status to the new device according to the intelligent recovery strategy. The conflict resolution module is used to merge conflicts based on a priority strategy when multiple device states are detected to obtain a merged final playlist, thereby enabling seamless continuous playback across devices.
[0017] A third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the above-described cross-device audio playback method.
[0018] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the aforementioned cross-device audio playback method.
[0019] This invention proposes a cross-device audio playback method, which innovatively solves the continuity problem of audio playback applications in cross-device usage scenarios by constructing a playback queue integrity preservation system based on multi-dimensional state vectors. The core technological advantages of the solution are reflected in six key dimensions: First, the multi-dimensional state vector design breaks through the limitation of traditional solutions that only save the playlist, realizing full state saving including playback progress, sound effect settings, and personalized recommendation weights, with state integrity exceeding 95%; Second, the incremental synchronization algorithm reduces data transmission volume by 70-90% through SHA-256 hash difference detection and LZ4 compression technology, significantly reducing network bandwidth consumption and cloud storage costs; Third, the intelligent device adaptation mechanism automatically optimizes playback parameters based on a comprehensive evaluation of hardware characteristics and user behavior patterns, achieving an adaptation accuracy rate of over 92% and effectively avoiding volume surges and sound effect mismatches during device switching; Fourth, the three-way merging algorithm and timestamp-based conflict detection mechanism ensure data consistency in multi-device environments, achieving a conflict resolution accuracy rate of 96% and reducing data loss rate to below 0.1%; Fifth, the LRU caching strategy and incremental recovery mechanism guarantee the availability of basic functions in offline environments, improving data synchronization efficiency by 60% during network recovery; Finally, the asynchronous processing architecture and performance monitoring system optimize system response speed, reducing user operation response time by 60% and achieving system availability of 99.9%. This technical solution not only achieves a truly seamless cross-device audio playback experience, but also lays the technical foundation for the ecological development of audio applications, and has significant market application value and technology promotion prospects.
[0020] This invention utilizes multi-dimensional state vector modeling to, for the first time, unify the modeling of multi-level information such as playback progress, sound effect settings (e.g., equalizer), personalized recommendation weights, and device context (e.g., speaker type), achieving deep preservation of the complete playback environment. Through an intelligent recovery strategy, new devices can inherit optimized cloud states (e.g., automatically adjusting sound quality based on device performance), eliminating the need for users to manually reset playback parameters and providing an immersive "resume playback" experience. It employs the SHA-256 hash comparison method to locate state differences and combines it with the LZ4 algorithm to compress incremental data, requiring synchronization only of changed parts (e.g., added songs, playback position offsets), rather than the entire queue. A threshold for playback position change is used to determine whether synchronization is triggered, avoiding frequent invalid transmissions (e.g., brief pause operations by the user), further improving efficiency. A device adaptation model is generated based on hardware capabilities, network conditions, and user habits (e.g., commonly used volume), dynamically adjusting... The system integrates playback parameters; based on a three-way conflict resolution mechanism, when multiple devices operate simultaneously (e.g., a speaker resumes playback after a phone pauses), it intelligently merges conflicting data through joint detection of timestamps, version numbers, and state hashes, generating a final, consistent playlist to avoid manual intervention or data loss; when the network is unavailable, it caches key states (e.g., currently playing song, progress) based on a Least Recently Used (LRU) strategy to ensure uninterrupted local playback and a seamless user experience; after the network recovers, it automatically merges local offline changes (e.g., songs added offline) with remote changes in the cloud (e.g., playback operations on other devices), ensuring data consistency through version comparison and avoiding conflicts or data overwriting; it performs state synchronization and compression operations through asynchronous threads to avoid blocking the main thread; and it establishes quantitative performance indicators (e.g., synchronization latency, compression ratio) to monitor system health in real time, ensuring smoothness in high-concurrency scenarios. This addresses the long-standing pain point of inconsistent cross-device playback, supports complex scenarios (e.g., multiple devices used in a home, cross-platform switching), and drives the evolution of audio services from "basic functionality" to "seamless experience." Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating the cross-device audio playback method in this embodiment; Figure 2 This is a schematic diagram of one embodiment of the electronic device in this example. Detailed Implementation
[0022] This invention provides a cross-device audio playback method, system, device, and storage medium. By using persistent audio capture sessions and dynamic audio processing pipelines, it effectively solves the problem of audio input players reopening capture when switching modes.
[0023] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] Example 1 For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 This invention provides a cross-device audio playback method, comprising the following steps: S1: A playback queue integrity preservation mechanism based on multi-dimensional state vectors captures playback status in real time; S2: Based on the difference detection algorithm, locate the status difference data in the playlist and compress it synchronously to the cloud; S3: Intelligently adapts playback parameters through device feature recognition algorithms and transmits the optimized cloud playback status to the new device according to the intelligent recovery strategy; S4: When multiple device states are detected to conflict, the conflict is merged based on the priority strategy to obtain the final merged playlist, thus enabling seamless continuous playback across devices.
[0025] Those skilled in the art will understand that by capturing multi-dimensional playback states (such as progress, volume, playback mode, etc.) in real time, users can accurately restore the playback context when switching between different devices, avoiding interruptions or resets and achieving "resume playback from where it left off." By using a difference detection algorithm to synchronize only changed data, combined with an intelligent recovery strategy, it ensures that new devices quickly inherit the cloud-optimized playback state, reducing latency and improving response speed. Transmitting state difference data rather than the entire queue reduces cloud storage pressure and network bandwidth consumption, especially suitable for low-frequency change scenarios (such as playing the same playlist for a long time). Dynamically adjusting playback parameters (such as sound quality and equalizer) based on device characteristics (such as speaker type and decoding capabilities) balances performance and power consumption, extending device battery life. When multiple devices operate simultaneously (such as controlling playback from a mobile phone and computer simultaneously), conflicts are merged through preset rules (such as device type, user habits, and timestamps) to generate a unified final playlist, avoiding logical confusion. It supports multiple devices online simultaneously without conflict interference; for example, allowing playback to resume via a speaker after pausing on a mobile phone, achieving complementary control of multiple devices. Users can achieve a truly seamless cross-device audio playback experience. The integrity of the playback queue is guaranteed, including full synchronization of playback order, current position, and personalized settings. The intelligent recovery mechanism automatically adjusts playback parameters based on device type and usage scenario, improving user satisfaction. Incremental synchronization technology significantly reduces network traffic consumption and cloud storage costs. The system's high-reliability design ensures no data loss and supports basic functions in offline mode. This technology also lays the foundation for the development of an audio application ecosystem, supporting the access of third-party devices and expanding the product's market competitiveness and user stickiness.
[0026] In one embodiment, the real-time capture of playback status by the playback queue integrity preservation mechanism based on multi-dimensional state vectors in step S1 includes: Create a QueueState data structure that aggregates all information from the current playback queue; The completeness of playback status data is evaluated by using a weighted summation quantization formula for the state vector. The state change monitoring mechanism based on the observer pattern monitors changes in playback state in real time and automatically triggers a state saving operation when the playback state changes.
[0027] The QueueState data structure includes information about the songs in the current playlist, the song number in the playlist that is currently playing, the playback progress, the playback mode, the current volume, the equalizer settings, the user's personal preferences, the current device information, and the timestamp of the status information generation.
[0028] This embodiment employs a multi-dimensional state vector construction. First, a comprehensive playback queue state data structure is established, containing the following core components: an audio list (composed of multiple AudioItems), the index position of the currently playing audio in the list, the current playback progress (a floating-point number between 0 and 1, representing the playback percentage), playback mode (e.g., sequential playback, shuffle playback, single-track loop, etc.), volume level (a floating-point number between 0.0 and 1.0), equalizer configuration (a custom equalizer parameter object), user preference vector (a multi-dimensional vector containing personalized settings), device context information (e.g., device model, operating system version, etc.), and a state update timestamp (used for version control and conflict resolution). The AudioItem structure is defined as: a unique audio identifier, audio title, artist name, total audio duration (in seconds), audio file path, additional metadata (e.g., album art, genre, year, etc. key-value pairs), cumulative playback count, timestamp of the last playback, and user rating for the audio (a floating-point number between 0 and 5). This can be understood as ensuring state integrity by using the QueueState structure to completely store all necessary information of the playback queue, including: Current playback position, global settings (volume, equalizer, playback mode), user preferences, device environment, and timestamps are used for state version management. In audio metadata management, AudioItem not only contains basic information (title, artist) but also supports unstructured data such as album art, lyrics, and style tags, as well as statistical information (playback count, last playback time) and user subjective reviews (ratings) through the metadata field. In multi-device synchronization, the deviceContext and timestamp fields enable: continuity of playback status between different devices, timestamp-based version conflict resolution, and device capability awareness (e.g., automatically adjusting sound quality based on DeviceInfo). Algorithm formula 1 – State Vector Completeness calculation – is used: StateCompleteness=Σ(Wi×Si) / Σ(Wi), where Wi represents the weight of the i-th state component, and Si represents the completeness of the i-th state component (between 0 and 1). For example, when a user plays music on their phone, the system collects the playback status in real time: currently playing "Confession Balloon," playback progress 65%, volume 70%, "Pop Music" equalizer preset enabled, playback mode shuffle. The system encapsulates this information into a state vector, with an integrity score of 0.95. The aforementioned observer pattern-based state change monitoring mechanism implements a state change listener that automatically triggers a state saving process when the playback status changes: a "listener" is set up to constantly monitor changes in the playback status, such as song switching, progress changes, or volume adjustments. When a change is detected, the listener doesn't save every time, but sets an interval (e.g., 5 seconds), or triggers saving only when the change reaches a certain level. When saving is triggered, it captures the latest QueueState and then hands it over to a "state manager" for saving. Through this multi-dimensional state vector design, the integrity of the playback environment is ensured, avoiding the problem of state information loss in traditional solutions; the intelligent monitoring mechanism reduces unnecessary saving operations, improving system efficiency.
[0029] Traditional synchronization methods may send the complete playback state (the entire playlist, current playback progress, sound effects settings, etc.) to the remote end every time, even if only a small part has changed. This method is inefficient, especially when the playlist is long or network bandwidth is limited. The goal of incremental synchronization in this embodiment is to identify and synchronize only the data that has actually changed. To address the above shortcomings, step S2 uses a difference detection algorithm to locate state difference data in the playlist. The algorithm formula 2 – State Difference Calculation: StateDiff = {s∈S|Hash(slocal)≠Hash(sremote)}, where S represents the complete set of states, such as each song in the playlist, playback position, volume, etc., and slocal and sremote represent the local and remote states, respectively. The Hash() function calculates the state item value, generating a fixed-length, unique hash value. This formula means that the state difference StateDiff is the set of state items s whose local and remote hash values are different. The specific implementation steps are as follows: The specific implementation is StateDiffCalculator, which is responsible for calculating the difference between the local state and the remote state, and creates a StateDifference object to store the detected differences.
[0030] The specific implementation uses the SHA-256 hash algorithm: Playlist difference detection: Calculate the hash values of the local and remote states using the hash comparison method: calculateListHash; If the hash values corresponding to the local and remote playlists differ, the `compareAudioLists` function is called to retrieve the state difference data, which is then added to the `StateDifference` object. The `StateDifference` object includes data related to newly added songs, changed playback positions, and audio changes. If the two hash values are different, it indicates that the playlist content has changed. In this case, `compareAudioLists` is called to identify which songs were added, deleted, or moved, and these differences are added to the `StateDifference` object. Here, hash values are compared, rather than the entire list content, making the system more efficient.
[0031] Playback position difference detection: The system detects changes in playback position by comparing values to a threshold. When the change in the current playback position reaches or exceeds a preset threshold, a synchronization operation is performed on the state difference data. For the playback position `playPosition`, it doesn't use a hash value but directly compares the local and remote values. Since the playback position is a floating-point number, there may be slight precision differences. Therefore, the threshold `Math.abs(local.playPosition-remote.playPosition)>0.1` is used to determine if a change truly warrants synchronization, such as a user manually jumping to a new position instead of a normal, minor progress bar movement. The final returned `StateDifference` object only contains the truly changed parts, such as newly added songs or changed playback positions, not the entire state. For example, if a user adds three new songs to the playback queue on their phone, and the system detects that the hash value of the playlist changes from "abc123" to "def456", it only synchronizes the information for these three newly added songs, instead of the entire playback queue, reducing data transmission by 85%. By synchronizing only the changed data, the amount of data that needs to be transmitted is significantly reduced (85% reduction in the example). This applies to various status changes such as playlist changes and playback position updates.
[0032] The playback queue integrity preservation mechanism based on multi-dimensional state vectors in step S1, which captures the playback state in real time, further includes: Based on an intelligent state prediction algorithm, the future playback state is predicted, and the state of the previous playback position is automatically preloaded. The calculation formula is as follows: StatePrediction(t+Δt)=α×HistoryPattern(t)+β×UserBehavior(t)+γ×DeviceContext(t)+δ×TimeOfDay(t), Where t is the starting time of the prediction, StatePrediction(t+Δt): predicts the playback state Δt time from now, HistoryPattern(t): prediction weights (0-1) based on historical playback patterns, UserBehavior(t): the current user behavior feature vector including click frequency, pause habits, etc., DeviceContext(t): device environment context such as network status, battery level, etc., TimeOfDay(t): time factor, considering the user's playback preferences at different times, and α, β, γ, and δ are all weight coefficients, satisfying α+β+γ+δ=1. For example, a user usually plays light music during their commute at 8 am. The system predicts that it will cache the relevant playlist in advance at 7:55 am. When it detects that the user picks up their phone and their location changes, the algorithm predicts that the user is about to start playing and automatically preloads the state of the last playback position. The above solution reduces state synchronization latency by 60-80%, achieving a "zero-wait" playback experience, reducing the load on cloud servers, reducing real-time computing requirements through prediction, and improving the completeness of state preparation in offline scenarios.
[0033] In one embodiment, step S2, which involves locating the status difference data in the playlist based on a difference detection algorithm and synchronously compressing it to the cloud, includes: To generate serialized difference data, the StateDifference object is first serialized into a byte array (originalData). Serialization is the process of converting an object into a format that can be stored or transmitted, such as binary. The LZ4 algorithm is used to compress serialized differential data; A compression header is added to the compressed data to ensure correct decompression and reconstruction. Finally, a complete byte array containing the header information is returned. The compressed data is placed in a ByteBuffer with 8 bytes of information appended to the beginning: the first 4 bytes represent the size of the original data, and the last 4 bytes represent the size of the compressed data. The compression header is added because the receiver needs to know the size of the original data to correctly reconstruct it during decompression. If only the compressed data is sent, the receiver cannot determine the expected decompression size.
[0034] This embodiment intelligently compresses the differential data using a hybrid compression algorithm: Algorithm Formula 3 - Compression Ratio Calculation: CompressionRatio = (OriginalSize - CompressedSize) / OriginalSize × 100%. This formula calculates the compression ratio, which is the percentage difference between the original data size and the compressed data size relative to the original size. A higher ratio indicates a better compression effect. By further compressing the data on top of already transmitting only the changed data, the amount of data actually sent to the network is further reduced. The LZ4 algorithm ensures that the compression process itself is not too slow. In actual testing, the overall effect is a 70-90% reduction in data transmission volume, with an average compression ratio exceeding 60%. This translates to lower data usage and faster synchronization speeds, especially advantageous in mobile network environments.
[0035] In another approach, step S2 employs an adaptive compression strategy optimization method, specifically including the following steps: Data Acquisition and Environment Detection: Acquire the data to be compressed and detect the current network environment type and data importance level; Dynamic weight allocation: Based on the network environment type and data importance level, dynamic values are assigned to the compression ratio weight η, compression speed weight μ, and data quality weight ν. Optimal compression strategy selection: CompressionStrategy=argmax(EfficiencyScore(k))=argmax(η×(1-CompRatio(k))+μ×SpeedFactor(k)+ν×QualityScore(k)); where CompressionStrategy is the optimal compression strategy selection, k is the type of compression algorithm such as LZ4, GZIP, Brotli, etc., EfficiencyScore(k) is the overall efficiency score of algorithm k, CompRatio(k) is the compression ratio (the smaller the better), SpeedFactor(k) is the compression speed factor (the larger the better), QualityScore(k) is the data integrity score (the larger the better), and η, μ, and ν are all weighting coefficients, representing the importance of compression ratio, speed, and quality, respectively.
[0036] The factors are calculated as follows: CompRatio(k) = ComppressedSize(k) / OriginalSize, where CompRatio(k) represents the compression ratio, ComppressedSize(k) represents the file size after compression using compression algorithm k, and OriginalSize is the original data size, i.e., the data size before compression; SpeedFactor(k) = BaseSpeed / CompressionTime(k), where SpeedFactor(k) represents the compression speed, BaseSpeed is the preset baseline speed (such as the theoretical maximum speed of single-threaded compression), and CompressionTime(k) is the actual compression time of algorithm k; QualityScore(k) = 1 - DataLoss(k), representing the data integrity score, and DataLoss(k) is the data loss rate after compression by algorithm k (such as lossy operations like color quantization and audio noise reduction). Strategy selection and execution: Select the compression algorithm with the largest EfficiencyScore(k) as the optimal strategy, and compress the data based on this strategy.
[0037] For example, when a user is detected in a mobile network environment, the algorithm automatically selects the Brotli algorithm with a higher compression ratio, such as η=0.6, μ=0.2, ν=0.2; in a WiFi environment, speed is prioritized, and the LZ4 algorithm is selected, such as η=0.3, μ=0.5, ν=0.2; for states containing important user preference data, the quality weight is increased, such as ν=0.4. In this way, the weights of η, μ, and ν are dynamically adjusted according to the network environment (mobile / WiFi) and the importance of data (normal / high priority), covering a multi-objective balance of efficiency, speed, and quality. Dynamic optimization based on the network environment improves data transmission efficiency by 25-40%, and compression speed is improved by 50% while ensuring data integrity. The adaptive algorithm reduces manual configuration, improves the system's intelligence level, supports optimal compression strategies in different scenarios, and covers the needs of all scenarios from mobile to desktop.
[0038] In one embodiment, the intelligent adaptation of playback parameters using a device feature recognition algorithm in step S3 includes: Based on device hardware information, user usage patterns, and network information, a device feature model is constructed to quantify the device's compatibility or adaptability to the playback task. Algorithm Formula 4 - Device Adaptability Calculation: DeviceCompatibility = α × HardwareScore + β × UsagePatternScore + γ × NetworkScore, where α, β, and γ are weighting coefficients, satisfying α + β + γ = 1. Specifically, HardwareScore evaluates the device's hardware capabilities, particularly audio-related aspects (such as processor speed, memory size, audio codec support, speaker / headphone quality, etc.). A higher score indicates better hardware. UsagePatternScore evaluates the user's usage patterns on the device. For example, whether the user frequently plays high-quality audio on this device, and what type of headphones / speakers they use. NetworkScore evaluates the device's network connection quality (such as Wi-Fi speed, mobile data signal strength, latency, etc.).
[0039] The specific steps for smart device adaptation and status recovery are as follows: The device's hardware information and user history are received through the createProfile method, and hardware score, usage pattern score and network score are calculated respectively. The final score representing the device's hardware capabilities is calculated using a weighted scoring model, and a DeviceProfile object is returned. The DeviceProfile object includes the device ID, compatibility score, and audio capability information.
[0040] For example, when a user switches from an iPhone to a MacBook, the system recognizes the target device's superior audio processing capabilities and automatically adjusts the equalizer setting from "Mobile Optimized" to "Desktop HiFi," lowering the volume from 70% to 45% to suit the different usage environment. Based on this increased compatibility, the system can make intelligent adjustments: switching the equalizer setting from mobile-optimized mode to one more suitable for a desktop hifi environment. Volume adjustment: iPhone speakers may require higher volumes to achieve sufficient loudness, while MacBook speakers may perform better at lower volumes. The system automatically lowers the volume from 70% to 45% to accommodate the new speaker characteristics, preventing sudden increases or decreases in volume and providing a more comfortable and natural listening experience.
[0041] In one embodiment, the most suitable recovery strategy is selected based on device characteristics and user behavior history: Algorithm Formula 5 - Recovery Strategy Weight Calculation: StrategyWeight = Σ(βi × ContextFactori) × UserPreferenceScore, where ContextFactori represents the contextual factors influencing the choice of recovery strategy. For example: ContinuityFactor: emphasizes the importance of restoring to the exact saved state (e.g., song, progress). AdaptationFactor: emphasizes the importance of adjusting the state according to the characteristics of the new device (e.g., sound effects, volume). PerformanceFactor: emphasizes the importance of recovery speed and system resource usage. βi: The weight associated with each contextual factor. UserPreferenceScore: The user's preference for a particular recovery strategy. For example, does the user value playback continuity more, or optimal sound quality on a new device? Σ(βi × ContextFactori): Calculates the weighted sum of all contextual factors. StrategyWeight: The final strategy weight or score, which is the product of the weighted sum of contextual factors and the user preference score.
[0042] The intelligent recovery strategy in step S3 includes: The selectStrategy method receives target device characteristics, saved playback status, and current user context, and calculates scores for different strategies. The strategies include scoring strategies related to continuity, adaptability, and performance optimization metrics. A weighted scoring model calculates a comprehensive score, and the optimal recovery strategy is selected based on this score. After switching devices and loading the saved playback state, playback is restored. A preset weight (e.g., 0.4, 0.35, 0.25 in this example) is used to calculate the total score, and the optimal recovery strategy (selectOptimalStrategy) is selected based on this total score. Through intelligent adaptation, the system avoids unpleasant experiences during device switching, such as sudden volume increases / decreases, mismatched sound effects (e.g., listening to settings saved on a mobile device using a desktop equalizer), and playback interruptions. This data- and algorithm-based intelligent decision-making significantly improves the consistency and adaptability of audio playback in multi-device environments. The intelligent adaptation mechanism ensures the best user experience when switching between different devices, avoiding issues such as sudden volume changes and mismatched sound effects. The accuracy of the strategy selection algorithm reaches over 92% in practical applications.
[0043] In one embodiment, in step S4, a multi-device state conflict detection mechanism detects multiple device state conflicts. When multiple devices simultaneously modify the playback queue, a conflict detection algorithm based on timestamps and device priorities is used. Algorithm Formula 6 - Collision Detection Function: ConflictDetection(S1,S2)={ TimeConflict:|T1-T2| <ThresholdTime∧DeviceId1≠DeviceId2 StateConflict:Hash(S1.state)≠Hash(S2.state)∧S1.version=S2.version In the context of TimeConflict, S1 and S2 are two state objects to be compared, typically containing the following attributes: state: state data (e.g., playback progress, playlist, etc.). T: timestamp (representing the time the state was generated). version: version number (used to detect if the states are the same version). DeviceId: device identifier (used to distinguish the source device). Meaning: Detects whether two states were generated by different devices within a short period, potentially causing overwrite issues. |T1-T2|: The timestamp difference (absolute value) between the two states. ThresholdTime: Time threshold (e.g., 100ms), representing the maximum allowed time difference. DeviceId1≠DeviceId2: Ensures conflicts originate from different devices (avoiding normal updates from the same device).
[0044] Example: If T1=10ms, T2=90ms, ThresholdTime=100ms, and the devices are different, then TimeConflict=true.
[0045] The meaning of StateConflict: It checks whether the data of two states are different, but the version numbers are the same, which may lead to inconsistency due to concurrent modifications. Hash(S1.state) ≠ Hash(S2.state): It compares whether the state data are different by hash value. S1.version = S2.version: The version numbers are the same, indicating that the states should theoretically be consistent. Example: If two states are both version v2, but the playback progress is different (different hash values), then StateConflict = true.
[0046] The detection logic is as follows: Time conflict: When two different devices modify the playback queue within a short period of time, less than a threshold such as 30 seconds, the system will consider that there may be a conflict.
[0047] State conflict: When two states have the same version number but their actual content differs when compared by hash value, the system considers a conflict to exist.
[0048] The `ConflictDetector` class encapsulates conflict detection logic. The `detectConflict` method takes two `QueueState` objects and compares them based on: whether the timestamp difference is less than a threshold, whether the device IDs are different, whether the state hashes are different, and whether the version numbers are the same. If the conditions are met, it is marked as a conflict.
[0049] The specific implementation steps include: When receiving a playback queue status update from another device, or after a local user completes the corresponding operation that caused the conflict, a conflict detection operation is triggered. The time conflict detection mechanism compares the timestamp and the device ID. If the triggering conditions are met, it is marked as a time conflict. The triggering conditions for time conflict detection include that the time difference between the operations of the two devices is less than a threshold and that the device IDs are different. The state conflict detection mechanism compares the version number and the state hash. If the conditions are met, it is marked as a state conflict. The triggering conditions for state conflict detection include two operations based on the same version and different state hash values.
[0050] For example, a user operates the playback queue on both a mobile phone and a computer simultaneously. The mobile phone adds song A at 15:30:20, and the computer deletes song B at 15:30:25. The system detects that the time difference is only 5 seconds and that the songs come from different devices, marking it as a potential conflict.
[0051] In one embodiment, step S4, which involves merging conflicts according to a three-way merging strategy to obtain the final merged playlist, includes: Three-way merge: Merging is based on a base state and two modified states (local and remote).
[0052] Playlist merging: Determine a baseline playlist and merge the local playlist and the remote playlist into the baseline playlist; Playback position selection: Compare local timestamps and remote timestamps, select the valid playback position with the latest timestamp, and merge the three lists using an improved merging algorithm (mergeAudioLists); User preference merging: Merge playlists according to user preferences and synchronize the playback status of the merged playlists.
[0053] An improved three-way merging algorithm is used to resolve state conflicts: Algorithm Formula 7 - Merging Priority Calculation Results: MergePriority = DeviceWeight × TimeWeight × UserActiveScore. This prioritizes changes to certain states, determining which should be retained first. The conflict resolution logic can be understood as follows: Conflict detected → Get base, local, and remote states → Call ThreeWayMerger.mergeStates → Merge playlists, playback positions, and user preferences internally → Return the merged state → Apply and synchronize this state. This process ensures that even if multiple devices modify the playback queue simultaneously, a relatively reasonable and consistent merge result is achieved, rather than simply overwriting changes made by one device. This conflict detection and resolution mechanism ensures data consistency and integrity in multi-device environments, achieving a 96% accuracy rate in conflict resolution and reducing user data loss to below 0.1%.
[0054] In one embodiment, in step S4, multiple device state conflicts are detected based on a multi-device state conflict detection mechanism. When multiple devices modify the playback queue simultaneously, a multi-device state conflict resolution step based on dynamic weight adaptation can also be adopted. The conflict detection and weight calculation formulas are as follows: OptimalWeight(i) = (BaseWeight(i) × TrustScore(i) × RecencyFactor(i)) / Σ(BaseWeight(j) × TrustScore(j) × RecencyFactor(j)) This calculates the optimal weight for each device. OptimalWeight(i) is the optimal weight of device i in conflict resolution, representing the proportion of the device's state in the final decision; BaseWeight(i) is the base weight of device i, which is determined by device type, performance, and user preferences; TrustScore(i) is the trust score for device i, which is dynamically updated based on the accuracy of historical operations. RecencyFactor(i) is the time factor, which characterizes the time value of its state. The calculation formula is e^(-λ×(t_current-t_i)), where λ is the time decay coefficient, t_current is the current timestamp, and t_i is the last operation timestamp of device i. For example, a user pauses music on their phone and resumes it on a smart speaker 30 seconds later, but the phone pauses 2 seconds later due to network latency. When calculating the weights: Speaker: BaseWeight=0.7 (high-performance device), TrustScore=0.95 (historically accurate), RecencyFactor= e−0.1×0=1e−0.1×0=1 → weight=0.7×0.95×1=0.665; Mobile phone: BaseWeight=0.3 (low performance), TrustScore=0.8 (occasional latency), RecencyFactor= e−0.1×30≈0.74e−0.1×30≈0.74 → weight=0.3×0.8×0.74=0.178; After normalization: Speaker weight = 0.75, mobile phone = 0.25 → adopt the speaker's "playback" state.
[0055] The algorithm adjusts the weight of the smart speaker to 0.75 based on its higher trust level (0.95) and updated timestamp, while reducing the weight of the mobile phone to 0.25, ultimately adopting the speaker's "playing" state. Based on the optimal weight allocation, the device state with the highest weight is selected as the final output. By comprehensively considering three dimensions—basic weight, trust level, and timeliness—the algorithm avoids misjudgments caused by a single factor. It iterative optimization based on historical operation accuracy strengthens the decision weight of highly trustworthy devices. An exponential decay function is used to accurately quantify the time value of device states, improving conflict resolution accuracy from 96% to 98.5%, reducing the need for manual user intervention, increasing intelligence by 40%, adapting to complex multi-device environments, and supporting dynamic device trust level adjustments.
[0056] The cross-device audio playback method in this embodiment also includes: In the event of network unavailability, the local state cache based on the LRU algorithm continues to store playback state, avoiding unlimited storage space consumption. The LRU-based local state cache ensures basic functionality even when the network is unavailable. Algorithm formula 8 - Cache weight calculation: CacheWeight = AccessFreq × RecencyScore × ImportanceScore, where: accessFreq: the number of times a device or playback queue is accessed (e.g., 40% weight); recencyScore: the time the state was last modified (e.g., 35% weight); importanceScore: the importance of the state, such as whether it contains user-favorited songs (25% weight). Cache strategy: If CacheWeight > CACHE_THRESHOLD, cache the state; otherwise, discard the state. LRU cache management uses LRUCache.<String,QueueState> Stores recently accessed playback states; when the cache reaches MAX_CACHE_SIZE=100, the least recently used data is automatically evicted. For example, if a user experiences network instability on the subway, the system automatically continues playback using the locally cached playback states, which include playback queue changes from the last 2 hours. When the network recovers, it is automatically synchronized to the cloud.
[0057] The cross-device audio playback method described in this embodiment also includes: When the network is restored, local offline changes and remote changes are obtained based on the incremental recovery mechanism. Local changes (getLocalChanges) record all playback status changes of the user during the offline period (offlineStartTime), such as song switching, playback position adjustment, etc. Remote changes (fetchRemoteChanges) retrieve all status changes after lastSyncTime from the server.
[0058] Incremental merging: Compare local offline change data with remote change data, merge the incremental data after comparison, such as if a song deleted locally is modified remotely, and generate the final recovered state; The merged playback state is applied to the player to ensure consistency between the playback queue and playback position. In this way, the offline caching mechanism guarantees the availability of basic functions in unstable network environments, and incremental recovery reduces the amount of data transmission during network recovery, improving the continuity of the user experience.
[0059] The cross-device audio playback method described in this embodiment further includes: optimizing playback state and synchronous operations based on an asynchronous processing mechanism. 1) Thread pool and task queue: A fixed-size thread pool (4 threads) is created using ExecutorService; BlockingQueue is used to buffer pending operations to avoid task backlog. 2) Asynchronous state saving: QueueState is received through the saveStateAsync method, encapsulated as StateOperation, placed in the queue, and processed asynchronously; a CompletableFuture is returned, allowing callers to chain the results. 3) Task processing logic: Tasks are retrieved from the queue through processOperation and executed, such as saving to local or synchronizing to the cloud; error handling: exceptions are caught and handleSaveError is called. The specific steps are as follows: Initialize AsyncStateManager, create a thread pool and queue, add operations to the queue when saveStateAsync is called, background threads retrieve operations from the queue, execute saving or synchronization logic, and the main thread obtains asynchronous results (such as success callbacks or error handling) through CompletableFuture. This asynchronous processing mechanism optimizes the performance of state saving and synchronization.
[0060] The cross-device audio playback method described in this embodiment further includes: establishing a key performance indicator monitoring system to evaluate the system status in real time through quantitative performance indicator formulas. Establishing a key performance indicator monitoring system: Algorithm Formula 9 - System Performance Scoring: PerformanceScore = w1 × ResponseTime + w2 × SyncAccuracy + w3 × ResourceUsage. The total score is calculated by weighting the following indicators, where w1, w2, and w3 are all weighting coefficients.
[0061] The calculation methods for each indicator are as follows: -ResponseTime=1 / (1+AverageResponseTimeMs / 1000), where ResponseTime measures the average time spent saving / synchronizing the state, and AverageResponseTimeMs is the average time spent on saving or synchronizing the state. -SyncAccuracy=SuccessfulSyncs / TotalSyncAttempts, Synchronization accuracy SyncAccuracy: The ratio of successful synchronizations to the total number of attempts, SuccessfulSyncs: The number of successful synchronizations, such as successful uploads and downloads; TotalSyncAttempts: The total number of synchronization attempts (including successes and failures). -ResourceUsage=1-(MemoryUsed+CPUUsed+NetworkUsed) / 3, ResourceUsage reflects the usage of memory, CPU, and network bandwidth. MemoryUsed: memory usage rate, CPUUsed: CPU usage rate, NetworkUsed: network bandwidth usage rate.
[0062] Specific implementation steps: During data collection, response time is calculated using `System.currentTimeMillis()`, the number of successful / failed synchronizations (`SuccessfulSyncs` / `TotalSyncAttempts`) is counted, memory usage is obtained using `Runtime.getRuntime().freeMemory()`, and CPU utilization is obtained using `OperatingSystemMXBean`. During score calculation, various metrics are calculated periodically (e.g., every minute), and the `PerformanceScore` is updated. When the `PerformanceScore` falls below a threshold (e.g., 0.8), an alarm is triggered, and performance data is recorded using a logging system (e.g., ELK). This asynchronous processing mechanism improves system response speed, reducing user operation response time by 60%. The performance monitoring system ensures system stability, achieving an availability of over 99.9%.
[0063] Through the implementation of the above six steps, this invention achieves complete cross-device storage and intelligent recovery of the audio playback queue. This solution not only solves the continuity problem of traditional playback applications in multi-device usage scenarios, but also provides users with a seamless cross-device audio playback experience through technological innovations such as intelligent adaptation, conflict resolution, and offline support. The entire technical solution has good scalability and compatibility, and can be applied to various audio playback application scenarios.
[0064] Second Embodiment Based on the same inventive concept, this embodiment provides a cross-device audio playback system based on cloud synchronization, including: The state acquisition module is used to capture the playback state in real time based on the playback queue integrity preservation mechanism of multi-dimensional state vector; The incremental synchronization module is used to locate status difference data in the playlist based on the difference detection algorithm and synchronously compress it to the cloud; The adaptation module is used to intelligently adapt playback parameters through device feature recognition algorithms and transmit the optimized cloud playback status to the new device according to the intelligent recovery strategy. The conflict resolution module is used to merge the conflicts based on a priority strategy when multiple device states are detected to obtain the final merged playlist, thereby enabling seamless continuous playback across devices. The principle is described in Implementation Example 1 and will not be repeated here.
[0065] Based on the same inventive concept, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the computer program, when executed by the processor, implements the steps of any of the above-described cross-device audio playback methods.
[0066] Based on the same inventive concept, this embodiment provides a computer-readable storage medium storing a computer program thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of any of the above-described cross-device audio playback methods.
[0067] The electronic device in this embodiment will be described in detail below from the perspective of hardware processing.
[0068] See Figure 2 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described cross-device audio playback method.
[0069] further, Figure 2 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0070] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 1The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0071] The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information in memory 101 and, in conjunction with its hardware, completes the method steps of the aforementioned embodiments.
[0072] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of a cross-device audio playback method.
[0073] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0074] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0075] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for cross-device audio playback, characterized in that, include: A playback queue integrity preservation mechanism based on multidimensional state vectors captures playback status in real time; wherein, the multidimensional state vector is a comprehensive playback queue status data structure, which includes an audio list, the index position of the currently playing audio in the list, the playback progress of the current audio, the playback mode, the volume level, the equalizer configuration, the user preference vector, the device context information, and the timestamp of the status update. The system uses a difference detection algorithm to locate state difference data in the playlist and synchronously compresses it to the cloud. This location includes: calculating the hash values of the local and remote states using a hash comparison method; if the hash values for the local and remote states are different, acquiring the state difference data and adding it to a StateDifference object; detecting changes in the playback position through threshold comparison, and performing a synchronization operation on the state difference data when the change in the current playback position reaches or exceeds a preset threshold; the StateDifference object includes newly added song lists, changed playback positions, and data related to audio changes. The playback parameters are intelligently adapted using a device feature recognition algorithm, and the optimized cloud playback status is transmitted to the new device according to an intelligent recovery strategy. The intelligent adaptation of playback parameters using the device feature recognition algorithm includes: constructing a device feature model based on device hardware information, user usage patterns, and network information to quantify the compatibility or adaptability of the device with the playback task; receiving device hardware information and user usage history, and calculating hardware scores, usage pattern scores, and network scores respectively; calculating a final score representing the device hardware capabilities using a weighted scoring model, and returning a DeviceProfile object, which includes the device ID, compatibility score, and audio capability information. When multiple device states conflict, a three-way merging method is used based on a priority strategy to merge the conflicting data to obtain the final merged playlist, thus enabling seamless continuous playback across devices. The three-way merging method based on the priority strategy to obtain the final merged playlist includes: determining a baseline playlist; merging the local playlist and the remote playlist into the baseline playlist; comparing the local timestamp and the remote timestamp and selecting the valid playback position with the latest timestamp; and merging the playlist according to user preferences and synchronizing the merged playback status.
2. The cross-device audio playback method according to claim 1, characterized in that, The playback queue integrity preservation mechanism based on multidimensional state vectors captures playback status in real time, including: Create a QueueState data structure that aggregates all information from the current playback queue; The completeness of playback status data is evaluated by using a weighted summation quantization formula for the state vector. The state change monitoring mechanism based on the observer pattern monitors changes in playback state in real time and automatically triggers a state saving operation when the playback state changes.
3. The cross-device audio playback method according to claim 1, characterized in that, The process of obtaining state difference data includes calling the compareAudioLists function to obtain state difference data.
4. The cross-device audio playback method according to claim 1, characterized in that, The step of locating and synchronously compressing status difference data in the playlist based on the difference detection algorithm to the cloud includes: The state difference data is serialized into a byte array to generate serialized difference data; The LZ4 algorithm is used to compress serialized differential data; Add compression header information to the compressed data to ensure that the data can be correctly decompressed and restored.
5. The cross-device audio playback method according to claim 1, characterized in that, The process of receiving the device's hardware information and the user's usage history to calculate the hardware score, usage pattern score, and network score includes: receiving the device's hardware information and the user's usage history through the createProfile method, and calculating the hardware score, usage pattern score, and network score respectively.
6. The cross-device audio playback method according to claim 1, characterized in that, The intelligent recovery strategy includes: The target device characteristics, saved playback status, and current user context are received through the selectStrategy method, and scores for different strategies are calculated respectively. The strategies include scoring strategies related to continuity, adaptability, and performance optimization indicators. A comprehensive score is calculated using a weighted scoring model. The optimal recovery strategy is selected based on the comprehensive score, and the playback status is restored after switching devices and loading the saved playback status.
7. The cross-device audio playback method according to claim 1, characterized in that, The multi-device state conflict detection mechanism detects multiple device state conflicts, including: When receiving a playback queue status update from another device, or after a local user completes the corresponding operation that caused the conflict, a conflict detection operation is triggered. The time conflict detection mechanism compares the timestamp and the device ID. If the triggering conditions are met, it is marked as a time conflict. The triggering conditions for time conflict detection include that the time difference between the operations of the two devices is less than a threshold and that the device IDs are different. The state conflict detection mechanism compares the version number and the state hash. If the conditions are met, it is marked as a state conflict. The triggering conditions for state conflict detection include two operations based on the same version and different state hash values.
8. The cross-device audio playback method according to claim 1, characterized in that, Also includes: In the event of network unavailability, the local state cache based on the LRU algorithm continues to execute the playback state.
9. The cross-device audio playback method according to claim 1, characterized in that, Also includes: In the event of network recovery, local offline change and remote change data are acquired based on an incremental recovery mechanism; Compare local offline change data with remote change data, and merge the incremental data after comparison; The merged playback status is applied to the player to ensure that the playback queue and playback position are consistent.
10. The cross-device audio playback method according to claim 1, characterized in that, Also includes: Optimize playback status and synchronous operation based on asynchronous processing mechanism.
11. The cross-device audio playback method according to claim 1, characterized in that, Also includes: Establish a key performance indicator monitoring system and evaluate the system status in real time through quantitative performance indicator formulas.
12. A cross-device audio playback system based on cloud synchronization, characterized in that, include: The status acquisition module is used to capture the playback status in real time based on the playback queue integrity preservation mechanism of the multi-dimensional status vector; wherein, the multi-dimensional status vector is a comprehensive playback queue status data structure, which includes an audio list, the index position of the currently playing audio in the list, the playback progress of the current audio, the playback mode, the volume level, the equalizer configuration, the user preference vector, the device context information, and the status update timestamp. An incremental synchronization module is used to locate state difference data in the playlist based on a difference detection algorithm and synchronously compress it to the cloud. Specifically, the incremental synchronization module calculates the hash values of the local and remote states using a hash comparison method. If the hash values corresponding to the local and remote states are different, the state difference data is obtained and added to a StateDifference object. The module detects changes in the playback position through threshold comparison. When the change in the current playback position reaches or exceeds a preset threshold, a synchronization operation is performed on the state difference data. The StateDifference object includes newly added song lists, changed playback positions, and data related to audio changes. The adaptation module is used to intelligently adapt playback parameters through device feature recognition algorithms and transmit the optimized cloud playback status to the new device according to the intelligent recovery strategy. Specifically, the adaptation module is used to construct a device feature model based on device hardware information, user usage patterns, and network information to quantify the compatibility or adaptability of the device with the playback task. It receives the device's hardware information and user usage history, calculates the hardware score, usage pattern score, and network score respectively, calculates the final score representing the device's hardware capabilities through a weighted scoring model, and returns a DeviceProfile object, which includes the device ID, compatibility score, and audio capability information. The conflict resolution module is used to merge conflicting playlists using a three-way merging method based on a priority strategy when multiple device states are detected to obtain the final merged playlist, thereby enabling seamless continuous playback across devices. Specifically, the conflict resolution module is used to determine a baseline playlist, merge the local playlist and the remote playlist into the baseline playlist, compare the local timestamp and the remote timestamp, select the valid playback position with the latest timestamp, and merge the playlists and synchronize the merged playback status according to user preferences.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the method steps of cross-device audio playback based on cloud synchronization as described in any one of claims 1-11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method steps of cross-device audio playback based on cloud synchronization as described in any one of claims 1-11.
Citation Information
Patent Citations
Management method for synchronous output of live broadcast pictures of multiple devices
CN118803290A
Synchronous playing system and method, and electronic device, storage medium and chip system
WO2025011215A1
