Browser position awareness-based playing window automatic adjustment method, system and equipment and medium
By achieving positions in the browser to perceive the method of automatic adjustment of the player window, the resource consumption and user experience problem of playing H.265 RTSP video on the browser, realizing efficient, stable and compatible video decoding and playback effects.
Patent Information
- Application Number
- CN202411535422.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-28
AI Technical Summary
There are challenges in playing H.265-encoded RTSP videos on the browser. Existing solutions usually require server forwarding and transcoding, resulting in high resource consumption and poor user experience, especially under weak network conditions.
By achieving position perception in the browser, the player window can automatically adjust its position and size, call the client hardware resources for H.265 decoding and play RTSP video, without the need for server forwarding and transcoding.
This method reduces the consumption of server resources, improves the real -time and user experience under the conditions of weak networks, can efficiently use system resources, and is compatible with different browsers.
Smart Images

Figure CN119383414A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of video playback control, and in particular relates to a method, system, device and medium for automatically adjusting a playback window based on browser position perception. Background Art
[0002] RTSP (Real Time Streaming Protocol): RTSP is an application layer protocol in the TCP / IP protocol system. This protocol defines how one-to-many applications can effectively transmit multimedia data over an IP network. RTSP is located above RTP and RTCP in terms of architecture, and it uses TCP or UDP to complete data transmission.
[0003] H.265 (HEVC, High Efficiency Video Coding): Also known as H.265 and MPEG-H part 2, is a video compression standard and one of several potential successors to the widely used AVC (H.264 or MPEG-4 Part 10). Compared to AVC, HEVC provides approximately twice the data compression ratio at the same level of video quality, or significantly improves video quality at the same bit rate. It supports resolutions up to 8192×4320, including 8K UHD.
[0004] With the development of network technology, more and more video applications have been widely used on the Internet. Among them, the mainstream RTSP protocol in the video surveillance industry is an excellent video surveillance transmission protocol with high bandwidth efficiency, strong scalability, and support for multiple audio and video protocols. It is widely used by camera manufacturers and has become one of the important technologies in the video field. With the release of new coding standards, H.265 and other efficient video coding standards have the advantages of high definition and high frame rate, making them widely used in various video application scenarios. Decoding H.265 in the browser to play RTSP video has become a challenge.
[0005] However, due to factors such as the H.265 standard and the browser's inability to directly play the RTSP protocol, there are still some challenges in playing camera surveillance videos on the browser. Most solutions use server forwarding transcoding to enable the browser to play camera surveillance videos, and a small number of solutions use the front-end to control the application in real time through messages to control the application display position through real-time messages.
[0006] At present, most software on the market is based on server forwarding transcoding or using wasm software decoding to play H.265 videos. The server forwarding transcoding method will increase the consumption of server bandwidth, CPU and other resources, and increase the playback delay. These methods will greatly occupy bandwidth resources and server computing resources, and the use of software decoding will greatly increase the consumption of browsers and reduce user experience. There are also a small number of software that sets the playback window position and size in real time through the front end. When moving and dragging the mouse on the browser, the front end needs to control the position and size adjustment of the application in real time through messages. Under weak network conditions, real-time performance and user experience are not good. Summary of the invention
[0007] The present invention aims at the deficiencies in the prior art and provides a method, system, device and medium for automatically adjusting the playback window based on browser position perception. The present invention only needs to set the position and size of the player window for the first time through the front end when in use, without the need for server forwarding transcoding, and the player window calls the client hardware resources to perform H.265 decoding, rendering and playing RTSP video. The browser position perception method is used to automatically adjust the position and size of the player window in the browser, and the browser realizes video playback through the player window, which enhances the real-time performance under weak network conditions, does not need to control the player window in real time, improves the user experience, and makes the user unaware.
[0008] To achieve the above object, the present invention adopts the following technical solutions: A method for automatically adjusting a playback window based on browser position awareness comprises the following steps: Enable the message service in the player window, and the browser sends a message to the player window to set the initial position and size of the player window; Registering events in the player window so that the player window can respond to events, including: browser window position and size change events, and mouse wheel sliding events; When a registered event occurs, the position and size of the player window are adaptively adjusted.
[0009] To optimize the above technical solutions, the specific measures taken also include: Furthermore, the event registration in the player window is specifically: Get the current browser process ID, which is used to register events in the player window. The player window registers browser window position and size change events and mouse wheel sliding events through the Window API interface SetWindowsHook.
[0010] Furthermore, when the registered event occurs, the position and size of the player window are adaptively adjusted as follows: The event that occurs is the browser window position and size change event. The player window responds by listening to the event message in the browser process through the callback function, obtaining the browser position and size changes from the callback function, obtaining the current browser position and size in real time, and adaptively adjusting the position and size of the player window.
[0011] Furthermore, when the registered event occurs, the position and size of the player window are adaptively adjusted as follows: Under weak network conditions, record historical mouse scroll values, historical browser items, historical browser types, and historical user habits; The event that occurs is a mouse wheel sliding event, and the player window responds; Calculate the normal mouse scroll value based on historical user habits, current browser project and current browser type, so that the browser's scroll bar is initially scrolled to the target position; Through the mouse scrolling callback function, the actual scrolling value of the mouse is obtained in real time, the movement of the actual scrolling value of the mouse relative to the browser is calculated, and the scroll bar events of the browser are monitored at the same time. The position and size of the browser are obtained and a message is sent to the player window to determine the position and size of the player window, and the position and size of the player window are adaptively adjusted.
[0012] Furthermore, the browser transmits the RTSP video address to the player window through a message, and the player window calls the client hardware resources to perform H.265 decoding and play the RTSP video.
[0013] Furthermore, in the process of monitoring the scroll bar event of the browser, each time the scroll bar scrolls, 12 position and size samples of the browser are collected and transmitted.
[0014] The present invention also proposes a browser position-aware automatic playback window adjustment system, comprising: An initial setting module, used to start a message service in the player window, so that the browser sends a message to the player window, which is used to set the initial position and size of the player window; An event registration module, used to register events in the player window so that the player window can respond to events, including: browser window position and size change events, and mouse wheel sliding events; The adjustment module is used to adaptively adjust the position and size of the player window when a registered event occurs.
[0015] The present invention also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the above-mentioned method for automatically adjusting the playback window based on browser position awareness is implemented.
[0016] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the above-mentioned method for automatically adjusting a playback window based on browser position awareness.
[0017] The beneficial effects of the present invention are: Through the present invention, the browser can seamlessly perform H.265 decoding and play RTSP video, and can also adapt to changes in the browser window size through position perception, so as to play monitoring video in the browser without wasting server resources, reducing the dependence of network speed difference on message real-time performance, and enhancing real-time performance and user experience under weak network conditions.
[0018] This automatic adjustment method of the playback window based on browser location awareness can not only help users to conveniently decode H.265 and play RTSP videos on the browser, but also has the following advantages: 1. Efficiently utilize system hardware resources. The player window calls the client hardware resources to perform H.265 decoding, playback and rendering of RTSP video. Since video decoding and playback are performed through the player window rather than the browser itself, it can effectively utilize system resources, reduce the burden of web pages on the system, and improve the playback experience.
[0019] 2. Good compatibility. This method can be used in different browsers without considering the degree of support for H.265 in different browsers.
[0020] 3. Position perception capability. The position size of the player window is automatically adjusted through the position perception method, and the method of recording the usual mouse scrolling value is used to initially locate the scrolling position when the network is weak. The method of registering a callback function for the playback window to monitor the browser position size changes and the method of registering a callback function to monitor the mouse wheel sliding event and calculate the mouse sliding value are used as secondary points for layout, so as to realize position perception and automatic position adjustment.
[0021] 4. Reduce server resource consumption. This method does not require server forwarding transcoding, which reduces server bandwidth, CPU and other resource consumption.
[0022] 5. Convenient accessibility. This method can be seamlessly integrated into existing web pages without the need for additional plug-ins and components, making it convenient for users to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 The overall architecture of the method for automatically adjusting the playback window based on browser position awareness proposed by the present invention; Figure 2 This is a timing diagram of the method for automatically adjusting the playback window based on browser position awareness proposed by the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] Example 1
[0026] The present invention proposes a method for automatically adjusting a playback window based on browser position awareness. The overall architecture of the method is as follows: Figure 1 As shown in the timing diagram, Figure 2 As shown. The following steps are included: The message service is enabled in the player window. The browser sends a message to the player window to set the initial position and size of the player window. The browser transmits the RTSP video address to the player window through the message. The player window calls the client hardware resources to perform H.265 decoding and play the RTSP video.
[0027] Registering events in the player window enables the player window to respond to events, including: browser window position and size change events, and mouse wheel sliding events; registering events in the player window specifically includes: Get the current browser process ID, which is used to register events in the player window. The player window registers browser window position and size change events and mouse wheel sliding events through the Window API interface SetWindowsHook.
[0028] When a registered event occurs, the position and size of the player window are adaptively adjusted, specifically: The event that occurs is the browser window position and size change event. The player window responds by listening to the event message in the browser process through the callback function, obtaining the browser position and size changes from the callback function, obtaining the current browser position and size in real time, and adaptively adjusting the position and size of the player window.
[0029] Under weak network conditions, record historical mouse scroll values, historical browser items, historical browser types, and historical user habits; The event that occurs is a mouse wheel sliding event, and the player window responds; Calculate the normal mouse scroll value based on historical user habits, current browser project and current browser type, so that the browser's scroll bar is initially scrolled to the target position; Through the callback function of mouse scrolling, the actual scroll value of the mouse is obtained in real time, and the actual scroll value of the mouse is calculated relative to the movement of the browser. At the same time, the scroll bar event of the browser is monitored. During the process of monitoring the scroll bar event of the browser, 12 samples of the position and size of the browser are collected and passed in every time the scroll bar scrolls. The position and size of the browser are obtained and a message is sent to the player window to determine the position and size of the player window, and the position and size of the player window are adjusted adaptively.
[0030] Example 2
[0031] The present invention proposes a browser position-aware automatic playback window adjustment system corresponding to the method of embodiment 1, comprising: An initial setting module, used to start a message service in the player window, so that the browser sends a message to the player window, which is used to set the initial position and size of the player window; An event registration module, used to register events in the player window so that the player window can respond to events, including: browser window position and size change events, and mouse wheel sliding events; The adjustment module is used to adaptively adjust the position and size of the player window when a registered event occurs.
[0032] The implementation methods of each module and module function in the system are completely consistent with the steps of the method in Example 1, so they will not be repeated here.
[0033] Example 3
[0034] The present invention proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for automatically adjusting a playback window based on browser position awareness as in Example 1 is implemented.
[0035] Example 4
[0036] The present invention provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the method for automatically adjusting a playback window based on browser position awareness as described in Example 1.
[0037] Through the above scheme, the present invention realizes the function of decoding H.265 and playing RTSP video stream on the browser using client hardware resources across browsers. The present invention has good compatibility and convenient accessibility. Users can easily decode H.265 and play RTSP video on the browser without real-time control of the player window position. Through position perception, it can adapt to the changes in the size of different browser windows, and enhance the real-time adjustment and user experience under weak network conditions. At the same time, the method can also efficiently utilize system resources and improve the playback experience.
[0038] The present invention solves the challenge of using client hardware resources to decode H.265 and play RTSP videos on a browser, and provides an efficient, stable, and compatible method for decoding H.265 and playing RTSP videos across browsers, which does not occupy server resources and does not require real-time control of the player window, thereby improving effectiveness and user experience under weak network conditions. The position size of the player window is automatically adjusted through a position perception method, and the normal mouse scroll value is recorded. When the network is weak, the scroll position is initially located, and a callback function is registered in the playback window to monitor the browser position size change event, and a callback function is registered to monitor the mouse wheel sliding event, and the mouse sliding value is calculated to achieve position perception automatic adjustment.
[0039] In the embodiments disclosed in the present application, the computer storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. The computer storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of computer storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0040] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0041] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A method for automatically adjusting a playback window based on browser position awareness, characterized in that: The following steps are involved: Enable the message service in the player window, and the browser sends a message to the player window to set the initial position and size of the player window; Registering events in the player window so that the player window can respond to events, including: browser window position and size change events, and mouse wheel sliding events; When a registered event occurs, the position and size of the player window are adaptively adjusted.
2. The method for automatically adjusting the playback window based on browser position awareness according to claim 1, characterized in that: The specific registration event in the player window is: Get the current browser process ID, which is used to register events in the player window. The player window registers browser window position and size change events and mouse wheel sliding events through the Window API interface SetWindowsHook.
3. The method for automatically adjusting the playback window based on browser position awareness according to claim 1, characterized in that: When the registered event occurs, the position and size of the player window are adaptively adjusted as follows: The event that occurs is the browser window position and size change event. The player window responds by listening to the event message in the browser process through the callback function, obtaining the browser position and size changes from the callback function, obtaining the current browser position and size in real time, and adaptively adjusting the position and size of the player window.
4. The method for automatically adjusting the playback window based on browser position awareness according to claim 1, characterized in that: When the registered event occurs, the position and size of the player window are adaptively adjusted as follows: Under weak network conditions, record historical mouse scroll values, historical browser items, historical browser types, and historical user habits; The event that occurs is a mouse wheel sliding event, and the player window responds; Calculate the normal mouse scroll value based on historical user habits, current browser project and current browser type, so that the browser's scroll bar is initially scrolled to the target position; Through the mouse scrolling callback function, the actual scrolling value of the mouse is obtained in real time, the movement of the actual scrolling value of the mouse relative to the browser is calculated, and the scroll bar events of the browser are monitored at the same time. The position and size of the browser are obtained and a message is sent to the player window to determine the position and size of the player window, and the position and size of the player window are adaptively adjusted.
5. The method for automatically adjusting the playback window based on browser position awareness according to claim 1, characterized in that: The browser transmits the RTSP video address to the player window through a message, and the player window calls the client hardware resources to perform H.265 decoding and play the RTSP video.
6. The method for automatically adjusting the playback window based on browser position awareness according to claim 4, characterized in that: When monitoring the browser's scroll bar events, each time the scroll bar scrolls, 12 browser position and size samples are collected and passed in.
7. A system for automatically adjusting a playback window based on browser position awareness, characterized in that: include: An initial setting module, used to start a message service in the player window, so that the browser sends a message to the player window, which is used to set the initial position and size of the player window; An event registration module, used to register events in the player window so that the player window can respond to events, including: browser window position and size change events, and mouse wheel sliding events; The adjustment module is used to adaptively adjust the position and size of the player window when a registered event occurs.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for automatically adjusting the playback window based on browser position awareness as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: The computer program enables the computer to execute the method for automatically adjusting the playback window based on browser position awareness as described in any one of claims 1-6.
Citation Information
Cited By
Cross-browser window adapting and cutting method for Web browser plug-in of domestic system
CN121967792A