File previewing method and device, electronic equipment, storage medium and program product
By combining online preview and plugin preview within instant messaging sessions, the cumbersome file security process in existing technologies is solved, achieving convenience and efficiency in secure file preview.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2026-03-10
AI Technical Summary
Existing instant messaging applications have cumbersome file security processes that rely on third-party software for encryption and decryption, leading to inconvenience in operation.
It provides a secure file preview function based on instant messaging sessions, using a combination of online preview and plugin preview. The instant messaging application automatically encrypts the transmission and matches the preview mode to achieve secure file preview.
It simplifies the operation process for both the sender and receiver, ensures file security, and improves the convenience and security of file confidentiality.
Smart Images

Figure CN121644501A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of instant messaging application technology, specifically to a file preview method and apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] In instant messaging applications, to ensure file security, the sender typically encrypts the file content before sending it, and the recipient downloads it and decrypts it using a corresponding key, similar to document encryption. However, this approach relies on third-party software to provide encryption and decryption functions, requiring both the sender and receiver to manually encrypt and decrypt the file, making the file security process cumbersome. Therefore, there is an urgent need for a more convenient file security solution. Summary of the Invention
[0003] To address the aforementioned technical problems, embodiments of this application provide a file preview method, a file preview device, an electronic device, a computer-readable storage medium, and a computer program product. By providing a confidential file preview function based on instant messaging session messages, embodiments of this application not only ensure file security but also make the file confidentiality process more convenient.
[0004] One aspect of this application provides a file preview method, the method comprising: receiving a session file encrypted and transmitted by a sender through an instant messaging session; matching a preview mode corresponding to the session file; the preview mode including online preview or plugin preview, wherein the online preview indicates that the preview processing of the session file is implemented jointly by a server and a browser, and the plugin preview indicates that the preview processing of the session file is implemented through a locally configured preview plugin; and performing preview processing of the session file based on the matched preview mode.
[0005] In another exemplary embodiment, the preview mode is a plugin preview; the preview processing of the session file based on the matched preview mode includes: storing the session file locally; in response to a preview request corresponding to the session file, decrypting the session file through the preview plugin, and parsing the decrypted session file to obtain parsed file data; and rendering the parsed file data through the preview plugin to display the file content of the session file.
[0006] In another exemplary embodiment, the step of rendering the parsed file data through the preview plugin to display the file content of the session file includes: determining the rendering type corresponding to the session file, wherein the rendering type includes paginated rendering or chunked rendering; and rendering the parsed file data using a rendering mode that matches the rendering type to display the file content of the session file.
[0007] In another exemplary embodiment, the step of rendering the parsed file data using a rendering mode that matches the rendering type to display the file content of the session file includes: if the rendering type is paginated rendering, rendering the current screen interface is performed through the main thread, and rendering the file content of the session file is performed through the rendering thread; if the rendering type is chunked rendering, chunked file data is obtained from the parsed file data, and chunked file data corresponding to adjacent chunked file data are merged and rendered according to the block identifiers corresponding to different chunked file data.
[0008] In another exemplary embodiment, the steps of the rendering thread in rendering the file content of the session file include: obtaining page bitmap data and page text data from the parsed file data; creating a drawing layer based on the page bitmap data and creating a text layer based on the page text data; performing coordinate transformation on the text content contained in the text layer, and overlaying the transformed text layer on the drawing layer to display the file content of the session file.
[0009] In another exemplary embodiment, the preview mode is an online preview; the preview processing of the session file based on the matched preview mode includes: in response to the preview request corresponding to the session file, verifying the recipient's preview permission through the background server of the instant messaging application; obtaining the preview link returned by the background server after the preview permission verification is passed; and loading the preview link through a browser to display the file content of the session file.
[0010] In another exemplary embodiment, the session file includes a video file; the method further includes:
[0011] The backend server slices the video file to obtain multiple video slice files and generates a playlist corresponding to the multiple video slice files. The multiple video slice files and the playlist are then transmitted to the content delivery network server. Loading the preview link through the browser to display the content of the session file includes: requesting the content delivery network server to obtain each video slice file and playing each obtained video slice file.
[0012] In another exemplary embodiment, the plurality of video segment files and the playlist are transmitted to the content delivery network server in an encrypted manner; the step of requesting the content delivery network server to obtain each video segment file and playing each obtained video segment file includes: requesting the backend server to obtain encryption information corresponding to the video segment file; decrypting each video segment file obtained from the content delivery network server according to the obtained encryption information, and playing the decrypted video segment file.
[0013] In another exemplary embodiment, the method further includes: after receiving a confidential file message sent by the backend server, creating a webpage view container, the webpage view container being configured to preload offline resources contained in the session file based on preloaded links; the confidential file message being generated by the backend server after completing the offline processing of the session file's resources; and after receiving a preview request corresponding to the session file, displaying the offline resources contained in the session file according to the preloaded webpage view container.
[0014] In another exemplary embodiment, the step of displaying the offline resources contained in the session file according to the pre-loaded webpage view container after receiving the preview request corresponding to the session file includes: when the pre-loaded webpage view container is invoked, the preview permission of the recipient is re-verified; if the verification passes, the offline resources contained in the session file are displayed through the pre-loaded webpage view container.
[0015] In another exemplary embodiment, the method further includes: if it is detected that the created webpage view container has not completed preloading, then recreating the webpage view container and loading the offline resources contained in the session file through the recreated webpage view container to display the offline resources contained in the session file.
[0016] In another exemplary embodiment, matching the preview mode corresponding to the session file includes: determining the file size of the session file; if the file size is lower than a preset threshold, determining that the preview mode matching the session file is a plugin preview; if the file size is higher than the preset threshold, determining that the preview mode matching the session file is an online preview.
[0017] In another aspect of this application, a file preview device is provided, comprising: a receiving module configured to receive a session file encrypted and transmitted by a sender via an instant messaging session; a matching module configured to match a preview mode corresponding to the session file; the preview mode includes online preview or plugin preview, wherein online preview indicates that the preview processing of the session file is implemented jointly by a server and a browser, and plugin preview indicates that the preview processing of the session file is implemented through a locally configured preview plugin; and a preview module configured to perform preview processing of the session file based on the matched preview mode.
[0018] Another aspect of this application provides an electronic device, including: one or more processors; and a memory for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the file preview method or video processing method as described above.
[0019] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of an electronic device, causes the electronic device to perform the file preview method as described above.
[0020] Another aspect of this application provides a computer program product, including a computer program that, when executed by a processor of an electronic device, implements the file preview method described above.
[0021] The technical solution provided by the embodiments of this application offers a confidential file preview function based on instant messaging session messages, without relying on third-party software for file encryption and decryption, thus simplifying the operation process for both the sender and receiver. Specifically, the session file sent by the sender through the instant messaging session is automatically encrypted and transmitted to the receiver by the instant messaging application. The receiver's preview of the confidential file is also automatically executed by the instant messaging application after matching the corresponding preview mode. This not only ensures file security but also eliminates the need for manual operation by the sender and receiver, making the file confidentiality process more convenient.
[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of an exemplary implementation environment related to this application;
[0024] Figure 2 This is a flowchart illustrating a file preview method as shown in an exemplary embodiment of this application;
[0025] Figure 3 The flowchart illustrates the preview process of session files based on the preview mode of the plugin preview;
[0026] Figure 4 The flowchart illustrates the preview processing of session files based on the online preview mode;
[0027] Figure 5 A schematic diagram illustrating the structure of an exemplary preview plugin is shown;
[0028] Figure 6 This diagram illustrates thread rendering in paginated rendering mode.
[0029] Figure 7 This diagram illustrates the rendering process of the rendering thread executing the file content of the session file;
[0030] Figure 8 This is a flowchart illustrating a file preview method as shown in another exemplary embodiment of this application;
[0031] Figure 9 The flowchart illustrating the process of container preheating and reuse implemented by the session message receiving terminal is shown.
[0032] Figure 10 This is a flowchart illustrating a file preview method, which is yet another exemplary embodiment of this application.
[0033] Figure 11 The flowchart illustrates the process of performing online preview processing on a video file;
[0034] Figure 12 This is a flowchart illustrating a file preview method, which is yet another exemplary embodiment of this application.
[0035] Figure 13 This is a block diagram illustrating a file preview device in an exemplary embodiment of this application;
[0036] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0037] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0038] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0039] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0040] In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0041] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0042] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0043] Please refer to the following first. Figure 1 , Figure 1This is a schematic diagram of an exemplary implementation environment related to this application. The implementation environment specifically illustrates an instant messaging application scenario, including a first terminal 110, a second terminal 120, and a server 130. A wired or wireless communication connection can be pre-established between the first terminal 110 and the second terminal 120, and the first terminal 110 and the second terminal 120 can also establish wired or wireless communication connections with the server 130, respectively.
[0044] The first terminal 110 and the second terminal 120 each run an instant messaging application. User A can send instant messaging messages to the second terminal 120 through the instant messaging application running on the first terminal 110, and user B can also send instant messaging messages to the first terminal 110 through the instant messaging application running on the second terminal 120. The instant messaging messages transmitted between the first terminal 110 and the second terminal 120 can be text, images, documents, tables, audio, video, etc., and there are no restrictions on the message type.
[0045] The instant messaging applications running on the first terminal 110 and the second terminal 120 can rely on the data services provided by the server 130 to realize their related application functions. For example, when the second terminal 120 receives a document transmitted by the first terminal 110, and user B needs to view the specific content of the document, the second terminal 120 uses the document parsing service provided by the server 130 to obtain the parsed document data and renders the parsed document data to achieve online preview of the document. As another example, if user B wants to forward a document sent by user A to user C so that user C can preview the document through another application (such as email) different from the instant messaging application, the second terminal 120 needs to transmit the document to the terminal used by user C through the server 130.
[0046] It should be noted that the first terminal 110 and the second terminal 120 can be devices such as computers, smartphones, tablets, laptops, and smart home appliances, without limitation. The server 130 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services and CDN (Content Delivery Network), without limitation. Furthermore, in practical application scenarios, the number of servers 130 can be one or more, and different servers 130 can be used to provide different types of data services, such as a server 130 providing instant messaging backend services, a server 130 providing video CDN services, etc., without limitation.
[0047] In instant messaging applications, to ensure file security, existing technologies typically involve the sender encrypting the file content before sending it, and the receiver downloading it and then decrypting it using a corresponding key, similar to document encryption. For ease of understanding, let's take... Figure 1 To illustrate the implementation environment, third-party software needs to be running on the first terminal 110 and the second terminal 120. User A needs to manually encrypt the file using the third-party software and then send the encrypted file to the second terminal 120. User B needs to manually decrypt the encrypted file using the third-party software before he / she can preview the file content on the second terminal 120.
[0048] Therefore, it can be seen that the existing technology relies on third-party software to provide encryption and decryption functions. The sender needs to manually encrypt the file, and the receiver also needs to manually decrypt the file, which makes the process of keeping the file confidential quite cumbersome.
[0049] To address this technical problem, embodiments of this application provide a file preview method, a file preview device, an electronic device, a computer-readable storage medium, and a computer program product. Embodiments of this application provide a confidential file preview function based on instant messaging session messages, without relying on third-party software for file encryption and decryption. This not only ensures file security but also makes the file confidentiality process more convenient.
[0050] The embodiments of this application will be described in detail below.
[0051] Please see Figure 2 , Figure 2 This is a flowchart illustrating a file preview method in an exemplary embodiment of this application. The method is specifically executed by a session message receiving terminal with an instant messaging application installed; that is, the method is specifically executed by the session message receiving terminal. This method can be applied to... Figure 1 In the illustrated implementation environment, for example, when user A sends a session message to user B, the second terminal 120 acts as the receiving terminal for the session message and executes the method to preview the confidential file. Alternatively, when user B sends a session message to user A, the first terminal 110 acts as the receiving terminal for the session message and executes the method to preview the confidential file.
[0052] like Figure 2 As shown, in an exemplary embodiment, the file preview method includes steps S210-S230, which are described in detail below:
[0053] S210, Receive a session file transmitted encrypted by the sender via an instant messaging session.
[0054] First, it should be noted that the instant messaging session mentioned in this embodiment refers to the process of real-time data exchange between two or more users through an instant messaging application, also known as instant conversation communication. Instant messaging sessions can include various forms of data exchange such as text, images, documents, spreadsheets, audio, and video, aiming to achieve fast and convenient information transmission and communication between users.
[0055] Encrypted transmission of session files via instant messaging means that the sender, using an instant messaging application running on their terminal, sends a file to the recipient. The file is then encrypted according to a preset encryption policy and transmitted to the recipient's terminal, which also runs an instant messaging application. Therefore, the session file received by the receiving terminal is encrypted, ensuring file security even if it is intercepted or stolen, preventing content leakage.
[0056] The instant messaging application supports the transmission of file formats including, but not limited to, office files, video files, audio files, and image files. Office files include, but are not limited to, formats such as doc / pdf / ppt / xls; video files include, but are not limited to, formats such as mp4 / avi / rmvb; audio files include, but are not limited to, formats such as mp3 / aac / wav; and image files include, but are not limited to, formats such as png / jpeg / gif / bmp. There are no restrictions on the file formats supported by the instant messaging application.
[0057] In some exemplary embodiments, the sender or administrator may pre-set the file types that require encrypted transmission, so that the sender only needs to encrypt the file when sending it to the receiver. It is understood that an administrator typically refers to a terminal that plays a management role within an organization; for example, an administrator could be a corporate administrator or a group administrator. There is no restriction on the specific type of organization to which the administrator belongs.
[0058] S220 matches the preview mode corresponding to the session file, which includes online preview or plugin preview.
[0059] The technical solution provided in this embodiment is to implement a preview function for confidential documents by combining online preview and plugin preview on the basis of instant messaging session messages. The combination of online preview and plugin preview means that the session message receiving terminal supports both online preview and plugin preview methods, and can choose which method to use to preview the received session file according to actual application needs.
[0060] Online preview can be understood as the process where the message receiving terminal needs to work with the server and browser to preview the session file. The server is typically used to authenticate preview requests. After successful authentication, the server decrypts the session file, parses and converts it into a format that the browser can directly render, and then sends it to the WebView of the instant messaging application for display.
[0061] In online preview mode, recipients can preview encrypted files without leaving the instant messaging application environment, ensuring a better user experience. Furthermore, since all file processing is completed on the server side, the risk of data leakage is reduced, and file security is improved. However, because online preview mode requires retrieving file content from the server, asynchronous requests may take a long time. Additionally, a large number of concurrent message receiving terminals accessing the server can put significant pressure on the server, leading to performance issues and impacting the overall performance of the instant messaging application.
[0062] The plugin preview method can be understood as follows: the session message receiving terminal uses a locally configured preview plugin to preview session files. The preview plugin includes a front-end module and a lower-level module. The front-end module is responsible for user interaction, such as providing file selection and preview interface functions, while the lower-level module is responsible for local file encryption / decryption and file parsing.
[0063] In plugin preview mode, session files are parsed and rendered locally, reducing the risks associated with file transmission over the network and thus offering higher file security. However, precisely because it doesn't require retrieving file content from the server, plugin preview mode may experience performance issues when processing larger files.
[0064] Therefore, based on the advantages and disadvantages of online preview and plugin preview as listed above, in actual application scenarios, the specific preview mode to be used to perform preview processing on the received session file can be selected according to actual application needs, such as performance requirements, security requirements, user habits, etc., making the file preview solution provided in this embodiment highly flexible.
[0065] For example, in some exemplary embodiments, the preview mode matching the session file can be determined by determining the file size of the session file. If the file size of the session file is lower than a preset threshold, the preview mode matching the session file is determined to be a plug-in preview. If the file size of the session file is higher than the preset threshold, the preview mode matching the session file is determined to be an online preview. The preset threshold can be used to represent the file size threshold corresponding to the performance boundary between the two preview modes, online preview and plug-in preview. The preset threshold can be, for example, 20M (megabytes) or other values, which are not limited here.
[0066] The session file size can be understood as the storage space or storage capacity required by the session file. When the session file size is below a preset threshold, it's considered a "smaller file." In this case, local parsing using the plugin preview mode performs better. Compared to asynchronous requests for file content in online preview, plugin preview mode is more efficient, and local parsing ensures higher file security. Therefore, plugin preview is chosen as the appropriate preview mode for the session file. Conversely, when the session file size is below the preset threshold, it's considered a "larger file." Local parsing using the preview plugin performs worse, while online preview mode provides a better preview effect. Therefore, online plugin preview is chosen as the appropriate preview mode for the session file.
[0067] In other exemplary embodiments, the preview mode matching the session file can also be determined based on the security level of the session file. For example, if the session file has a high security level, since the plugin preview performs file parsing and rendering locally, the file confidentiality is higher; therefore, the plugin preview is selected as the preview mode matching the session file. If the session file has a low security level, then the online preview is selected as the preview mode matching the session file. It should be noted that since the session file is an encrypted file received through an instant messaging session, regardless of which preview mode is selected as the preview mode matching the session file, a certain degree of file security can be guaranteed.
[0068] S230, performs preview processing of session files based on the preview mode obtained from the matching.
[0069] Because the session file is an encrypted file transmitted via instant messaging, it avoids the risks associated with instant messaging messages during network transmission. Therefore, regardless of the preview mode chosen to match the session file, file security can be guaranteed to a certain extent. Furthermore, if the online preview mode is selected, the decryption and parsing of the session file are completed on the server side, further reducing the risk of data leakage and thus providing high file security. If the plugin preview mode is selected, file parsing is performed locally, reducing the risks during network transmission and resulting in even higher file security.
[0070] Therefore, the technical solution provided in this embodiment offers a confidential file preview function based on instant messaging session messages, without relying on third-party software for file encryption and decryption, thus simplifying the operation process for both the sender and receiver. The session file sent by the sender through the instant messaging session is automatically encrypted and transmitted to the receiver by the instant messaging application. The receiver's preview of the confidential file is also automatically executed by the instant messaging application after matching the appropriate preview mode. This not only ensures file security but also eliminates the need for manual operation by the sender and receiver, making the file confidentiality process more convenient and providing a high level of file security.
[0071] Please continue reading. Figure 3 and Figure 4 , Figure 3 The flowchart illustrates the preview process for session files based on the plugin preview preview mode. Figure 4 The flowchart illustrates the preview process of session files based on the online preview mode.
[0072] Please refer to the following first. Figure 3 The preview mode based on plugin preview for previewing session files includes:
[0073] S310, local storage of session files;
[0074] S320, in response to the preview request corresponding to the session file, decrypts the session file through the preview plugin, and parses the decrypted session file to obtain the parsed file data;
[0075] The S330 uses a preview plugin to render the parsed file data to display the content of the session file.
[0076] Before describing the detailed process of previewing session files based on the plugin preview mode, it is necessary to provide an illustrative overview of the preview plugin's structure. For example... Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an exemplary preview plugin, named "XFile", which includes a front-end module 510 and a bottom-end module 520.
[0077] Frontend module 510 can be understood as the plugin UI (User Interface) rendering framework, primarily responsible for user interaction, such as providing file selection and preview interfaces. Frontend module 510 mainly includes a plugin renderer (XFileViewer), which comprises a page renderer (PageViewer) and rendering threads (WebWorkers). The page renderer handles page viewing, display, and scrolling functions, including modules such as canvas (for drawing graphics), textLayer (for text information), and toolbar. The rendering threads handle other rendering functions, such as pre-rendering. Frontend module 510 also handles functions related to permissions, watermarking, UI encapsulation, task scheduling, chunked rendering, cache management, packaging, and log reporting, among others. The underlying module 520 can be understood as the document parsing kernel, responsible for local file encryption / decryption and file parsing. Frontend module 510 and underlying module 520 can communicate via Node.js plugins, and underlying module 520 can be adapted to different upper-level languages via C++ plugins.
[0078] based on Figure 5 The example preview plugin structure shows that the preview plugin performs parsing and rendering on a local file to achieve file preview. Therefore, in S310, the session message receiving terminal needs to store the received session file locally. In S320, when the user triggers a preview request for the corresponding session file by clicking on a file on the user interface, the session message receiving terminal decrypts the session file through the preview plugin and parses the decrypted session file to obtain the parsed file data. It can be seen that the plugin preview method performs file decryption and parsing locally on the session message receiving terminal. In S330, the preview plugin renders the parsed file data, thus displaying the content of the session file on the user interface. If... Figure 5 The example preview plugin structure is used as an illustration. After detecting that the user has clicked on a session file, the front-end module 510 calls the underlying module 520 to decrypt and parse the session file. The parsed file data is then directly rendered and displayed by the front-end module 510. This reduces the risk of file data transmission over the network, making the file data highly secure.
[0079] In some exemplary embodiments, the preview plugin can adopt different rendering modes for different types of files, mainly including paginated rendering mode and chunked rendering mode. For example, paginated rendering mode is used for files in formats such as ppt / pdf / doc / docx, while chunked rendering mode is used for files that can scroll infinitely, such as xlsx / xls. Therefore, in S330, the rendering type corresponding to the session file can be further determined, including paginated rendering or chunked rendering, and the parsed file data can be rendered using a rendering mode that matches the rendering type to display the file content of the session file.
[0080] If the rendering type is paginated rendering, the rendering of the current screen interface can be handled by the main thread (UI thread), while the rendering of the session file content can be handled by the rendering threads (Web Workers). The rendering threads allow the application to run scripts without freezing the user interface. The rendering threads can perform complex calculations without interfering with or blocking page rendering and user interaction. Therefore, the rendering threads run on a different thread than the main thread, thus achieving asynchronous processing. See also... Figure 6 , Figure 6 The diagram illustrates the thread rendering in pagination rendering mode. Since the main thread is only responsible for rendering the current screen interface, it can achieve instant page opening for the first screen, page turning, and fast scrolling, thus ensuring a good user preview experience.
[0081] For example, during the rendering process, the underlying module of the preview plugin transmits the buffered data of the parsed bitmap and the text information of the current page to the front-end module. See also... Figure 7 , Figure 7 This diagram illustrates the rendering process of the session file's content. The rendering thread retrieves page bitmap data and page text data from the interpreted file data transmitted from the underlying module. It then creates a drawing layer based on the bitmap data and a text layer based on the text data. The text content within the text layer undergoes coordinate transformation, and the transformed text layer is then overlaid on the drawing layer to display the session file's content. In essence, within the rendering thread, the view consists of a drawing layer and a text layer, with the text layer overlaying the drawing layer. Text alignment and copying are achieved by calculating and transforming coordinates to define offsets and scaling.
[0082] If the rendering type is chunked rendering, chunked file data can be obtained from the parsed file data. Based on the block identifiers corresponding to different chunked file data, the chunked file data corresponding to adjacent blocks is merged and rendered, thus revealing the session content of the session file. For example, the front-end module can divide the view into multiple blocks according to a preset block size and number them. The underlying module parses the file by block to obtain the chunked file data corresponding to each block of the session file, and each chunked file data corresponds to a different block identifier. The front-end module merges and renders adjacent blocks, thus achieving partial rendering of infinitely scrolling files, ensuring that rendering performance and memory usage remain within a suitable range. Furthermore, this method can also be used for pre-rendering during scrolling rendering, achieving a near-instantaneous opening effect during fast scrolling.
[0083] Please continue reading. Figure 4 Previewing session files using the online preview mode includes:
[0084] S410, in response to a preview request for a session file, verifies the recipient's preview permissions through the background server of the instant messaging application.
[0085] S420: Obtain the preview link returned by the backend server after the preview permission verification is passed;
[0086] The S430 loads a preview link via a browser to display the content of the session file.
[0087] In online preview mode, the instant messaging application directly loads and displays encrypted files through a built-in web view component. The background server of the instant messaging application authenticates the file preview request triggered by the user. After successful authentication, it parses the encrypted file and converts it into a format that the browser can directly render, such as HTML, PDF, or images, and then sends it to the web view component for rendering to display the file content of the session file.
[0088] In S410, the session message receiving terminal responds to a preview request corresponding to a session file by verifying the recipient's preview permissions through the instant messaging application's backend server. The sender or administrator can pre-configure preview permissions for session files, allowing the backend server to verify the recipient's preview permissions based on pre-configured permission management information. For example, the administrator can configure features such as enabling file confidentiality, the visibility scope of confidential files, and the effective scenarios for file confidentiality for some or all users within their organization. Preview permission verification based on the backend server further ensures the security of session files.
[0089] In S420, the preview link is returned by the backend server after verifying the recipient's preview permissions. The preview link is used to map the file data parsed by the backend server. Therefore, in S430, the browser can load the preview link to display the file content of the session file. In some exemplary embodiments, the preview link returned by the backend server also carries a verification token. The verification token serves as proof that the recipient has file preview permissions and has an expiration date. When loading the preview link, the browser can verify whether the verification token carried in the preview link is valid. The preview link is only loaded if the verification token is valid, to further ensure file security.
[0090] In some exemplary embodiments, such as in email sharing scenarios, the recipient can share the session file to an external browser for preview after receiving it. To ensure file security, the file preview method further includes: generating a sharing link corresponding to the session file in response to a sharing request, and sharing the file via the sharing link.
[0091] It should be noted that the sharing link corresponding to the session file is a fixed file link. A fixed file link can be understood as mapping to a unified file opening function page, such as a user login page based on an instant messaging application, which may include, but is not limited to, a QR code login page, an account password input page, etc. For the recipient of the sharing link, by accessing the sharing link, they are redirected to the user login page. After successfully logging in on the user login page, they can preview the file content. The detailed process of previewing can be found in the description of the aforementioned embodiments, and will not be repeated here.
[0092] The shared link can also carry a verification token corresponding to the session file. After the recipient's backend server successfully verifies the user's identity, it further verifies the validity period of the verification token. If the verification token is still valid, the file content will be previewed, thus ensuring file security in file sharing scenarios.
[0093] In other exemplary embodiments, such as Figure 8 As shown, in online preview mode, file preview methods also include:
[0094] S810, after receiving the confidential file message sent by the backend server, creates a web page view container. This web page view container is configured to preload the offline resources contained in the session file based on the preloaded links. The confidential file message is generated by the backend server after it has completed the offline processing of the session file resources.
[0095] After receiving a preview request for a session file, the S820 displays the offline resources contained in the session file based on the pre-loaded webpage view container.
[0096] It is understood that in this embodiment, after the session message receiving terminal receives the confidential file message sent by the backend server, a web page view container is created to preload the offline resources of the session file, so as to warm up the web page view container. When the user clicks to preview the session file, the preview request corresponding to the session file is triggered, and the preheated web page view container can be directly invoked to display the offline resources on the screen, thereby improving the online preview speed. Especially in the scenario of previewing the same file again, the page can open instantly, thus improving the user preview experience to a certain extent.
[0097] The backend server sends a confidential file message to the session message receiving terminal after detecting that the receiving terminal has received the session file transmitted by the sender. This confidential file message is generated by the backend server after the session file's resources have been processed offline. The backend server's offline processing of session file resources can be understood as the backend server using a pre-configured offline processing program to store some file resources from the session file as offline packages. These partial file resources refer to file resources that can be preloaded using page view containers, such as document covers and the first screen.
[0098] The backend server can perform offline processing on the session file after the sender sends it, thereby obtaining the corresponding offline packet. Alternatively, the backend server can perform offline processing on the session file upon first obtaining it. For example, in a file forwarding scenario, the backend server has already performed offline processing when the session file is first sent, so it does not repeat the offline processing during file forwarding, thus saving computing and storage resources. This embodiment does not limit the timing of the backend server performing offline processing on the session file.
[0099] To better understand the offline resource preloading process mentioned above, please refer to... Figure 9 , Figure 9 The flowchart illustrating the container preheating and reuse process in the session message receiving terminal is shown. Figure 9As shown, after receiving a confidential file message from the backend server, the client running on the session message receiving terminal first checks if the offline package has been matched, i.e., whether the received session file has been processed for offline use. If so, the client retrieves the offline package resources and configuration data of the session file from the offline module, which then returns a preload link and code package. Next, the client requests the page view component to create a page view container and passes the preload link to the page view component, enabling the page view container to load the preload link and obtain an empty page loaded by the browser based on the data returned by the preload link. The page view container further uses the file identifier (fileid) corresponding to the session file to request business data from the browser. This business data may contain offline package resources of the session file, as well as styles, scripts, and other resources; no restrictions are placed on this. After obtaining the business data returned by the browser, the page view container caches the business data in local storage, thus completing the preloading of the offline resources of the session file.
[0100] Continue reading Figure 9 After the page view container has finished preloading, if a user clicks on a session file in the client, triggering a preview request for the corresponding session file, the client calls a specified interface to request a preheating link from the backend server. This preheating link is used to confirm that the preloaded page view container has been completed. The client passes the obtained preheating link to the offline package SDK (Software Development Kit). The offline package SDK determines whether the offline package of the session resource has finished preheating. If so, the client passes the preheating link to the page view component. This allows the page view component to determine the existence of a preloaded page view container corresponding to the session file, and then switch routes to display the offline resources of the session file through this page view container. If the offline package SDK determines that the offline package of the session resource has not finished preheating, it recreates the page view container and loads the offline resources contained in the session file through the newly created page view container to display the offline resources.
[0101] In another exemplary embodiment, considering that the offline resource preloading process mentioned above may have security issues in certain extreme cases, such as the recipient having permission to preheat and render the offline preheating page normally, but the administrator or sender changing the file preview permissions to invisible within the interval before opening the file, displaying the offline preheating page in this case would obviously not meet the application requirements. Therefore, when the preloaded webpage view container is invoked, the recipient's preview permissions can be re-verified. If the verification passes, the offline resources contained in the session file are displayed through the preloaded webpage view container to ensure file security.
[0102] In another exemplary embodiment, considering that in a scenario where the session file is a video file, playback of the video file is typically performed by a video player playing the entire video file. To improve the security of video file previews, such as... Figure 10 As shown, file preview methods may also include:
[0103] S1010 processes video files into segments through a backend server, resulting in multiple video segment files. It then generates playlists corresponding to these video segment files and transmits them to the content delivery network server.
[0104] S1020: Request each video segment file from the content delivery network server and play the obtained video segment files.
[0105] In this embodiment, the backend server can use a transcoder such as FFmpeg to slice the video file, thereby obtaining multiple video slice files. The transcoder can be deployed on the backend server or on a dedicated video transcoding server; there is no restriction on this.
[0106] In some exemplary embodiments, each video segment file can be transcoded into multiple transcoded files with different bitrates to achieve pre-transcoding of each video segment file. It is understood that pre-transcoding refers to the transcoding process completed before the video is requested for playback by the user. Its purpose is to convert the video in advance to formats suitable for different devices, network environments, and playback requirements, so as to enable a fast response when the user requests the video, improving playback smoothness and compatibility.
[0107] In other exemplary embodiments, each video slice file can be transcoded to obtain a transcoded file with a specific bitrate. The transcoded video slice files can have the same bitrate or different bitrates. For example, considering that users may focus more on specific video positions during preview, such as the beginning and end of the video, the bitrate of video slices related to the beginning and end of the video can be higher, while the bitrate of other video slices can be lower. Other strategies can also be used to determine the bitrate of the multiple video slice files, such as the higher bitrate video slices and the lower bitrate video slices being periodically distributed in time, or the bitrate of the multiple video slice files gradually decreasing in time, etc., without limitation.
[0108] After obtaining multiple video segment files, the backend server generates corresponding playlists, such as M3U8 (Media Playlist), and transmits the video segment files and playlists to the Content Delivery Network (CDN) server. Alternatively, the backend server can slice the video files using a video transcoding server, or the transcoding server can directly transmit the multiple video segment files and playlists to the CDN server. The server then requests and plays each video segment file from the CDN server. Therefore, this embodiment, by slicing the video file from a large file into multiple video segments, minimizes the impact of video segment leakage on the security of the video file, thus effectively improving the security of the video file.
[0109] In another exemplary embodiment, to further enhance the security of the video files, multiple video segment files and the playlist are transmitted to the CDN server in encrypted form. When the session message receiving terminal requests playback of each video segment file from the CDN server, it can first request the encryption information corresponding to the video segment file from the backend server. Then, based on the obtained encryption information, it decrypts each video segment file obtained from the CDN server before playing the decrypted video segment file. The encryption information corresponding to the video segment file can be, for example, encryption method, key, etc., and is not limited here.
[0110] Please see Figure 11 , Figure 11 The flowchart illustrates the online preview process for video files. After obtaining the session file, the backend server notifies the video transcoding service to perform video transcoding. The video transcoding service can be deployed on the backend server or a dedicated video transcoding server; this is not a restriction. The video transcoding process includes: first, slicing the video file to obtain multiple video slice files; then, generating a playlist; and finally, uploading the multiple video slice files and the playlist to the CDN server. When the client detects a user-triggered video file preview request, the client invokes the page view component, opens the video player, and the video player plays the video file.
[0111] A video player can play video files through the following process:
[0112] The video player requests preview information from the backend server, carrying user identity information (CST), a verification token, and other verification information. The verification token may contain information such as file identifier (FileID) and operator identifier (VID).
[0113] After the backend server verifies the user's identity information, it requests the video from the video transcoding service.
[0114] The video transcoding service determines whether the video requested by the backend server has been pre-transcoded. If so, it returns a pre-transcoding link to the backend server. This pre-transcoding link can be understood as a link generated during the pre-transcoding process; for example, it might map to a video slice file on a CND server. The pre-transcoding process performed by the video transcoding service is described above and will not be repeated here.
[0115] The backend server returns the video link (pre-transcoded link) to the video player.
[0116] After determining that the kernel environment meets the operational requirements, the video player requests the playlist corresponding to the session file from the video transcoding service. It's important to note that the video player's determination of the kernel environment aims to identify and adapt to the characteristics of the underlying operating environment (i.e., the kernel environment) to ensure successful video decoding, rendering, and playback. The kernel environment can be understood as the video processing capabilities and related resources provided at the operating system layer or hardware layer. For example, it can determine whether the current playback environment supports a specific kernel, such as the HLS (High-Level Synthesis) kernel. If supported, it prioritizes using the HLS kernel for video playback; otherwise, it uses the system kernel. The video player can carry authentication information, such as cookies or authentication keys, when initiating access requests for the playlist to the video transcoding service.
[0117] The video transcoding service verifies received access requests for playlists. Upon successful verification, it returns the playlist corresponding to the session file. For example, the playlist returned by the video transcoding service can also carry encryption information, such as the "#EXT-X-KEY" tag. It is understood that the "#EXT-X-KEY" tag is a tag in the HLS protocol used to mark encryption-related information such as encryption methods, key addresses, and authentication parameters. Its inclusion in the playlist guides the client on how to decrypt video files transmitted via the HLS protocol.
[0118] The video player parses the playlist and learns that the corresponding video segment file is an encrypted file, so it requests the decryption key from the video transcoding service.
[0119] The video transcoding service verifies the received key acquisition request, and returns the decryption key to the video player after successful verification.
[0120] The video player requests each video segment file from the CDN server based on the parsed playlist, and then decrypts the video segment files returned by the CDN server using the obtained decryption key before playing the decrypted video segment files.
[0121] Therefore, in the online video file preview scheme proposed in this embodiment, by slicing the video file to avoid the leakage of the entire video, and by storing the obtained video slice files confidentially in a CDN server, the possibility of leakage during network transmission is reduced. This greatly reduces the risk of video leakage during video preview and playback, thus making the video file more secure.
[0122] In another exemplary embodiment, in online preview mode, considering that existing page watermarking technology is implemented by adding DOM (Document Object Model) element masking to the page, it is easy to remove the watermark by deleting or hiding the DOM element through technical means, which makes the security of page watermark display low.
[0123] To address this technical issue, this embodiment proposes a watermark rendering anti-deletion scheme in online preview mode, combining front-end and back-end technologies to enhance watermark security. Please refer to... Figure 12 The file preview method, as shown, further includes the following steps:
[0124] S1210: During page loading, an observer instance is created. The observer instance detects changes in the watermark element. If the observer instance detects a change in the watermark element, the watermark element is restored.
[0125] Understandably, observer instances (such as MutationObserver) provide the ability to detect changes in the DOM tree within a certain range, such as the addition or removal of nodes, modification of attributes, or modification of the child node list. Observer instances allow the definition of callback functions, which are triggered when the DOM tree changes, rather than binding an event detector (also represented as a Listener) to every possible DOM operation. This simplifies the technical implementation of the watermark rendering anti-deletion scheme provided in this embodiment, and to some extent saves client resources and optimizes client performance.
[0126] S1220 periodically detects changes in specific style attributes of watermark elements. If a change in a specific style attribute is detected, the changed specific style attribute is forcibly restored.
[0127] The styles mentioned in this embodiment refer to CSS (Cascading Style Sheets) styles, and specific style properties include one or more properties such as display, visibility, and opacity. These specific style properties represent settings related to hiding the watermark; by default, hiding the watermark is set to off for the watermark to be displayed on the page.
[0128] This embodiment periodically detects changes in specific style attributes of watermark elements to ensure they are not set to hidden watermarks. If a change in a specific style attribute is detected, it indicates that the attribute has been tampered with. Therefore, these attributes are forcibly restored, thereby preventing watermark tampering on the page and further ensuring the security of watermarked content in session files.
[0129] It should be noted that in actual application scenarios, S1210 and S1220 can be used individually or together, depending on the actual requirements for the watermark security level. This embodiment does not impose any restrictions on this.
[0130] Please see Figure 13 , Figure 13 This is a block diagram illustrating a file preview device according to an exemplary embodiment of this application. Figure 13 As shown, in an exemplary embodiment, the file preview device includes:
[0131] The receiving module 1310 is configured to receive a session file that is encrypted and transmitted by the sender through an instant messaging session;
[0132] Matching module 1320 is configured to match the preview mode corresponding to the session file; the preview mode includes online preview or plugin preview. Online preview means that the session file is previewed by combining the server and the browser, while plugin preview means that the session file is previewed by a locally configured preview plugin.
[0133] Preview module 1330 is configured to perform preview processing of session files based on the preview mode obtained by matching.
[0134] In another exemplary embodiment, the preview mode is a plug-in preview; the preview module 1330 includes a plug-in preview unit, which is configured as follows:
[0135] Store the session files locally;
[0136] In response to the preview request corresponding to the session file, the session file is decrypted through the preview plugin, and the decrypted session file is parsed to obtain the parsed file data;
[0137] The preview plugin renders the parsed file data to display the content of the session file.
[0138] In another exemplary embodiment, the plug-in preview unit is further configured as follows:
[0139] Determine the rendering type corresponding to the session file. The rendering type includes paginated rendering or tiled rendering.
[0140] The parsed file data is rendered using a rendering mode that matches the rendering type to display the file content of the session file.
[0141] In another exemplary embodiment, the plug-in preview unit is further configured as follows:
[0142] If the rendering type is paginated rendering, the rendering of the current screen interface is performed through the main thread, and the rendering of the content of the session file is performed through the rendering thread.
[0143] If the rendering type is chunked rendering, the chunked file data is obtained from the parsed file data, and the chunked file data corresponding to adjacent blocks are merged and rendered according to the block identifiers corresponding to different chunked file data.
[0144] In another exemplary embodiment, the plugin preview unit is further configured to cause the rendering thread to perform the following steps:
[0145] Extract page bitmap data and page text data from the parsed file data;
[0146] Create a drawing layer based on the page bitmap data, and create a text layer based on the page text data;
[0147] Perform coordinate transformation on the text content contained in the text layer, and then overlay the transformed text layer on top of the drawing layer to display the file content of the session file.
[0148] In another exemplary embodiment, the preview mode is an online preview; the preview module 1330 includes an online preview unit, which is configured as follows:
[0149] In response to a preview request for a session file, the recipient's preview permissions are verified through the background server of the instant messaging application.
[0150] Obtain the preview link returned by the backend server after the preview permission verification is passed;
[0151] Load the preview link in your browser to display the contents of the session file.
[0152] In another exemplary embodiment, the session file includes a video file; the online preview unit is further configured to:
[0153] The video file is sliced by the backend server to obtain multiple video slice files, and a playlist corresponding to the multiple video slice files is generated. The multiple video slice files and playlists are then transmitted to the content delivery network server.
[0154] Request each video segment file from the content delivery network server and play each video segment file.
[0155] In another exemplary embodiment, multiple video slice files and the playlist are transmitted to the content delivery network server in an encrypted manner; the online preview unit is further configured to:
[0156] Request the encrypted information corresponding to the video slice file from the backend server;
[0157] Based on the obtained encryption information, the video segment files obtained from the content delivery network server are decrypted, and the decrypted video segment files are played.
[0158] In another exemplary embodiment, the online preview unit is further configured as follows:
[0159] After receiving the confidential file message from the backend server, a web page view container is created. The web page view container is configured to preload the offline resources contained in the session file based on the preloaded links. The confidential file message is generated by the backend server after it has completed the offline processing of the session file resources.
[0160] Upon receiving a preview request for the session file, the offline resources contained in the session file are displayed based on the pre-loaded webpage view container.
[0161] In another exemplary embodiment, the online preview unit is further configured as follows:
[0162] When the preloaded webpage view container is invoked, the recipient's preview permissions are re-verified. If the verification passes, the offline resources contained in the session file are displayed through the preloaded webpage view container.
[0163] In another exemplary embodiment, the online preview unit is further configured as follows:
[0164] If it is detected that the created webpage view container has not been preloaded, the webpage view container is recreated, and the offline resources contained in the session file are loaded and displayed through the recreated webpage view container.
[0165] In another exemplary embodiment, the matching module 1320 is further configured as follows:
[0166] Determine the file size of the session file;
[0167] If the file size is lower than the preset threshold, the preview mode that matches the session file is determined to be the plugin preview;
[0168] If the file size exceeds a preset threshold, the preview mode matching the session file is determined to be online preview.
[0169] It should be noted that the apparatus and method provided in the above embodiments belong to the same concept, and the specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here. In practical applications, the file preview apparatus or video processing apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above, and this is not a limitation here.
[0170] Embodiments of this application also provide an electronic device, including: one or more processors; and a memory for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the file preview method provided in the above embodiments.
[0171] Figure 14 A schematic diagram of a computer system suitable for implementing an electronic device according to embodiments of this application is shown. It should be noted that the electronic device can be... Figure 1 The user terminal in the implementation environment shown, such as the first terminal 110 or the second terminal 120, can also be a user terminal in other implementation environments; there are no restrictions here. It should also be noted that... Figure 14 The computer system 1400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0172] like Figure 14As shown, the computer system 1400 includes a Central Processing Unit (CPU) 1401, which can perform various appropriate actions and processes based on a computer program stored in Read-Only Memory (ROM) 1402 or a computer program loaded from storage portion 1408 into Random Access Memory (RAM) 1403, such as performing the methods described in the above embodiments. Various computer programs and data required for system operation are also stored in RAM 1403. The CPU 1401, ROM 1402, and RAM 1403 are interconnected via bus 1404. An Input / Output (I / O) interface 1405 is also connected to bus 1404.
[0173] The following components are connected to I / O interface 1405: an input section 1406 including a keyboard, mouse, etc.; an output section 1407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to I / O interface 1405 as needed. Removable media 1411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1410 as needed so that computer programs read from them can be installed into storage section 1408 as needed.
[0174] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1409, and / or installed from removable medium 1411. When the computer program is executed by central processing unit (CPU) 1401, it performs various functions defined in the system of this application.
[0175] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0176] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0177] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0178] Another aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor of an electronic device, implements the file preview method as described above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not incorporated into the electronic device.
[0179] Another aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the file preview method provided in the various embodiments described above.
[0180] The above description is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.
[0181] It is understood that in the specific implementation of this application, data related to sessions, files, videos, watermarks, etc. are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
Claims
1. A file preview method characterized by, The method comprises: receiving a session file transmitted by a sender through an instant messaging session encryption transmission; matching a preview mode corresponding to the session file; the preview mode comprises online preview or plug-in preview, the online preview represents that the preview processing of the session file is realized by a joint server and a browser, and the plug-in preview represents that the preview processing of the session file is realized through a locally configured preview plug-in; performing preview processing of the session file based on the matched preview mode.
2. The method of claim 1, wherein, The preview mode is plug-in preview; the preview processing of the session file based on the matched preview mode comprises: locally storing the session file; decrypting the session file through the preview plug-in and performing parsing processing on the decrypted session file to obtain parsed file data in response to a preview request corresponding to the session file; performing rendering processing on the parsed file data through the preview plug-in to display file content of the session file.
3. The method of claim 2, wherein, The rendering processing on the parsed file data through the preview plug-in to display file content of the session file comprises: determining a rendering type corresponding to the session file, the rendering type comprising page rendering or block rendering; performing rendering processing on the parsed file data in a rendering mode matched with the rendering type to display file content of the session file.
4. The method of claim 3, wherein, The rendering processing on the parsed file data in a rendering mode matched with the rendering type to display file content of the session file comprises: if the rendering type is page rendering, performing rendering processing of a current screen interface through a main thread and performing rendering processing of file content of the session file through a rendering thread; if the rendering type is block rendering, obtaining block file data from the parsed file data, and performing merged rendering on adjacent block file data according to different block identifiers corresponding to the block file data.
5. The method of claim 4, wherein, The rendering processing of the session file by the rendering thread comprises: obtaining page bitmap data and page text data from the parsed file data; creating a drawing layer according to the page bitmap data and a text layer according to the page text data; performing coordinate conversion on text content contained in the text layer, and covering the converted text layer on the drawing layer to display file content of the session file.
6. The method of claim 1, wherein, The preview mode is online preview; the preview processing of the session file based on the matched preview mode comprises: performing pre-viewing permission verification of a receiver through a background server of an instant messaging application in response to a preview request corresponding to the session file; obtaining a preview link returned by the background server after the pre-viewing permission verification is passed; loading the preview link through a browser to display file content of the session file.
7. The method of claim 6, wherein, The session file comprises a video file; the method further comprises: The video file is sliced by the background server to obtain a plurality of video slice files, and a playlist corresponding to the plurality of video slice files is generated, and the plurality of video slice files and the playlist are transmitted to a content distribution network server; The preview link is loaded by the browser to display the file content of the session file, including: The content distribution network server is requested to obtain each video slice file, and each obtained video slice file is played.
8. The method of claim 7, wherein, The plurality of video slice files and the playlist are encrypted and transmitted to the content distribution network server; the content distribution network server is requested to obtain each video slice file, and each obtained video slice file is played, including: The content distribution network server is requested to obtain the encryption information corresponding to the video slice file; According to the obtained encryption information, each video slice file obtained from the content distribution network server is decrypted, and the decrypted video slice file is played.
9. The method of claim 6, wherein, The method further includes: After receiving the secret file message sent by the background server, a web view container is created, which is configured to pre-load offline resources contained in the session file based on a pre-loading link; the secret file message is generated after the background server has completed resource offlining processing of the session file; After receiving the preview request corresponding to the session file, the offline resources contained in the session file are displayed according to the web view container that has completed pre-loading.
10. The method of claim 9, wherein, After receiving the preview request corresponding to the session file, the offline resources contained in the session file are displayed according to the web view container that has completed pre-loading, including: When the web view container that has completed pre-loading is invoked, the preview permission of the receiver is re-verified, and if the verification is passed, the offline resources contained in the session file are displayed through the web view container that has completed pre-loading.
11. The method of claim 9, wherein, The method further includes: If it is detected that the created web view container has not completed pre-loading, a web view container is recreated, and the offline resources contained in the session file are loaded through the recreated web view container to display the offline resources contained in the session file.
12. The method according to any one of claims 1-11, characterized in that, The matching of the preview mode corresponding to the session file includes: The file size of the session file is determined; If the file size is lower than a preset threshold, it is determined that the preview mode matched with the session file is plug-in preview; If the file size is higher than the preset threshold, it is determined that the preview mode matched with the session file is online preview.
13. A file preview apparatus characterized by comprising: The device includes: A receiving module configured to receive a session file encrypted and transmitted by a sender through an instant messaging session; A matching module configured to match a preview mode corresponding to the session file; the preview mode includes online preview or plug-in preview, the online preview represents that the preview processing of the session file is realized by a joint server and a browser, and the plug-in preview represents that the preview processing of the session file is realized by a locally configured preview plug-in; A preview module configured to perform preview processing of the conversation file based on the matched preview mode.
14. An electronic device, comprising: Comprising: one or more processors; a memory for storing one or more computer programs that, when executed by the one or more processors, cause the electronic device to implement the method of any of claims 1-12.
15. A computer-readable storage medium, characterized in that, a computer program stored thereon that, when executed by a processor of an electronic device, causes the electronic device to perform the method of any of claims 1-12.
16. A computer program product comprising a computer program, characterized in that, the computer program is executed by a processor of an electronic device to implement the method of any of claims 1-12.