Audio and video playing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202310535793.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2043-05-11
AI Technical Summary
这种方式虽然可以节省一些带宽成本,但是,https本地静态资源服务需要在本地安装证书,带来了巨额的证书成本
上述音视频的播放方法、装置、电子设备和存储介质,响应于终端的浏览器中目标加密音视频的播放请求,获取目标应用程序的本地视频存储位置,并判断所述本地视频存储位置中是否包含所述目标加密音视频,所述目标应用程序与所述浏览器处于同一终端;若所述本地视频存储位置中包含所述目标加密音视频,则通过所述浏览器与所述目标应用程序之间的目标数据通道,在所述浏览器中对所述本地视频存储位置中的目标加密音视频进行音视频流的解密播放;若所述本地视频存储位置中不包含所述目标加密音视频,则下载所述目标加密音视频,并在所述浏览器中对下载的目标加密音视频进行音视频流的解密播放。该方式中,终端可以在浏览器中请求播放目标应用程序的目标加密音视频,如果目标应用程序的本地视频存储位置中包含目标加密音视频,则通过浏览器与目标应用程序之间的目标数据通道进行音视频流的解密播放,使得相互独立的浏览器和应用程序无需通过带宽资源即可实现数据传输,减少带宽成本的同时,无需安装证书也能播放https环境下的音视频。
Smart Images

Figure CN116668780B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of Internet and multimedia communication technology, and in particular to an audio and video playback method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of internet technology, more and more internet platforms support uploading and sharing audio and video files. For example, gaming platforms allow users to share their own recorded match replays and watch replays uploaded by others; social media platforms allow users to share videos they've filmed and watch videos shared by others. These audio and video files are usually pre-encrypted for copyright or platform protection reasons. Furthermore, with the development of network communication technology, more and more internet platforms are choosing Hypertext Transfer Protocol Secure (HTTPS) as their network communication protocol. HTTPS offers higher security than Hypertext Transfer Protocol (HTTP) and is gradually replacing HTTP's original position.
[0003] When playing encrypted audio and video from an application running HTTPS in a browser, existing technology allows accessing and playing the application's local audio and video resource files by setting up an HTTPS local static resource service. While this method can save some bandwidth costs, it requires installing certificates locally, resulting in substantial certificate costs. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide an audio and video playback method, apparatus, electronic device and storage medium to reduce the bandwidth cost required for audio and video playback while avoiding the additional certificate costs in an HTTPS environment.
[0005] In a first aspect, embodiments of the present invention provide an audio / video playback method, the method comprising: responding to a playback request for a target encrypted audio / video in a browser of a terminal, obtaining the local video storage location of a target application, and determining whether the target encrypted audio / video is contained in the local video storage location, wherein the target application and the browser are on the same terminal; if the target encrypted audio / video is contained in the local video storage location, then decrypting and playing the target encrypted audio / video stream in the browser through a target data channel between the browser and the target application; if the target encrypted audio / video is not contained in the local video storage location, then downloading the target encrypted audio / video, and decrypting and playing the downloaded target encrypted audio / video stream in the browser.
[0006] Secondly, embodiments of the present invention provide an audio / video playback device, comprising: a file determination module, configured to, in response to a playback request for a target encrypted audio / video in a browser of a terminal, obtain the local video storage location of a target application and determine whether the target encrypted audio / video is contained in the local video storage location, wherein the target application and the browser are on the same terminal; a local playback module, configured to, if the target encrypted audio / video is contained in the local video storage location, decrypt and play the target encrypted audio / video stream in the browser through a target data channel between the browser and the target application; and a download playback module, configured to, if the target encrypted audio / video is not contained in the local video storage location, download the target encrypted audio / video and decrypt and play the downloaded target encrypted audio / video stream in the browser.
[0007] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described audio and video playback method.
[0008] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described audio and video playback method.
[0009] The embodiments of the present invention bring the following beneficial effects: The aforementioned audio and video playback method, apparatus, electronic device, and storage medium, in response to a playback request for a target encrypted audio and video in a terminal's browser, obtain the local video storage location of the target application and determine whether the target encrypted audio and video is contained in the local video storage location. The target application and the browser are on the same terminal. If the target encrypted audio and video is contained in the local video storage location, the target encrypted audio and video stream in the browser is decrypted and played through the target data channel between the browser and the target application. If the target encrypted audio and video is not contained in the local video storage location, the target encrypted audio and video is downloaded, and the downloaded target encrypted audio and video stream is decrypted and played through the browser. In this method, the terminal can request playback of the target encrypted audio and video of the target application in the browser. If the target encrypted audio and video is contained in the local video storage location of the target application, the audio and video stream is decrypted and played through the target data channel between the browser and the target application. This allows independent browsers and applications to achieve data transmission without bandwidth resources, reducing bandwidth costs and enabling playback of audio and video under HTTPS without the need for certificate installation.
[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 This is a flowchart of one embodiment of the audio and video playback method according to the present invention; Figure 2 This is a flowchart of another embodiment of the audio and video playback method in this invention; Figure 3 A schematic diagram of an audio / video playback device provided in an embodiment of the present invention; Figure 4This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] 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.
[0016] It should be noted that this technical solution applies to playing encrypted audio and video in an application's HTTPS environment within a browser. Here, HTTPS refers to a server environment that transmits data based on the HTTPS protocol. It's understandable that data transmission between applications or websites typically requires an intermediary. For example, the application might upload the data it needs to access to a server, and the browser accesses the server to retrieve the uploaded data—a process commonly known as downloading and playing, which consumes network bandwidth. Another approach is to set up an HTTPS local static resource service for the application. The browser then retrieves the application's data through this service. While this method reduces network bandwidth consumption, it requires installing an HTTPS security certificate on the browser's endpoint, a complex process that increases the pre-playback time of audio and video, leading to longer user wait times and a decreased user experience.
[0017] Based on the above, this technical solution provides a way for browsers to play encrypted audio and video from HTTPS applications without installing HTTPS certificates in an HTTPS environment. This reduces the bandwidth costs required for audio and video playback while avoiding the additional certificate costs associated with HTTPS.
[0018] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the audio / video playback method in this invention includes: Step S10: In response to the playback request of the target encrypted audio and video in the browser of the terminal, obtain the local video storage location of the target application, and determine whether the local video storage location contains the target encrypted audio and video. The target application and the browser are on the same terminal. In this embodiment, the terminal's browser can open the target encrypted audio / video playback webpage (i.e., the target audio / video playback page) and send a playback request in the playback webpage. This playback request is first responded to by the terminal. In this step, the terminal responds to the playback request of the target encrypted audio / video in the browser, obtains the local video storage location of the target application, where the local video storage location is the local path where the target application stores videos on the terminal. The terminal then determines whether the target encrypted audio / video is contained in this local path to determine whether bandwidth needs to be used to download it. It should be noted that the target encrypted audio / video can be an encrypted audio file, an encrypted video file, or a file combining encrypted audio and video; the specific type is not limited here. It is understood that the target encrypted audio / video is an encrypted file managed by the target application. The browser cannot directly read and play this encrypted file; it requires at least a specified player and a specified decryption algorithm to decrypt and play it in the browser. In some cases, a specified reading channel (e.g., an authenticated channel) is also required to obtain the target encrypted audio / video from the local video storage location for decryption and playback.
[0019] As an example application scenario, the target application can be a virtual game program, and the target encrypted audio / video can be a game recording uploaded by a user of that virtual game program. When the target audio / video playback page is opened by the terminal's browser and clicked to play, the terminal determines whether the target encrypted audio / video being played is contained in the target application's local video storage location. This determines whether to play the locally stored target encrypted audio / video or download and play it. Typically, the target encrypted audio / video is a file uploaded / submitted / saved by the target application on the terminal, or a file viewed / downloaded / cached by the target application on the terminal. Such files are typically contained in the local video storage location; for example, game recordings uploaded by players logged into the virtual game program on the terminal, or game recordings uploaded by other players that players logged into the virtual game program on the terminal have viewed. There are other situations where the target encrypted audio / video can be contained in the local video storage location, which will not be listed here.
[0020] In one implementation, the browser can obtain the local video storage location of the target application through a local HTTPS environment service pre-started by the target application, and determine whether the local video storage location contains the target encrypted audio and video. Here, the local HTTPS environment service is a local service that simulates an HTTPS environment server and can serve as an intermediary for data transmission between the terminal's browser and the target application.
[0021] It should be noted that the target application and the browser reside on the same terminal. The browser can be either a built-in browser of the target application or an external browser; the specific type is not limited here. A built-in browser refers to a browser invoked from within the target application, while an external browser refers to a browser invoked from outside the target application. In one implementation, the external browser can wake up the target application, thereby enabling data transmission.
[0022] Step S20: If the local video storage location contains the target encrypted audio and video, then through the target data channel between the browser and the target application, the target encrypted audio and video stream in the local video storage location is decrypted and played in the browser. It's important to note that if the local video storage location contains the target encrypted audio and video, due to Network Address Translation (NAT), the browser cannot directly play the target encrypted audio and video from the local video storage location. Instead, it needs to use a target data channel between the browser and the target application to read the target encrypted audio and video from the local video storage location in the browser. During the reading process, the browser reads and decrypts the target encrypted audio and video stream simultaneously, thereby improving playback efficiency and thus enhancing the playback experience. The target data channel is a data transmission channel that penetrates NAT, used to achieve peer-to-peer data transmission between the browser and the target application. NAT is understood as a solution to address the limited public IP address resources and the difficulty of reserving public IP addresses. By converting private IP addresses to public IP addresses, it allows devices on private networks to connect to devices on public networks or other private networks.
[0023] Understandably, since the browser and the target application are both on the same terminal, the target data channel between the browser and the target application is a local data transmission channel with a higher transmission speed than the network transmission channel, which improves the playback efficiency of the target encrypted audio and video and thus enhances the playback experience.
[0024] In one implementation, the target data channel between the browser and the target application can be established through the Interactive Connectivity Establishment (ICE) framework, or based on a service encapsulated with the ICE framework, such as Web Real-Time Communications (WebRTC) service. Alternatively, the target data channel between the browser and the target application can be established independently based on the NAT mechanism. The specific implementation is not limited here.
[0025] In this embodiment, the browser can read the target encrypted audio and video from the local video storage location of the target application through the target data channel. Since the target encrypted audio and video is a file encrypted based on the encryption algorithm of the target application, in one embodiment, after obtaining the target encrypted audio and video from the local storage location through the target data channel, the browser can decrypt and play the obtained target encrypted audio and video stream using a preset decryption algorithm.
[0026] Step S30: If the target encrypted audio and video is not stored in the local video storage location, download the target encrypted audio and video, and decrypt and play the downloaded target encrypted audio and video stream in the browser.
[0027] Understandably, if the target encrypted audio and video are not stored in the local video storage location, it means that the target encrypted audio and video are not stored in the target application's local video storage location. In this case, the target encrypted audio and video will be downloaded using bandwidth resources. During the download process, the target encrypted audio and video will be downloaded and decrypted simultaneously in the browser, thereby improving the playback efficiency and thus enhancing the playback experience.
[0028] It should be noted that after downloading the target encrypted audio and video in step S30, decrypting and playing the downloaded target encrypted audio and video stream in the browser is similar to decrypting and playing the target encrypted audio and video stream in the local video storage location in step S20, including but not limited to using the same audio and video stream playback method, the same decryption method, and the same player. In one embodiment, corresponding to step S20, the downloaded target encrypted audio and video stream is decrypted and played in the browser using a preset decryption algorithm.
[0029] It is understood that steps S10-S30 of the embodiments of the present invention are all executed in a browser. JavaScript is an interpreted scripting language. In one implementation, the audio and video playback process of steps S10-S30 is executed based on the scripting language JavaScript, making the playback of audio and video more convenient and easier to develop.
[0030] The audio and video playback method provided by the above embodiments allows the terminal to request the playback of target encrypted audio and video of the target application in the browser. If the target encrypted audio and video is contained in the local video storage location of the target application, the audio and video stream is decrypted and played through the target data channel between the browser and the target application. This enables independent browsers and applications to transmit data without bandwidth resources, reducing bandwidth costs and allowing playback of audio and video in an HTTPS environment without the need to install a certificate.
[0031] Please see Figure 2 Another embodiment of the audio and video playback method in this invention includes: Step S201: In response to the startup command of the target application, start the local real-time communication service of the terminal; In this embodiment, after the target application starts, the local real-time communication service also starts to establish a target data channel between the browser and the target application. In one embodiment, if the browser is the built-in browser of the target application, then when responding to the playback request of the target encrypted audio and video in the terminal's browser, the target application must be the started application, and the local real-time communication service is also the started service; if the browser is an external browser of the target application, then when responding to the playback request of the target encrypted audio and video in the terminal's browser, the target application can be woken up first, that is, a start command can be sent to the target application, and the target application responds to the start command to start the terminal's local real-time communication service. Therefore, regardless of whether the browser is the built-in browser of the target application or an external browser, audio and video can be played through the embodiments of the present invention, and the playback method is more flexible.
[0032] In one implementation, the local real-time communication service is a local WebRTC service. The local WebRTC service integrates a framework for building point-to-point communication connections, including but not limited to NAT traversal methods and data channel connectivity detection methods, which makes it easier to establish target data channels between the browser and the target application.
[0033] Step S202: Perform public address translation across network address switching device on the private network address of the target application through local real-time communication service to obtain the first public network address of the target application; Step S203: Report the first public IP address to the target signaling server; Understandably, since the terminal is located behind the NAT device (Network Address Translation device), meaning it only has a private IP address and no public IP address, the browser and the target application cannot communicate without a third-party server as a communication medium. In this situation, the browser and the target application cannot share their private IP addresses; their IP portions may be the same, but their port numbers will differ. Therefore, in steps S202-S203, the target application's private IP address is converted to a public IP address that traverses the NAT device using a local real-time communication service, resulting in a first public IP address. This first public IP address is then reported to the target signaling server so that the browser can obtain the target application's first public IP address from the target signaling server, thus achieving NAT traversal communication.
[0034] In one implementation, the target application's first public IP address can be obtained by performing NAT hole punching on the target application's private network address using the ICE framework in the local WebRTC service. Specifically, during NAT hole punching, the Session Traversal Utilities for NAT (STUN) and Traversal Using Relays around NAT (TURN) network protocols are used, making NAT hole punching more efficient.
[0035] It should be noted that the target signaling server is a pre-authenticated server. The target signaling server itself does not participate in the transmission of data (including audio and video streams). Instead, it is used to inform the browser and the target application of each other's public IP addresses, facilitating the exchange of network address information between the two. The target signaling server can exchange network address information between the browser and the target application using any network transmission method, such as HTTP and WebSocket; specific restrictions are not specified here.
[0036] In one embodiment, after step S203, the method further includes: responding to the loading of the target audio / video playback page in the browser of the terminal, performing public address translation (PAT) on the browser's private network address through a network address switching device to obtain the browser's second public network address, wherein the target audio / video playback page includes an entry point for sending playback requests for the target encrypted audio / video; obtaining the first public network address of the target application through the target signaling server, and establishing a data channel between the browser and the target application through the first public network address and the second public network address to obtain the target data channel between the browser and the target application.
[0037] In this embodiment, when the target audio / video playback is also loaded at the entry point containing the playback request for the target encrypted audio / video, the browser's private network address is converted to a public network address that traverses the NAT device, resulting in a second public network address. Then, the first public network address is obtained from the target signaling server. Thus, a unique data channel is established between the browser and the target application using both the first and second public network addresses, resulting in the target data channel. It is understood that the data channels corresponding to different browsers or different target applications are independent of each other. For example, browser A and target application B correspond to target data channel AB, and browser B and target application B correspond to target data channel BB; the specifics are not limited here. Independent data channels improve the stability of audio / video playback.
[0038] It is understandable that the process of performing public IP address translation on the browser's private IP address across the network address switching device is similar to the process in step S202: performing public IP address translation on the target application's private IP address across the network address switching device through the local real-time communication service. The browser's private IP address can be NAT punched through the ICE framework in the local WebRTC service to obtain the second public IP address. Alternatively, the Session Traversal Utilities for NAT (STUN) network protocol and the Traversal Using Relays around NAT (TURN) network protocol can be used for NAT punching. Other implementation methods can also adopt similar approaches, which will not be elaborated here.
[0039] Step S204: In response to the playback request of the target encrypted audio and video in the browser of the terminal, obtain the local video storage location of the target application, and determine whether the local video storage location contains the target encrypted audio and video. The target application and the browser are on the same terminal. In one implementation, the above-mentioned response to the loading of the target audio / video playback page in the terminal's browser, performing public IP address translation (PAT) on the browser's private IP address to obtain the browser's second public IP address, includes: responding to the loading of the target audio / video playback page in the terminal's browser, starting an instance of a local real-time communication service, and performing PAT on the browser's private IP address through the instance to obtain the browser's second public IP address; the above-mentioned step S204 includes: responding to the playback request of the target encrypted audio / video in the terminal's browser through the instance of the local real-time communication service, obtaining the local video storage location of the target application through the toolkit of the target application; and determining whether the local video storage location contains the target encrypted audio / video through the identifier of the target encrypted audio / video in the playback request.
[0040] In this embodiment, when the target audio / video playback page loads, a local WebRTC service instance is started. During step S204, this instance responds to the playback request of the target encrypted audio / video on the target audio / video playback page, calls the target application's Software Development Kit (SDK), and obtains the target application's local video storage location. It is understood that the playback request carries an identifier for the target encrypted audio / video. Based on this identifier, the local WebRTC service or toolkit can determine whether the local video storage location contains the target encrypted audio / video, thereby determining whether to subsequently decrypt and play the local target encrypted audio / video through the target data channel between the browser and the target application, improving audio / video playback efficiency and thus enhancing the audio / video playback experience.
[0041] In one implementation, the aforementioned target encrypted audio / video is used to indicate files uploaded by a target account logged into a target application on a terminal. It is understood that, according to this embodiment of the invention, decrypting and playing files uploaded by a target account logged into a target application on a terminal via a target data channel results in higher playback efficiency. For example, assuming the target application is a virtual game program, then the target account is a player account logged into on a terminal. The audio / video files uploaded by this player account (such as screen recordings from the game) are the target encrypted audio / video. When the player account clicks on their uploaded audio / video file in a browser to play it, the target data channel in this embodiment of the invention allows for efficient playback without consuming bandwidth for downloading the audio / video file, improving the audio / video playback experience and saving bandwidth costs for the virtual game program.
[0042] Step S205: If the local video storage location contains the target encrypted audio and video, then the target encrypted audio and video stream in the local video storage location is decrypted and played in the browser through the target data channel between the browser and the target application. In one implementation, step S205 includes: if the local video storage location contains the target encrypted audio and video, then through the target data channel between the browser and the target application, obtain the binary file stream corresponding to the target encrypted audio and video in the local video storage location; decrypt the binary file stream using the local private key to obtain the decrypted binary file stream; convert the decrypted binary file stream into a player file object, and play the converted player file object in the browser.
[0043] In this embodiment, playing the target encrypted audio and video through streaming media transmission can improve playback efficiency. Specifically, if the target encrypted audio and video is contained in the local video storage location, the binary file stream corresponding to the target encrypted audio and video in the local video storage location is obtained through the target data channel. In one embodiment, this binary file stream is a buffer stream, also known as an enhanced stream or high-efficiency stream, which has higher transmission efficiency. While reading the binary file stream, the binary file stream is decrypted using the terminal's local private key, and then converted into a player file object for playback in the browser's player. In one embodiment, the player file object is a blob object, which is an immutable, raw data file-like object. The data of a blob object can be read in text or binary format, or it can be converted into a ReadableStream for data manipulation.
[0044] Step S206: If the target encrypted audio and video are not stored in the local video storage location, download the target encrypted audio and video, and decrypt and play the downloaded target encrypted audio and video stream in the browser.
[0045] In one implementation, step S206 includes: if the local video storage location contains the target encrypted audio and video, then download the target encrypted audio and video to obtain the binary file stream corresponding to the downloaded target encrypted audio and video; decrypt the binary file stream using the local private key to obtain the decrypted binary file stream; convert the decrypted binary file stream into a player file object, and play the converted player file object in the browser.
[0046] It is understandable that step S206 is similar to step S205 in that it decrypts the target encrypted audio and video and converts the player file object in the form of a binary file stream. The specifics will not be elaborated here.
[0047] In one implementation, the method further includes: responding to an audio / video publishing command in the target application, encrypting the audio / video file corresponding to the publishing command using a preset public key to obtain an encrypted audio / video file; storing the encrypted audio / video file in a local video storage location and uploading it to the target server. It should be noted that when a login account of the target application publishes an audio / video file, responding to the audio / video publishing command in the target application, the audio / video file to be published is encrypted using a preset public key in the target application to obtain an encrypted audio / video file, and simultaneously storing the encrypted audio / video file in a local video storage location and uploading it to the target server. The encrypted audio / video file stored in the local video storage location is used for decryption and playback via the target data channel between the browser and the target application, while the file uploaded to the target server is used for decryption and playback after downloading to the terminal, or for decryption and playback while downloading.
[0048] The audio and video playback method provided by the above embodiments allows the terminal to request the playback of target encrypted audio and video of the target application in the browser. If the target encrypted audio and video is contained in the local video storage location of the target application, the audio and video stream is decrypted and played through the target data channel between the browser and the target application based on the traversal of the network address switching device. This enables independent browsers and applications to achieve data transmission without bandwidth resources, reducing bandwidth costs and allowing playback of audio and video in an HTTPS environment without the need to install certificates.
[0049] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 3 The diagram illustrates an audio / video playback device, comprising: a file determination module 30, configured to, in response to a playback request for a target encrypted audio / video file in a browser on a terminal, obtain the local video storage location of a target application and determine whether the local video storage location contains the target encrypted audio / video file, wherein the target application and the browser are on the same terminal; a local playback module 32, configured to, if the local video storage location contains the target encrypted audio / video file, decrypt and play the target encrypted audio / video file in the browser through the target data channel between the browser and the target application; and a download playback module 34, configured to, if the local video storage location does not contain the target encrypted audio / video file, download the target encrypted audio / video file and decrypt and play the downloaded target encrypted audio / video file in the browser.
[0050] The aforementioned audio and video playback device allows the terminal to request playback of target encrypted audio and video from a target application within a browser. If the target application's local video storage location contains the target encrypted audio and video, the audio and video stream is decrypted and played through the target data channel between the browser and the target application. This enables independent browsers and applications to transmit data without bandwidth resources, reducing bandwidth costs and allowing playback of HTTPS-enabled audio and video without the need for certificate installation.
[0051] Optionally, the above apparatus further includes: a service startup module, used to start the local real-time communication service of the terminal in response to the startup command of the target application; a first traversal module, used to perform public address translation of the private network address of the target application through the local real-time communication service to obtain the first public network address of the target application; and a reporting signaling module, used to report the first public network address to the target signaling server.
[0052] Optionally, the above-mentioned device further includes: a second traversal module, used to perform public address translation of the browser's private network address through a network address switching device in response to the loading of the target audio / video playback page in the terminal's browser, to obtain the browser's second public network address, wherein the target audio / video playback page includes an entry point for sending playback requests for the target encrypted audio / video; and a channel establishment module, used to obtain the first public network address of the target application through the target signaling server, and establish a data channel between the browser and the target application through the first public network address and the second public network address, thereby obtaining the target data channel between the browser and the target application.
[0053] Optionally, the second traversal module described above is further configured to: respond to the loading of the target audio / video playback page in the browser of the terminal, start an instance of the local real-time communication service, and use the instance to perform public address translation of the browser's private network address across the network address switching device to obtain the browser's second public network address; the file judgment module 30 described above is further configured to: respond to the playback request of the target encrypted audio / video in the browser of the terminal through the instance of the local real-time communication service, obtain the local video storage location of the target application through the toolkit of the target application; and determine whether the local video storage location contains the target encrypted audio / video by using the identifier of the target encrypted audio / video in the playback request.
[0054] Optionally, the aforementioned local playback module 32 is further configured to: if the local video storage location contains the target encrypted audio and video, obtain the binary file stream corresponding to the target encrypted audio and video in the local video storage location through the target data channel between the browser and the target application; decrypt the binary file stream using the local private key to obtain the decrypted binary file stream; convert the decrypted binary file stream into a player file object, and play the converted player file object in the browser.
[0055] Optionally, the download and playback module 34 described above is further configured to: if the local video storage location contains the target encrypted audio and video, download the target encrypted audio and video to obtain the binary file stream corresponding to the downloaded target encrypted audio and video; decrypt the binary file stream using the local private key to obtain the decrypted binary file stream; convert the decrypted binary file stream into a player file object, and play the converted player file object in the browser.
[0056] Optionally, the above-mentioned device further includes: a publishing encryption module, used to encrypt the audio and video file corresponding to the audio and video publishing command in response to the audio and video publishing command in the target application, and obtain the encrypted audio and video file by using a preset public key; and a storage and uploading module, used to store the encrypted audio and video file to a local video storage location and upload it to the target server.
[0057] Optionally, the aforementioned target encrypted audio and video are used to instruct the target account logged into the target application on the terminal to upload files.
[0058] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the aforementioned audio and video playback method. This electronic device can be a server or a terminal device.
[0059] See Figure 4 As shown, the electronic device includes a processor 400 and a memory 401. The memory 401 stores machine-executable instructions that can be executed by the processor 400. The processor 400 executes the machine-executable instructions to implement the above-described audio and video playback method.
[0060] Furthermore, Figure 4 The electronic device shown also includes a bus 402 and a communication interface 403. The processor 400, the communication interface 403 and the memory 401 are connected via the bus 402.
[0061] The memory 401 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 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 402 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 4 The 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.
[0062] The processor 400 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 400 or by instructions in software form. The processor 400 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 invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention 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 readily available 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 401. The processor 400 reads information from memory 401 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments, for example: In response to a playback request for the target encrypted audio / video in the browser on the terminal, the system obtains the local video storage location of the target application and determines whether the target encrypted audio / video is contained in the local video storage location, assuming the target application and the browser are on the same terminal. If the target encrypted audio / video is contained in the local video storage location, the system decrypts and plays the target encrypted audio / video stream in the browser through the target data channel between the browser and the target application. If the target encrypted audio / video is not contained in the local video storage location, the system downloads the target encrypted audio / video and decrypts and plays the downloaded target encrypted audio / video stream in the browser.
[0063] In this method, the terminal can request to play the target encrypted audio and video of the target application in the browser. If the target encrypted audio and video is contained in the local video storage location of the target application, the audio and video stream is decrypted and played through the target data channel between the browser and the target application. This allows independent browsers and applications to transmit data without bandwidth resources, reducing bandwidth costs and enabling playback of audio and video in an HTTPS environment without the need to install certificates.
[0064] Optionally, before responding to a playback request for the target encrypted audio / video in the browser of the terminal, obtaining the local video storage location of the target application, and determining whether the local video storage location contains the target encrypted audio / video, the method further includes: responding to a startup command of the target application, starting the terminal's local real-time communication service; performing public IP address translation across a network address switching device on the private IP address of the target application through the local real-time communication service to obtain the first public IP address of the target application; and reporting the first public IP address to the target signaling server.
[0065] Optionally, after reporting the first public IP address to the target signaling server, the method further includes: in response to the loading of the target audio / video playback page in the terminal's browser, performing public IP address translation across the network address switching device on the browser's private IP address to obtain the browser's second public IP address, wherein the target audio / video playback page includes an entry point for sending playback requests for the target encrypted audio / video; obtaining the first public IP address of the target application through the target signaling server, and establishing a data channel between the browser and the target application through the first public IP address and the second public IP address to obtain the target data channel between the browser and the target application.
[0066] Optionally, in response to the loading of the target audio / video playback page in the terminal's browser, the browser's private network address is translated to a public network address through a network address switching device to obtain the browser's second public network address. This includes: in response to the loading of the target audio / video playback page in the terminal's browser, starting an instance of the local real-time communication service, and using the instance to translate the browser's private network address to a public network address through a network address switching device to obtain the browser's second public network address; in response to a playback request for the target encrypted audio / video in the terminal's browser, obtaining the local video storage location of the target application, and determining whether the local video storage location contains the target encrypted audio / video, including: responding to the playback request for the target encrypted audio / video in the terminal's browser through an instance of the local real-time communication service, obtaining the local video storage location of the target application through the target application's toolkit, and determining whether the local video storage location contains the target encrypted audio / video through the identifier of the target encrypted audio / video in the playback request.
[0067] Optionally, if the local video storage location contains the target encrypted audio and video, the target encrypted audio and video stream in the local video storage location is decrypted and played in the browser through the target data channel between the browser and the target application. This includes: if the local video storage location contains the target encrypted audio and video, obtaining the binary file stream corresponding to the target encrypted audio and video in the local video storage location through the target data channel between the browser and the target application; decrypting the binary file stream using a local private key to obtain a decrypted binary file stream; converting the decrypted binary file stream into a player file object, and playing the converted player file object in the browser.
[0068] Optionally, if the target encrypted audio / video is not contained in the local video storage location, the target encrypted audio / video is downloaded, and the downloaded target encrypted audio / video stream is decrypted and played in the browser. This includes: if the target encrypted audio / video is contained in the local video storage location, the target encrypted audio / video is downloaded to obtain the binary file stream corresponding to the downloaded target encrypted audio / video; the binary file stream is decrypted using the local private key to obtain the decrypted binary file stream; the decrypted binary file stream is converted into a player file object, and the converted player file object is played in the browser.
[0069] Optionally, the method further includes: responding to an audio / video publishing instruction in the target application, encrypting the audio / video file corresponding to the audio / video publishing instruction using a preset public key to obtain an encrypted audio / video file; storing the encrypted audio / video file in a local video storage location, and uploading it to the target server.
[0070] Optionally, the target encrypted audio / video is used to indicate files uploaded by the target account logged into the target application on the terminal.
[0071] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned audio and video playback method. For example: In response to a playback request for the target encrypted audio / video in the browser on the terminal, the system obtains the local video storage location of the target application and determines whether the target encrypted audio / video is contained in the local video storage location, assuming the target application and the browser are on the same terminal. If the target encrypted audio / video is contained in the local video storage location, the system decrypts and plays the target encrypted audio / video stream in the browser through the target data channel between the browser and the target application. If the target encrypted audio / video is not contained in the local video storage location, the system downloads the target encrypted audio / video and decrypts and plays the downloaded target encrypted audio / video stream in the browser.
[0072] In this method, the terminal can request to play the target encrypted audio and video of the target application in the browser. If the target encrypted audio and video is contained in the local video storage location of the target application, the audio and video stream is decrypted and played through the target data channel between the browser and the target application. This allows independent browsers and applications to transmit data without bandwidth resources, reducing bandwidth costs and enabling playback of audio and video in an HTTPS environment without the need to install certificates.
[0073] Optionally, before responding to a playback request for the target encrypted audio / video in the browser of the terminal, obtaining the local video storage location of the target application, and determining whether the local video storage location contains the target encrypted audio / video, the method further includes: responding to a startup command of the target application, starting the terminal's local real-time communication service; performing public IP address translation across a network address switching device on the private IP address of the target application through the local real-time communication service to obtain the first public IP address of the target application; and reporting the first public IP address to the target signaling server.
[0074] Optionally, after reporting the first public IP address to the target signaling server, the method further includes: in response to the loading of the target audio / video playback page in the terminal's browser, performing public IP address translation across the network address switching device on the browser's private IP address to obtain the browser's second public IP address, wherein the target audio / video playback page includes an entry point for sending playback requests for the target encrypted audio / video; obtaining the first public IP address of the target application through the target signaling server, and establishing a data channel between the browser and the target application through the first public IP address and the second public IP address to obtain the target data channel between the browser and the target application.
[0075] Optionally, in response to the loading of the target audio / video playback page in the terminal's browser, the browser's private network address is translated to a public network address through a network address switching device to obtain the browser's second public network address. This includes: in response to the loading of the target audio / video playback page in the terminal's browser, starting an instance of the local real-time communication service, and using the instance to translate the browser's private network address to a public network address through a network address switching device to obtain the browser's second public network address; in response to a playback request for the target encrypted audio / video in the terminal's browser, obtaining the local video storage location of the target application, and determining whether the local video storage location contains the target encrypted audio / video, including: responding to the playback request for the target encrypted audio / video in the terminal's browser through an instance of the local real-time communication service, obtaining the local video storage location of the target application through the target application's toolkit, and determining whether the local video storage location contains the target encrypted audio / video through the identifier of the target encrypted audio / video in the playback request.
[0076] Optionally, if the local video storage location contains the target encrypted audio and video, the target encrypted audio and video stream in the local video storage location is decrypted and played in the browser through the target data channel between the browser and the target application. This includes: if the local video storage location contains the target encrypted audio and video, obtaining the binary file stream corresponding to the target encrypted audio and video in the local video storage location through the target data channel between the browser and the target application; decrypting the binary file stream using a local private key to obtain a decrypted binary file stream; converting the decrypted binary file stream into a player file object, and playing the converted player file object in the browser.
[0077] Optionally, if the target encrypted audio / video is not contained in the local video storage location, the target encrypted audio / video is downloaded, and the downloaded target encrypted audio / video stream is decrypted and played in the browser. This includes: if the target encrypted audio / video is contained in the local video storage location, the target encrypted audio / video is downloaded to obtain the binary file stream corresponding to the downloaded target encrypted audio / video; the binary file stream is decrypted using the local private key to obtain the decrypted binary file stream; the decrypted binary file stream is converted into a player file object, and the converted player file object is played in the browser.
[0078] Optionally, the method further includes: responding to an audio / video publishing instruction in the target application, encrypting the audio / video file corresponding to the audio / video publishing instruction using a preset public key to obtain an encrypted audio / video file; storing the encrypted audio / video file in a local video storage location, and uploading it to the target server.
[0079] Optionally, the target encrypted audio / video is used to indicate files uploaded by the target account logged into the target application on the terminal.
[0080] The computer program products of the audio and video playback method, apparatus, electronic device and storage medium provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0081] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0082] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0083] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a portion 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 a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present 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.
[0084] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0085] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, 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, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for playing audio and video, characterized in that, The method includes: In response to a playback request for a target encrypted audio or video in a browser on a terminal, the local video storage location of the target application is obtained, and it is determined whether the target encrypted audio or video is contained in the local video storage location, wherein the target application and the browser are on the same terminal. If the target encrypted audio and video is contained in the local video storage location, then the target encrypted audio and video stream in the local video storage location is decrypted and played in the browser through the target data channel between the browser and the target application; wherein, the target data channel is a data transmission channel that penetrates network address translation and is used for peer-to-peer data transmission between the browser and the target application; If the target encrypted audio / video is not contained in the local video storage location, the target encrypted audio / video is downloaded, and the downloaded target encrypted audio / video stream is decrypted and played in the browser.
2. The method according to claim 1, characterized in that, Before responding to a playback request for the target encrypted audio / video in the browser of the terminal, obtaining the local video storage location of the target application, and determining whether the target encrypted audio / video is contained in the local video storage location, the method further includes: In response to the target application's startup command, initiate the terminal's local real-time communication service; The target application's private network address is translated into a public network address through a network address switching device using the local real-time communication service to obtain the target application's first public network address. The first public IP address is reported to the target signaling server.
3. The method according to claim 2, characterized in that, After reporting the first public IP address to the target signaling server, the method further includes: In response to the loading of the target audio and video playback page in the browser of the terminal, the private network address of the browser is converted to a public network address through a network address switching device to obtain the second public network address of the browser. The target audio and video playback page includes an entry point for sending playback requests for the target encrypted audio and video. The first public IP address of the target application is obtained through the target signaling server, and a data channel between the browser and the target application is established through the first public IP address and the second public IP address, thereby obtaining the target data channel between the browser and the target application.
4. The method according to claim 3, characterized in that, The process of responding to the loading of the target audio / video playback page in the browser of the terminal, performing public IP address translation (PAT) on the browser's private IP address to obtain the browser's second public IP address, includes: In response to the loading of the target audio and video playback page in the browser of the terminal, an instance of the local real-time communication service is started, and the private network address of the browser is converted to a public network address through the network address switching device through the instance to obtain the second public network address of the browser; The step of responding to a playback request for the target encrypted audio / video in the browser of the terminal, obtaining the local video storage location of the target application, and determining whether the target encrypted audio / video is contained in the local video storage location includes: The local real-time communication service instance responds to the target encrypted audio and video playback request in the terminal's browser, and obtains the local video storage location of the target application through the target application's toolkit. The identifier of the target encrypted audio / video in the playback request is used to determine whether the target encrypted audio / video is contained in the local video storage location.
5. The method according to claim 1, characterized in that, If the target encrypted audio / video is contained in the local video storage location, then the target encrypted audio / video stream in the local video storage location is decrypted and played in the browser through the target data channel between the browser and the target application, including: If the target encrypted audio and video are contained in the local video storage location, then the binary file stream corresponding to the target encrypted audio and video in the local video storage location is obtained through the target data channel between the browser and the target application. The binary file stream is decrypted using the local private key to obtain the decrypted binary file stream; The decrypted binary file stream is converted into a player file object, and the converted player file object is played in the browser.
6. The method according to claim 1, characterized in that, If the target encrypted audio / video is not contained in the local video storage location, then the target encrypted audio / video is downloaded, and the downloaded target encrypted audio / video stream is decrypted and played in the browser, including: If the target encrypted audio and video are contained in the local video storage location, then the target encrypted audio and video are downloaded to obtain the binary file stream corresponding to the downloaded target encrypted audio and video; The binary file stream is decrypted using the local private key to obtain the decrypted binary file stream; The decrypted binary file stream is converted into a player file object, and the converted player file object is played in the browser.
7. The method according to claim 1, characterized in that, The method further includes: In response to an audio / video publishing instruction in the target application, the audio / video file corresponding to the audio / video publishing instruction is encrypted using a preset public key to obtain an encrypted audio / video file; The encrypted audio and video files are stored in the local video storage location and then uploaded to the target server.
8. The method according to claim 1, characterized in that, The target encrypted audio and video are used to indicate files uploaded by the target account logged into the target application on the terminal.
9. An audio / video playback device, characterized in that, The device includes: The file judgment module is used to respond to the playback request of the target encrypted audio and video in the browser of the terminal, obtain the local video storage location of the target application, and determine whether the target encrypted audio and video is contained in the local video storage location, wherein the target application and the browser are on the same terminal. A local playback module is used to, if the target encrypted audio and video is contained in the local video storage location, decrypt and play the target encrypted audio and video stream in the browser through the target data channel between the browser and the target application; wherein, the target data channel is a data transmission channel that penetrates network address translation and is used for peer-to-peer data transmission between the browser and the target application. The download and playback module is used to download the target encrypted audio and video if the local video storage location does not contain the target encrypted audio and video, and then decrypt and play the downloaded target encrypted audio and video stream in the browser.
10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the audio and video playback method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the audio and video playback method according to any one of claims 1-8.
Citation Information
Patent Citations
Browser application and desktop application interaction method and system and storage medium
CN111831368A
Video playing method and video playing device
CN115190319A