A player control method, device, storage medium and electronic device

By creating view containers and list containers in the player, defining listener objects to monitor the offset of list containers, and dynamically adjusting the layout parameters of the view container, the problem that existing players cannot adapt to playback of different video types is solved, and an adaptive video playback experience is achieved.

CN114489875BActive Publication Date: 2025-04-29SHENZHEN QIANCHUANG MICRO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011146839.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-23
Publication Date
2025-04-29
Estimated Expiration
2040-10-23

AI Technical Summary

Technical Problem

The screen of the existing player can only switch between half-screen and horizontal screen modes, and cannot adapt to playback of different video types, resulting in an adaptive video playback experience.

Method used

By creating view containers and list containers, defining listener objects, listening to the current offset of list containers, and dynamically adjusting the layout parameters of the view containers, to achieve adaptive control of the player.

Benefits of technology

It realizes adaptive dynamic control of the player, can be compatible with different types of video playback, and improves the player's adaptability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114489875B_ABST
    Figure CN114489875B_ABST
Patent Text Reader

Abstract

The present invention discloses a player control method, device, electronic device and storage medium. The method includes: calling a container definition function, creating a view container and a list container, creating a memory object based on a memory object creation function, and setting a mapping relationship between the memory object and the view container; obtaining initial layout parameters, and setting parameters for the view container and the list container based on the initial layout parameters; calling a listener definition function, defining a listener object, and setting the memory object to listen to the listener object, wherein the listener object is used to listen to the current offset of the list container; calling a determination function, determining whether the current state spacing of the view container matches the current offset of the list container, and if not, setting the current state spacing of the view container based on the current offset of the list container. Adaptive dynamic control of the player is achieved, and the compatibility of the player is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a player control method, device, storage medium and electronic device. Background Art

[0002] With the continuous development of network technology, various audio and video related players are widely used.

[0003] However, the screens of current players generally only include half screen and horizontal screen, and the screen size is fixed, which cannot adapt to the playback of different video types. Summary of the invention

[0004] The present invention provides a player control method, device, storage medium and electronic equipment to achieve adaptive control of the player.

[0005] In a first aspect, an embodiment of the present invention provides a player control method, including:

[0006] Calling a container definition function to create a view container and a list container, and creating a memory object based on a memory object creation function, and setting a mapping relationship between the memory object and the view container;

[0007] Acquire initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters;

[0008] Calling a listener definition function, defining a listener object, and setting the memory object to monitor the listener object, wherein the listener object is used to monitor the current offset of the list container;

[0009] A determination function is called to determine whether the current state spacing of the view container matches the current offset of the list container; if not, the current state spacing of the view container is set based on the current offset of the list container.

[0010] In a second aspect, an embodiment of the present invention further provides a player control device, including:

[0011] A container creation module, used to call a container definition function to create a view container and a list container, and to create a memory object based on a memory object creation function, and to set a mapping relationship between the memory object and the view container;

[0012] An initial layout parameter setting module, used to obtain initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters;

[0013] A listener setting module, used for calling a listener definition function, defining a listener object, and setting the memory object to monitor the listener object, wherein the listener object is used for monitoring the current offset of the list container;

[0014] A state judgment module, used for calling a judgment function to determine whether the current state spacing of the view container matches the current offset of the list container;

[0015] The view container control module is used to set the current state spacing of the view container based on the current offset of the list container if the current state spacing of the view container does not correspond to the current offset of the list container.

[0016] In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising:

[0017] one or more processors;

[0018] A memory for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the player control method as described in any embodiment of the present invention.

[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the player control method as described in any embodiment of the present invention.

[0021] The embodiment provided by the present invention defines a listener after creating a view container and a list container, so that the memory object associated with the view container listens to the offset of the list container through the listener, and dynamically adjusts the layout parameters of the view container based on the offset, thereby realizing adaptive dynamic control of the player, being compatible with different types of video playback, and improving the adaptability of the player. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A flowchart of a player control method provided in Embodiment 1 of the present invention;

[0023] Figure 2A is a schematic diagram of a player display interface provided by an embodiment of the present invention;

[0024] Figure 2B is a schematic diagram of a player display interface provided by an embodiment of the present invention;

[0025] Figure 3 is a schematic diagram of a player display interface provided by an embodiment of the present invention;

[0026] Figure 4 is a structural schematic diagram of a player control device provided by Embodiment 2 of the present invention;

[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0028] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0029] Embodiment 1

[0030] Figure 1 This is a flowchart of a player control method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of adaptively controlling a player in an Android system. The method can be executed by a player control device provided by the present invention. The device can be implemented in software and / or hardware and is generally integrated in a terminal equipped with a player. Specifically, it includes the following steps:

[0031] S110: Call a container definition function to create a view container and a list container, create a memory object based on a memory object creation function, and set a mapping relationship between the memory object and the view container.

[0032] The player display interface includes a view area and a list area. The view area is used to play video content, and the list area is used to display list information related to the played video content. In this embodiment, by defining a view container and a list container, the view container is set in the view area for playing video content, and the list container is set in the list area for displaying list information related to the video content. In this embodiment, the view container and the list container are arranged vertically or horizontally. For example, see Figure 2A and Figure 2B , Figure 2A and Figure 2B They are schematic diagrams of the player display interface provided by the embodiments of the present invention, wherein: Figure 2A In the display interface, the previous container is the view container, and the next container is the list container. Figure 2B In the display interface, the left container is the view container, and the right container is the list container. It should be noted that Figure 2A and Figure 2BThe sizes of the view container and the list container are only examples. In different embodiments, the sizes of the view container and the list container can be changed according to needs. By creating a view container and a list container respectively, the video content and the list information are displayed respectively, so that the user can browse different display contents in the same display interface.

[0033] Specifically, a variable playerViewContainer of type RelativeLayout may be defined, the variable playerViewContainer is used to represent the container information of the view container, and the variable playerViewContainer is initialized to an empty object of null. For example, the definition function of the view container may be: private var playerViewContainer: RelativeLayout? = null. Similarly, a list container is defined based on the above definition method.

[0034] Call the object creation function findViewById to construct an object with the id mz_player_view_container and assign it to the playerViewContainer object to form a memory object. Set a mapping relationship between the memory object playerViewContainer and the view container. Specifically, the view container can be mapped to the created memory object through the following function:

[0035] playerViewContainer =findViewById(R.id.mz_player_view_container).

[0036] S120: Acquire initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters.

[0037] In this embodiment, the layout parameters of the view container and the list container can be adaptively set according to user needs. When a trigger instruction of the player display interface is detected, the initial layout parameters of the view container and the list container are obtained and set to form the initial display interface of the player. The initial layout parameters may include the screen ratio of the view container and the list container. In the vertical screen display interface (see Figure 2A ), the initial layout parameters can include the height parameters of the view container and the list container, and can also be the height ratio of the view container and the list container. In the horizontal screen display interface (see Figure 2B), the initial layout parameters may include width parameters of the view container and the list container, and may also be the width ratio of the view container and the list container. In some embodiments, the initial layout parameters may be fixed settings, and when a trigger instruction of the player display interface is detected, the fixed initial layout parameters may be called. For example, the initial layout parameters may be that the height ratio of the view container and the list container is 3:1 or 4:1, etc. Exemplarily, obtaining the initial layout parameters may be based on the height acquisition function DYScreenWindowUtils.getScreenHeight(), obtaining the screen height information, and determining the initial height information of the view container and the list container based on the initial screen ratio of the view container and the list container. For example, the height ratio of the view container and the list container is 4:1, and the initial height information initHeight of the view container is 4 / 5 of the screen height information. Correspondingly, for the horizontal screen display interface, the initial width information of the view container and the list container may be determined based on the initial screen ratio of the view container and the list container.

[0038] In some embodiments, it can also be set according to one or more of the relevant information of the video to be played and the screen information of the current playback device. Optionally, obtaining the initial layout parameters includes: obtaining the type of video to be played, wherein the type of video to be played includes horizontal video and vertical video; calling the corresponding initial layout parameters according to the type of video to be played. For horizontal video and vertical video, the video height and video width are different. Accordingly, the initial layout parameters corresponding to the horizontal video and the vertical video in the vertical display mode are pre-set, or the initial layout parameters corresponding to the horizontal video and the vertical video in the horizontal display mode are pre-set. In some embodiments, it can also be determined according to the type of video to be played to display vertical screen or horizontal screen. For example, the horizontal video can be displayed horizontally, and the vertical video can be displayed vertically. Based on the initial layout parameters corresponding to the video type of the video to be played, the view container and the list container are set with targeted parameters, avoiding the situation where the video type does not match the initial layout parameters, and reducing the manual adjustment process of the user. It should be noted that the display screen can also include a display mode conversion control to facilitate the control of the conversion between vertical screen display and horizontal screen display. Currently, the horizontal screen display of the player only includes the full-screen mode, and it is not possible to display list information while displaying the video screen. In this embodiment, by setting the horizontal screen mode in which the view container and the list container are arranged on the left and right, the list content is displayed on the basis of expanding the video screen display size, taking into account the various needs of users.

[0039] In some embodiments, when the screen is displayed in portrait mode, the height of the view container can be determined based on the ratio of the height to the bandwidth of the video to be played and the screen information of the current playback device (such as the screen width). Accordingly, the height of the list container is determined based on the screen height of the current playback device and the height of the view container to form initial layout parameters. The view container and the list container are accurately and adaptively set according to the video to be played to adapt to various types of videos and improve the compatibility of the player.

[0040] In some embodiments, when the screen is displayed in portrait mode, the parameters of the view container and the list container are set based on the initial layout parameters, which may be: calling the height attribute height in the layout parameters layoutParams of the view container to set the height to the initial height information of the view container, and calling the height attribute height in the layout parameters layoutParams of the list container to set the height to the initial height information of the list container. Correspondingly, when the screen is displayed in landscape mode, the width attribute in the layout parameters layoutParams of the view container may be called to set the width to the initial width information of the view container, and the width attribute height in the layout parameters layoutParams of the list container may be called to set the width to the initial width information of the list container.

[0041] S130: Call a listener definition function, define a listener object, and set the memory object to monitor the listener object, wherein the listener object is used to monitor the current offset of the list container.

[0042] In this embodiment, the layout information of the view container and the list container can be dynamically set according to user operations to meet user needs. Specifically, by setting a listener, technical support is provided for the adjustment of the layout parameters of the view container, which facilitates the real-time determination of the layout parameter changes of the view container, so that the memory object corresponding to the view container monitors the layout parameters of the list object in real time. When the layout parameters of the list object change, the layout parameters of the view container are adaptively adjusted to achieve dynamic control of the player.

[0043] Specifically, the listener definition function is called to define the listener object onOffsetChangedListener, and the defined listener object onOffsetChangedListener is initialized as an object of the protocol type DYLayout.OnOffsetChangedListener, wherein the keyword object is set to indicate that the object DYLayout.OnOffsetChangedListener is a protocol type. The callback function of the protocol type DYLayout.OnOffsetChangedListener is overwritten, wherein the callback function includes an offset object verticalOffset whose input parameter is an int type, wherein the offset object verticalOffset is used to mark the current offset of the list container.

[0044] Exemplarily, the definition function of the listener object onOffsetChangedListener may be, for example:

[0045] private var onOffsetChangedListener = object : DYLayout.OnOffsetChangedListener {

[0046] override fun onOffsetChanged(verticalOffset: Int) {

[0047] }

[0048] }

[0049] Call the object listening function in the memory object playerViewContainer, the object listening function is addOffsetListener (onOffsetChangedListener), add the listening of the listener object onOffsetChangedListener in the memory object, and accordingly, the memory object playerViewContainer can listen to the current offset of the list container. Specifically, when the video is displayed, when the list container slides up or down, a height offset is generated. Optionally, the height offset may be generated when an upward or downward sliding gesture is detected in the display screen area corresponding to the list container. Optionally, the height offset may also be generated when an upward sliding gesture or a downward sliding gesture is detected when the dividing line between the list container and the view container is pressed. Correspondingly, when the screen is displayed horizontally, a width offset is generated when the list container slides to the left or accordingly.

[0050] Optionally, the memory object playerViewContainer monitors the current offset of the list container in real time through a listener object, and may also monitor the current offset of the list container when detecting a sliding operation of the list container.

[0051] It should be noted that the current offset can be marked as verticalOffset, which can be a positive value or a negative value, and is determined according to the origin setting position of the screen coordinate system. Taking the vertical screen display as an example, when the origin is set to the upper left corner or the upper right corner of the screen, the current offset verticalOffset generated by the list container sliding upward is a negative value, and when the origin is set to the lower left corner or the lower right corner, the current offset verticalOffset generated by the list container sliding upward is a positive value.

[0052] S140, calling a determination function to determine whether the current state spacing of the view container matches the current offset of the list container. If not, executing step S150, if yes, returning to repeat executing step S140.

[0053] S150: Setting the current state spacing of the view container based on the current offset of the list container.

[0054] Taking the vertical screen display and the origin of the screen coordinate system set at the upper left corner of the screen as an example, the current state spacing of the view container can be the upward spacing, that is, the height of the view container, and the current offset of the list container can be the height coordinate of the upper edge of the list container, which is a negative value. At any time, the current offset of the list container is monitored to determine whether the current state spacing of the view container matches the current offset of the list container. If so, there is no need to adjust the layout parameters of the view container, and it is returned directly through return, and the current offset of the list container is continued to be monitored. If not, the current state spacing of the view container is adjusted in real time according to the current offset of the list container to make the two match.

[0055] For example, the determination function may be If (playerViewContainerParams.topMargin == -verticalOffset) {

[0056] Return

[0057] }

[0058] Correspondingly, taking the horizontal screen display and the origin of the screen coordinate system set at the upper left corner of the screen as an example, see Figure 2B, the current state spacing of the view container can be the left spacing, that is, the width of the view container, and the current offset of the list container can be the width coordinate of the upper edge of the list container, which is a positive value. At any time, the current offset of the list container is monitored to determine whether the current state spacing of the view container matches the current offset of the list container. If so, there is no need to adjust the layout parameters of the view container, and it is directly returned through return, and the current offset of the list container is continued to be monitored. If not, the current state spacing of the view container is adjusted in real time according to the current offset of the list container to make the two match.

[0059] It should be noted that the memory object playerViewContainer is in the RelativeLayout layout, therefore, before calling the judgment function to determine whether the current state spacing of the view container matches the current offset of the list container, it also includes: calling the layout information acquisition function to obtain the layout parameters of the memory object playerViewContainer; converting the layout parameters into an object of the RelativeLayout.LayoutParams type to facilitate the setting of the layout parameters of the memory object playerViewContainer. Specifically, it can be implemented through the following function:

[0060] val playerViewContainerParams = playerViewContainer?.layoutParams asRelativeLayout.LayoutParams

[0061] Correspondingly, the current state spacing of the view container is set based on the current offset of the list container, including: based on the layout parameter setting function, setting the RelativeLayout.LayoutParams object to a positive value corresponding to the current offset, for example, the layout parameter setting function may be playerViewContainerParams.topMargin = -verticalOffset, and accordingly, when the verticalOffset in this application is a positive value, there is no need to add a minus sign before verticalOffset; calling the backfill function to backfill the RelativeLayout.LayoutParams object into the memory object playerViewContainer, specifically, the backfill function may be playerViewContainer?.layoutParams = playerViewContainerParams.

[0062] Optionally, before setting the current state spacing of the view container based on the current offset of the list container, it also includes: determining whether the current offset of the list container exceeds the offset threshold, and if so, calling the target offset to set the current state spacing of the view container. The offset threshold may include a minimum threshold for moving upward, and a maximum threshold for sliding downward. Accordingly, when the current offset of the list container is less than the minimum threshold, or greater than the maximum threshold, the current state spacing of the view container is set based on the target offset (minimum threshold or maximum threshold) to prevent the adjustment process of the list container from affecting the normal playback of the video.

[0063] It should be noted that the view container is used to display the video screen. The size of the video screen can be the same as or different from the size of the view container. When the size of the view container is larger than the size of the video screen, it is displayed at the center of the view container, and its edges are displayed in black. For example, see Figure 3 , Figure 3 Schematic diagram of a player display interface provided by an embodiment of the present invention. When the layout parameters of the view container change, the adjustment can be made by increasing or decreasing the black display area, or by adjusting the size of the video screen in proportion.

[0064] The technical solution of this embodiment defines a listener after creating a view container and a list container, so that the memory object associated with the view container listens to the offset of the list container through the listener, and dynamically adjusts the layout parameters of the view container based on the offset, thereby realizing adaptive dynamic control of the player, being compatible with different types of video playback, and improving the adaptability of the player.

[0065] Embodiment 2

[0066] Figure 4 : is a schematic diagram of the structure of a player control device provided in Embodiment 2 of the present invention, the device comprising:

[0067] The container creation module 210 is used to call the container definition function to create a view container and a list container, and to create a memory object based on the memory object creation function, and to set a mapping relationship between the memory object and the view container;

[0068] An initial layout parameter setting module 220, used to obtain initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters;

[0069] A listener setting module 230 is used to call a listener definition function, define a listener object, and set the memory object to monitor the listener object, wherein the listener object is used to monitor the current offset of the list container;

[0070] The state determination module 240 is used to call a determination function to determine whether the current state spacing of the view container matches the current offset of the list container;

[0071] The view container control module 250 is configured to set the current state spacing of the view container based on the current offset of the list container if the current state spacing of the view container does not correspond to the current offset of the list container.

[0072] Optionally, the initial layout parameter setting module 220 is used to:

[0073] Based on the height acquisition function, screen height information is acquired, and initial height information of the view container and the list container is determined based on the initial screen-occupying ratios of the view container and the list container;

[0074] Call the height attribute height in the layout parameter layoutParams of the view container to set the height to the initial height information.

[0075] Optionally, the listener setting module 230 is used to:

[0076] Calling a listener definition function to define a listener object onOffsetChangedListener, initializing the defined listener object onOffsetChangedListener as an object of the protocol type DYLayout.OnOffsetChangedListener, and overwriting the callback function of the protocol type DYLayout.OnOffsetChangedListener, wherein the callback function includes an offset object verticalOffset whose input parameter is an int type, wherein the offset object verticalOffset is used to mark the current offset of the list container;

[0077] The object listening function in the memory object is called, and the listening of the listener object onOffsetChangedListener is added in the memory object.

[0078] Optionally, the device further comprises:

[0079] The layout parameter type conversion module is used to call the layout information acquisition function to obtain the layout parameters of the memory object playerViewContainer before calling the judgment function to determine whether the current state spacing of the view container matches the current offset of the list container, and convert the layout parameters into an object of the RelativeLayout.LayoutParams type.

[0080] Optionally, the view container control module 250 is used to:

[0081] Based on the layout parameter setting function, setting the RelativeLayout.LayoutParams object to a positive value corresponding to the current offset;

[0082] Call the backfill function to backfill the RelativeLayout.LayoutParams object into the memory object playerViewContainer.

[0083] Optionally, the device further comprises:

[0084] The offset threshold judgment module is used to judge whether the current offset of the list container exceeds the offset threshold before setting the current state spacing of the view container based on the current offset of the list container. If so, call the target offset to set the current state spacing of the view container.

[0085] Optionally, the initial layout parameter setting module 220 is used to:

[0086] Obtaining the type of the video to be played, wherein the type of the video to be played includes horizontal screen video and vertical screen video;

[0087] The corresponding initial layout parameters are called according to the type of the video to be played.

[0088] The above-mentioned product can execute the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0089] Embodiment 3

[0090] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Figure 5 A block diagram of an electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 5 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The device 12 is typically an electronic device that undertakes the image classification function.

[0091] like Figure 5 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors 16, a storage device 28, and a bus 18 connecting various system components (including the storage device 28 and the processor 16).

[0092] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

[0093] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0094] The storage device 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (such as a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (such as a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) can be provided. In these cases, each drive can be connected to the bus 18 through one or more data medium interfaces. The storage device 28 may include at least one program product, which has a set (for example, at least one) of program modules, which are configured to perform the functions of various embodiments of the present invention.

[0095] A program 36 having a set (at least one) of program modules 26 may be stored, for example, in a storage device 28, such program modules 26 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. The program modules 26 generally perform the functions and / or methods of the embodiments described herein.

[0096] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, cameras, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs) and / or public networks, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (RAID) systems, tape drives, and data backup storage systems.

[0097] The processor 16 executes various functional applications and data processing by running the programs stored in the storage device 28, such as implementing the player control method provided in the above embodiment of the present invention.

[0098] Embodiment 4

[0099] This embodiment provides a storage medium containing computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to perform relevant operations in the player control method provided by any embodiment of the present invention.

[0100] Through the above description of the implementation method, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the player control method described in each embodiment of the present invention.

[0101] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A player control method, characterized in that: include: Calling a container definition function to create a view container and a list container, and creating a memory object based on a memory object creation function, and setting a mapping relationship between the memory object and the view container; Acquire initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters; Calling a listener definition function to define a listener object, and setting the memory object to listen to the listener object, wherein the listener object is used to monitor the current offset of the list container, and the offset is the height offset generated when an upward or downward sliding gesture is detected in the display screen area corresponding to the list container; Call the layout information acquisition function to obtain the layout parameters of the memory object playerViewContainer; Convert the layout parameters into an object of RelativeLayout.LayoutParams type; Calling a determination function to determine whether the current state spacing of the view container matches the current offset of the list container, and if not, setting the current state spacing of the view container based on the current offset of the list container; The step of setting the current state spacing of the view container based on the current offset of the list container includes: Based on the layout parameter setting function, setting the RelativeLayout.LayoutParams object to a positive value corresponding to the current offset; Call the backfill function to backfill the RelativeLayout.LayoutParams object into the memory object playerViewContainer; The obtaining of initial layout parameters includes: Obtaining the type of the video to be played, wherein the type of the video to be played includes horizontal screen video and vertical screen video; The corresponding initial layout parameters are called according to the type of the video to be played.

2. The method according to claim 1, characterized in that: The acquiring initial layout parameters and setting parameters of the view container and the list container based on the initial layout parameters includes: Based on the height acquisition function, screen height information is acquired, and initial height information of the view container and the list container is determined based on the initial screen-occupying ratios of the view container and the list container; Call the height attribute height in the layout parameter layoutParams of the view container to set the height to the initial height information.

3. The method according to claim 1, characterized in that The calling of the listener definition function, defining a listener object, and setting the memory object to monitor the listener object include: Calling a listener definition function to define a listener object onOffsetChangedListener, initializing the defined listener object onOffsetChangedListener as an object of the protocol type DYLayout.OnOffsetChangedListener, and overwriting the callback function of the protocol type DYLayout.OnOffsetChangedListener, wherein the callback function includes an offset object verticalOffset whose input parameter is an int type, wherein the offset object verticalOffset is used to mark the current offset of the list container; The object listening function in the memory object is called, and the listening of the listener object onOffsetChangedListener is added in the memory object.

4. The method according to claim 1, characterized in that: Before setting the current state spacing of the view container based on the current offset of the list container, the method further includes: It is determined whether the current offset of the list container exceeds the offset threshold. If so, the target offset is called to set the current state spacing of the view container.

5. A player control device, characterized in that: include: A container creation module, used to call a container definition function to create a view container and a list container, and to create a memory object based on a memory object creation function, and to set a mapping relationship between the memory object and the view container; An initial layout parameter setting module, used to obtain initial layout parameters, and set parameters for the view container and the list container based on the initial layout parameters; A listener setting module, used to call a listener definition function, define a listener object, and set the memory object to listen to the listener object, wherein the listener object is used to monitor the current offset of the list container, and the offset is the height offset generated when an upward or downward sliding gesture is detected in the display screen area corresponding to the list container; The layout parameter type conversion module is used to call the layout information acquisition function to obtain the layout parameters of the memory object playerViewContainer; Convert the layout parameters into an object of RelativeLayout.LayoutParams type; A state judgment module, used for calling a judgment function to determine whether the current state spacing of the view container matches the current offset of the list container; A view container control module, configured to set the current state spacing of the view container based on the current offset of the list container if the current state spacing of the view container does not correspond to the current offset of the list container; The view container control module is specifically used for: Based on the layout parameter setting function, setting the RelativeLayout.LayoutParams object to a positive value corresponding to the current offset; Call the backfill function to backfill the RelativeLayout.LayoutParams object into the memory object playerViewContainer; The initial layout parameter setting module is specifically used for: Obtaining the type of the video to be played, wherein the type of the video to be played includes horizontal screen video and vertical screen video; The corresponding initial layout parameters are called according to the type of the video to be played.

6. A computer device, characterized in that: The computer device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the player control method as described in any one of claims 1-4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the player control method as described in any one of claims 1-4 is implemented.

Citation Information

Patent Citations

  • Video adaptive playing method and device and storage medium

    CN109151504A

  • Page display position jumping method and device, terminal equipment and storage medium

    CN109582893A