CN116506695B - Video stream playing method and device - Google Patents
Video stream playing method and device Download PDFInfo
- Publication number
- CN116506695B CN116506695B CN202310756697.4A CN202310756697A CN116506695B CN 116506695 B CN116506695 B CN 116506695B CN 202310756697 A CN202310756697 A CN 202310756697A CN 116506695 B CN116506695 B CN 116506695B
- Authority
- CN
- China
- Prior art keywords
- video
- video stream
- playing
- page
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 93
- 230000006870 function Effects 0.000 description 14
- 230000008569 process Effects 0.000 description 10
- 238000012544 monitoring process Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000009877 rendering Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/482—End-user interface for program selection
- H04N21/4825—End-user interface for program selection using a list of items to be played back in a given order, e.g. playlists
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/485—End-user interface for client configuration
- H04N21/4858—End-user interface for client configuration for modifying screen layout parameters, e.g. fonts, size of the windows
Landscapes
- Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Indexing, Searching, Synchronizing, And The Amount Of Synchronization Travel Of Record Carriers (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
The invention provides a video stream playing method and a device, which relate to the technical field of automatic video stream playing, and the method comprises the following steps: when the video stream playing page is visible or the video stream list stops sliding, determining a target video in the video stream list, and controlling the target video to play; when the first video is played, controlling the next video of the first video to slide so that the next video slides into a video stream playing page; the first video is any video in a video stream playing page. The invention can realize the automatic playing of the video stream, and avoid frequent manual operation of the user, and further, the invention can improve the video playing efficiency and the user experience.
Description
Technical Field
The invention relates to the technical field of automatic video stream playing, in particular to a video stream playing method and device.
Background
After the layout and rendering of the recurvview list, the user can see the recurvview list data, and when the Android platform performs the rendering of the recurvview list, different types of items need to be defined for displaying, and the video stream is one of the items.
Currently, a start/pause play button is provided on an Item of each video type in a video stream list page, and a user can start playing a certain video by clicking the start/pause play button on the video, and can pause playing the video by clicking the start/pause play button on the video again.
However, the above technical solution requires frequent manual operations by the user, so that the above technical solution has problems of low video playing efficiency and poor user experience.
Disclosure of Invention
The invention provides a video stream playing method and device for solving the technical problems of low video playing efficiency and poor user experience in the prior art.
The technical scheme of the invention is as follows:
the invention provides a video stream playing method, which comprises the following steps:
when a video stream playing page is visible or a video stream list stops sliding, determining a target video in the video stream list, and controlling the target video to play;
when the first video playing is finished, controlling the next video of the first video to slide so that the next video slides into a video stream playing page; the first video is any video in a video stream playing page.
Optionally, determining the target video in the video stream list specifically includes:
determining a target video in a video stream list by using a reference line method and/or a list direction method;
the method for determining the target video in the video stream list by using the reference line method specifically comprises the following steps:
for a visible area of each video in a video stream playing page, acquiring a first distance between an upper boundary of the visible area and an upper boundary of the video stream playing page and a second distance between a lower boundary of the visible area and the upper boundary;
calculating the absolute value of the difference between the first distance and the line width of a preset reference line to obtain a first calculated value; the preset reference line is a line segment connecting the left boundary and the right boundary of the video stream playing page in the video stream playing page; the difference value between the line width of the preset reference line and the height value of the player container of the video is within a preset difference value range;
calculating the absolute value of the difference between the second distance and the line width of the preset reference line to obtain a second calculated value;
taking the minimum value of the first calculated value and the second calculated value as a target calculated value of the video corresponding to the visible region;
Determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page; the visible area occupation ratio is the ratio between the area of the visible area and the area of the corresponding video;
the method for determining the target video in the video stream list by using the list direction comprises the following steps:
traversing each video in the video stream playing page along the preset list direction, and determining the video as the target video when traversing to the video with the visible area occupation ratio meeting the preset visible area occupation ratio requirement.
Optionally, the line width of the preset reference line is equal to the height value of the player container of the video.
Optionally, determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page, which specifically includes:
and traversing each video in the video stream playing page in sequence from small to large according to the target calculated value, and determining the video as the target video when traversing the video with the visible area ratio meeting the preset visible area ratio requirement.
Optionally, before determining the target video in the video stream list by using the reference line method and/or the list direction method, the method of the present invention further includes:
judging whether a video played under a full screen exists in a video stream playing page or not, and obtaining a first judging result;
if the first judging result indicates that the video which is played in the full screen exists in the video stream playing page, determining that the video is the target video;
if the first judgment result indicates that the video which is played under the full screen does not exist in the video stream playing page, judging whether a second video which is playing or pausing playing exists in the video stream playing page, and obtaining a second judgment result;
if the second judging result indicates that the second video which is being played or paused in the video stream playing page does not exist, determining a target video in a video stream list by using a reference line method and/or a list direction method;
if the second judging result indicates that a second video which is playing or pausing playing exists in the video stream playing page, judging whether the visible area occupation ratio of a player container of the second video meets the preset visible area occupation ratio requirement or not, and obtaining a fourth judging result;
If the fourth judgment result indicates that the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, determining that the second video is the target video;
and if the fourth judging result shows that the visible area ratio of the player container of the second video does not meet the preset visible area ratio requirement, determining the target video in the video stream list by using a reference line method and/or a list direction method.
Optionally, when the playing of the first video is finished, controlling the next video of the first video to slide specifically includes:
when the first video playing is finished, subtracting the fourth distance from the difference between the third distance and the preset value to obtain a sliding distance; the third distance is the distance between the lower boundary of the first video and the upper boundary of the video stream playing page; the fourth distance is the distance between any two videos;
and controlling the next video of the first video to slide according to the sliding distance.
Optionally, the method of the present invention further comprises:
and stopping playing the video when the video stream playing page is invisible.
Optionally, the method of the present invention further comprises:
Judging whether the video stream playing page accords with a preset automatic video playing condition or not;
if the video stream playing page accords with the preset automatic video playing condition, the method is executed.
Optionally, when the video stream list control recuorview is not empty, the automatic video playing function of the video stream playing page is in an open state, the video stream playing page is in a resumed state, and the video stream playing page does not display dialogs, determining that the video stream playing page meets the preset automatic video playing condition.
The invention also provides a video stream playing device, which comprises:
the video stream playing module is used for searching a target video, and when a video stream playing page is visible or a video stream list stops sliding, determining the target video in the video stream list and controlling the target video to play;
the sliding module is used for controlling the next video of the first video to slide when the first video is played, so that the next video slides into a video stream playing page; the first video is any video in a video stream playing page.
The invention adopts the technical scheme and has the following beneficial effects:
And when the video stream playing page is visible or the video stream list stops sliding, determining a target video in the video stream list, and controlling the target video to play. Therefore, the invention can realize automatic video playing when the video stream playing page is visible or the video stream list stops sliding. When the first video is played, controlling the next video of the first video to slide so that the next video slides into a video stream playing page; and when the next video sliding is stopped (namely, when the video stream list stops sliding), determining a target video in the video stream list, and controlling the target video to play. Therefore, the invention can also realize automatic playing of the next video after the current video is played. Therefore, the invention can realize the automatic playing of the video stream, and avoid frequent manual operation of the user, and further, the invention can improve the video playing efficiency and the user experience.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a video stream playing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a relationship between a video stream playing page and a video stream list according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a datum line method according to an embodiment of the present invention;
fig. 4 is a flowchart of another video stream playing method according to an embodiment of the present invention;
fig. 5 is a flowchart of another video stream playing method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a video stream playing device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
After the layout and rendering of the recurvview list, the user can see the recurvview list data, and when the Android platform performs the rendering of the recurvview list, different types of items need to be defined for displaying, and the video stream is one of the items.
Currently, a start/pause play button is provided on an Item of each video type in a video stream list page, and a user can start playing a certain video by clicking the start/pause play button on the video, and can pause playing the video by clicking the start/pause play button on the video again.
However, the above technical solution requires frequent manual operations by the user, so that the above technical solution has problems of low video playing efficiency and poor user experience.
In order to solve the technical problems, the invention provides a video stream playing method and a video stream playing device. The technical scheme of the invention is described in detail below with reference to the accompanying drawings.
Fig. 1 is a flow chart of a video stream playing method according to an embodiment of the present invention. As shown in fig. 1, the present process includes:
step 101: acquiring video stream playing page data; the video stream play page data includes at least one of video stream play page visible status data, video stream list sliding status data, and play status data of video in the video stream play page.
Fig. 2 is a schematic diagram of a relationship between a video stream playing page and a video stream list according to an embodiment of the present invention. As shown in fig. 2, the video stream list 22 includes a plurality of videos 211, and the plurality of videos 211 in the video stream list 22 are located in the video stream playing page 21.
In the embodiment of the present disclosure, when a user opens an APP (mobile APP) corresponding to a video stream playing page and enters the video stream playing page, visible status data of the video stream playing page may be obtained. And when the user controls the sliding of the video stream list by operating the terminal where the APP is located, the video stream list sliding state data can be obtained. And when the video being played exists in the video stream playing page, the playing state data of the video in the video stream playing page can be obtained.
Step 102: and when the video stream playing page is determined to be visible through the video stream playing page data or the video stream list stops sliding, determining a target video in the video stream list and controlling the target video to play. When the first video playing is finished according to the video stream playing page data, controlling the next video of the first video to slide so that the next video slides into the video stream playing page; the first video is any video in a video stream playing page.
In the embodiment of the present disclosure, an automatic play policy sub-class when a page is visible and an automatic play policy sub-class when a list stops sliding are preset. When the video stream playing page is determined to be visible, triggering an automatic playing strategy subclass when the page is visible; when the video stream list is monitored to slide, if the video stream list stops sliding, triggering the list to stop sliding, and automatically playing the strategy subclass. The method for controlling the video stream to be automatically played is the same as the method for controlling the video stream to be automatically played by the automatic playing strategy subclass when the page is visible and the automatic playing strategy subclass when the list stops sliding, and when any one of the two strategy subclasses is triggered, the target video is determined in the video stream list, and the target video is controlled to be played.
From the foregoing, it can be seen that by the auto-play policy subclass when the page is visible and the auto-play policy subclass when the list stops sliding, both policy subclasses can automatically play a certain video (the first video) when the video stream is playing the page or when the video stream list stops sliding. In order to further increase the automation degree of video stream playing, when the first video playing is finished, another video needs to be automatically played. Therefore, in the embodiment of the present specification, an automatic multicast policy subclass is also preset. When the video stream playing page is playing the first video, triggering an automatic continuous playing strategy subclass if the first video is played. After the automatic continuous playing strategy subclass is triggered, the next video of the first video is slid into the video stream playing page (at the moment, the video stream list is also slid), when the next video is stopped in sliding, the automatic playing strategy subclass is triggered to stop sliding, and the target video starts to be searched and played in the video stream list, so that when the first video is played, another video is automatically played.
By adopting the technical scheme, when the video stream playing page is visible or the video stream list stops sliding, the target video is determined in the video stream list, and the target video is controlled to be played; and when the first video playing is finished, controlling the next video of the first video to slide so as to slide the next video into the video stream playing page. Therefore, the embodiment of the invention can automatically play the video in the video stream list when the video stream playing page is visible or the video stream list stops sliding, and automatically continuously play another video when the video playing is finished, so that the embodiment of the invention can realize the automatic playing of the video stream, avoid the frequent manual operation of a user, and further improve the video playing efficiency and the user experience.
In the embodiment of the present disclosure, determining the target video in the video stream list may specifically include:
and determining the target video in the video stream list by using a datum line method and/or a list direction method.
The determining, by using the reference line method, the target video in the video stream list may specifically include:
(1) And acquiring a first distance between the upper boundary of the visible region and the upper boundary of the video stream playing page and a second distance between the lower boundary of the visible region and the upper boundary of the video stream playing page for each visible region of the video stream playing page.
In a specific example, fig. 3 is a schematic diagram of a datum method according to an embodiment of the present invention. Referring to fig. 3, the visible region of the video is an implementation frame region of the video, for example, the visible region of video 1 is region 311 and the visible region of video 3 is region 312. The upper boundary of the visible region 311 of video 1 coincides with the upper boundary 31 of the video stream play page, and thus the first distance of the visible region 311 of video 1 is 0. The second distance of the visible region 311 of video 1 is equal to the distance between the lower boundary and the upper boundary 31 of the visible region 311. Other videos are similar.
In this embodiment of the present disclosure, the coordinate data of the visible area of each video in the video stream playing page may be first acquired, and the coordinate data may be stored in an array visibleRect in the format of visibleRect [ first distance, second distance ]. In this embodiment of the present disclosure, the array visibleRect may further include a third distance and a fourth distance, where the third distance is a distance between a left boundary of the corresponding visible area and a left boundary of the video stream playing page, and the fourth distance is a distance between a right boundary of the corresponding visible area and a left boundary of the video stream playing page.
(2) Calculating the absolute value of the difference value between the first distance and the line width of the preset reference line to obtain a first calculated value; the preset datum line is a line segment connecting the left boundary and the right boundary of the video stream playing page in the video stream playing page; the difference between the line width of the preset reference line and the height value of the player container of the video is within the preset difference range.
It is easily understood by those skilled in the art that each video corresponds to a player container, and the height value of the player container of each video is the same. Referring to fig. 3, the preset reference line 32 is a line segment connecting the left and right boundaries of the video stream playing page in the video stream playing page, the line width of the preset reference line 32 may be equal to the height value of the player container, and the line width of the preset reference line 32 may also be approximately equal to the height value of the player container, where the preset difference range may be set by a person skilled in the art according to actual needs.
In the scenario that the line width of the preset reference line 32 is equal to the height value of the player container, the specific process of obtaining the line width of the preset reference line includes: first, a fifth distance between a left boundary of a player container of the video and a left boundary of a play page of the video stream is obtained, and a sixth distance between a right boundary of the player container of the video and a right boundary of the play page of the video stream is obtained. Then, the width of the video stream play page (i.e., the length of the upper boundary 31) is subtracted from the sum of the fifth distance and the sixth distance to obtain the width of the player container of the video. And finally, dividing the width of the player container of the video by the preset aspect ratio of the player container to obtain the line width of the preset reference line.
In this embodiment of the present disclosure, the preset reference line 32 may specifically be a line segment in the video stream playing page, which connects the midpoints of the left and right boundaries of the video stream playing page.
(3) And calculating the absolute value of the difference between the second distance and the line width of the preset reference line to obtain a second calculated value.
(4) And taking the minimum value of the first calculated value and the second calculated value as a target calculated value of the video corresponding to the visible region.
In the embodiment of the present disclosure, for each video, the target calculation value distanceToBaseLine and the index of the video are saved to the object baselinelayweight model in the format of baselinelayweight model. Then, the object BaseLineLayWeightModel of each video is saved into an array weight List.
(5) Determining target videos in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page; the visible region duty cycle is the ratio between the area of the visible region and the area of the corresponding video.
In this embodiment of the present disclosure, determining, according to a target calculated value and a visible area ratio of each video in a video stream playing page, a target video in each video in the video stream playing page may specifically include:
and traversing each video in the video stream playing page in sequence according to the target calculated value from small to large, and determining the video as a target video when traversing to the video with the visible area ratio meeting the requirement of the preset visible area ratio.
Specifically, in the above example, after the array weight list is obtained, the elements in the array weight list are ordered according to the order of the target calculation value distanceToBaseLine from small to large, and the arrangement order of the elements is assumed to be baselineplayweight model 2, baselineplayweight model 1, and baselineplayweight model 3. Then, the element BaseLineLayWeightModel 2 ranked first is taken out, video 2 is determined according to the index in BaseLineLayWeightModel 2, if the visible area ratio of video 2 meets the preset visible area ratio requirement, video 2 is determined to be a target video, if the visible area ratio of video 2 does not meet the preset visible area ratio requirement, element BaseLineLayWeightModel 1 is taken out, video 1 is determined according to the index in BaseLineLayWeightModel 1, if the visible area ratio of video 1 meets the preset visible area ratio requirement, video 1 is determined to be a target video, if the visible area ratio of video 1 does not meet the preset visible area ratio requirement, element BaseLayWeightModel 3 is taken out, video 3 is determined according to the index in BaseLineLayWeightModel 3, and if the visible area ratio of video 3 meets the preset visible area ratio requirement, video 3 is determined to be a target video 3.
In this embodiment of the present disclosure, the preset visible area ratio requirement may be set by a person skilled in the art according to actual needs, for example, when the vertical video exposure ratio is set to be greater than 20%, the preset visible area ratio requirement is satisfied, and when the horizontal video exposure ratio is set to be greater than 30%, the preset visible area ratio requirement is satisfied.
The method for determining the target video in the video stream list by using the list direction specifically can comprise the following steps:
traversing each video in the video stream playing page along the preset list direction, and determining the video as a target video when traversing to the video with the visible area occupation ratio meeting the preset visible area occupation ratio requirement.
In the embodiment of the present disclosure, when the video stream playing page is visible, the preset list direction may be a direction from top to bottom (from an upper boundary of the video stream playing page to a lower boundary of the video stream playing page); when the video stream list stops sliding, the preset list direction needs to be the same as the sliding direction of the video stream list, namely, when the video stream list slides upwards, the preset list direction is from bottom to top (from the lower boundary of the video stream playing page to the upper boundary of the video stream playing page), and when the video stream list slides downwards, the preset list direction is from top to bottom.
In a specific example, first, each visible item in a video stream playing page is traversed along a preset list direction, during the traversing, the traversed video, and the visible area ratio of the video are saved into an object playweight model in the format of playweight model (index, visible area ratio), and the playweight model of the video is saved into an array weight list. Therefore, the arrangement order of the playweight model of each video in the array weight list is the same as the arrangement order of the playweight model of each video in the video stream play page along the preset list direction. Then, traversing the array weight list according to the arrangement sequence of the PlayWeightModels of each video in the array weight list, returning to the PlayWeightModel when traversing to the PlayWeightModel with the visible area ratio meeting the preset visible area ratio requirement, and determining the corresponding video according to the index in the PlayWeightModel, wherein the video is the target video.
In the embodiment of the invention, since the method for controlling the automatic playing of the video stream is the same for the automatic playing policy subclass when the page is visible and the automatic playing policy subclass when the list stops sliding, the specific flow of the method for controlling the automatic playing of the video stream for the automatic playing policy subclass when the page is visible and the automatic playing policy subclass when the list stops sliding is described below by taking the automatic playing policy subclass when the page is visible as an example:
Fig. 4 is a flowchart of another video stream playing method according to an embodiment of the present invention. As shown in fig. 4, the present process includes:
step 401: judging whether the video played under the full screen exists in the video stream playing page or not, obtaining a first judging result, if the first judging result is yes, executing step 402, otherwise, executing step 403.
In the embodiment of the invention, when executing the autoPlay () function of the auto play strategy subclass when the page is visible, firstly, judging whether a video played under the full screen exists in the video stream play page or not through the resumeurentholder () function. It should be noted that, the video played in full screen will be played in the corresponding full screen player container.
Step 402: and determining the video played under the full screen in the video stream playing page as a target video.
Step 403: judging whether a second video which is playing or pausing playing exists in the video stream playing page, obtaining a second judging result, if the second judging result is yes, executing step 405, otherwise, executing step 404.
In the embodiment of the invention, when the video which is played under the full screen does not exist in the video stream playing page, whether the second video which is playing or pausing playing exists in the video stream playing page can be judged through the resumeurentholder () function.
Step 404: and determining the target video in the video stream list by using a datum line method and/or a list direction method.
In the embodiment of the invention, the target video is determined in the video stream list by executing the startNewPlay () function by using the datum line method and/or the list direction method.
Step 405: judging whether the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, obtaining a fourth judging result, if yes, executing step 406, otherwise, executing step 404.
In the embodiment of the invention, when a second video which is playing or pausing playing exists in a video stream playing page, judging whether the visible area occupation ratio of a player container of the second video meets the preset visible area occupation ratio requirement or not through a resumeurentholder () function.
Step 406: and determining the second video as the target video.
In the embodiment of the invention, when the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, the second video is determined to be the target video, so that the second video is automatically played.
In the embodiment of the present invention, when the playing of the first video is finished, the sliding of the next video of the first video is controlled, which may specifically include:
When the first video playing is finished, subtracting the fourth distance from the difference between the third distance and the preset value to obtain a sliding distance; the third distance is the distance between the lower boundary of the first video and the upper boundary of the video stream playing page; the fourth distance is the distance between any two videos; then, the next video of the first video is controlled to slide according to the sliding distance.
Specifically, when the playing of the first video is finished, the index of the next video of the first video is obtained, the sliding distance is calculated, and then the video stream list is controlled to slide the sliding distance, so that the list control RecycleView slides to the index of the next video of the first video. When the sliding of the video stream list is stopped, triggering the automatic playing strategy subclass when the sliding of the list is stopped, further determining a new target video in the video stream list, and automatically playing the new target video. In this way, the embodiment can realize automatic continuous video playing, and the next video of the first video is controlled to slide according to the sliding distance, so that the embodiment can prevent the video to be played from sliding out of the video stream playing page to a certain extent.
Before executing the automatic playing policy class (including the automatic playing policy subclass when the page is visible, the automatic playing policy subclass when the list stops sliding and the automatic continuous playing policy subclass) of the present application, the method of the embodiment of the present application may further include:
Judging whether the video stream playing page accords with the preset automatic playing video conditions, and executing the automatic playing strategy class if the video stream playing page accords with the preset automatic playing video conditions.
In the embodiment of the present disclosure, when the video stream list control recurview is not empty, the automatic video playing function of the video stream playing page is in an open state, the video stream playing page is in a resumed state, and no dialogs are displayed in the video stream playing page, it is determined that the video stream playing page meets the preset automatic video playing condition.
In a specific example, fig. 5 is a schematic flow chart of another video stream playing method according to an embodiment of the present invention. As shown in fig. 5, the present process includes:
step 501: initializing a video stream automatic playing controller in a video stream playing page.
Specifically, a universal video stream automatic playing controller is created in the video stream playing page. In the process of initializing the video stream automatic playing controller, lifecycleOwner, recyclerView and FromType are transmitted into the video stream automatic playing controller, wherein the LifeCycleOwner is a class with an Android life cycle and can be used for realizing the management of the life cycle of a video stream playing page; the RecyclerView is used for acquiring the items in the video stream list, setting sliding monitoring on the video stream list and the like; the from type is used for judging whether the corresponding video is of an automatic playing type, and if the video is of the automatic playing type, the video can be automatically played. In addition, some ViewModel and streamautoplay hander are initialized, where some information is stored in the ViewModel, such as whether a frame or a start-up advertisement is being shown in a video stream playing page, whether the current page is an APP start-up page, and the LiveData in the ViewModel may also be used for monitoring the pop-up of the frame, monitoring the life cycle of the video stream playing page, etc. The automatic play policy class described above is stored in the streamautoplay handler.
And in the process of initializing the video stream automatic playing controller, registering scrolling monitoring and layout change monitoring for the RecyclerView, registering a dialogtask stack and APP starting page monitoring.
In the embodiment of the present disclosure, after the process of initializing the video stream autoplay controller is completed, a video stream list is rendered, and after the video stream list is rendered, an autoplay function startAutoPlay () in the video stream autoplay controller is executed, where the autoplay function startAutoPlay () performs the following determination in steps 502 to 507.
Step 502: judging whether the video stream list control RecyclerView is empty, if so, executing step 503, otherwise, executing step 504.
Step 503: the present flow is ended.
Step 504: judging whether the automatic video playing function of the video stream playing page is in an open state, if so, executing step 505, otherwise, executing step 503.
In the embodiment of the present disclosure, an automatic video playing function may be set in the video stream playing page, and only when the automatic video playing function is in an open state, the video in the video stream playing page may be automatically played. It should be noted that, in the embodiment of the present specification, the video stream playing page refers to the page that the APP is showing, that is, the current page of the APP.
Step 505: judging whether the video stream playing page is in a resumed state, if so, executing step 506, otherwise, executing step 503.
In the embodiment of the present disclosure, the life cycle of the video stream playing page is managed by the LifecycleOwner of the video stream playing page, and step 506 is performed when the video stream playing page is in the reserved state.
Step 506: judging whether the video stream playing page displays dialogs or not, if yes, executing step 503, otherwise, executing step 507.
Step 507: judging whether the video stream playing page is an APP starting page, if so, executing step 503, otherwise, executing step 508.
In the embodiment of the specification, the APP start page is often provided with a screen-start advertisement, and the screen-start advertisement can shield a video, so that when the video stream play page is the APP start page, automatic play of the video stream is not performed.
Step 508: and executing the automatic playing strategy class.
The method of the embodiment of the invention can further comprise the following steps:
when the video stream playing page is invisible, stopping playing the video, and removing the relevant monitoring so as to prevent the memory from leaking.
Based on a general inventive concept, the invention also provides a video stream playing device. Fig. 6 is a schematic structural diagram of a video stream playing device according to an embodiment of the present invention. As shown in fig. 6, the present apparatus includes:
The search play target video module 61 is configured to determine a target video in the video stream list when a video stream play page is visible or when the video stream list stops sliding, and control the target video to play.
The sliding module 62 is configured to control a next video of the first video to slide when the playing of the first video is finished, so that the next video slides into the video stream playing page; the first video is any video in a video stream playing page.
Optionally, the play target video module 61 is specifically configured to:
and determining the target video in the video stream list by using a datum line method and/or a list direction method.
The determining, by using the reference line method, the target video in the video stream list may specifically include:
(1) And acquiring a first distance between the upper boundary of the visible region and the upper boundary of the video stream playing page and a second distance between the lower boundary of the visible region and the upper boundary of each video in the video stream playing page.
(2) Calculating the absolute value of the difference value between the first distance and the line width of a preset reference line to obtain a first calculated value; the preset reference line is a line segment connecting the left boundary and the right boundary of the video stream playing page in the video stream playing page; the difference between the line width of the preset reference line and the height value of the player container of the video is within the preset difference range.
(3) And calculating the absolute value of the difference between the second distance and the line width of the preset reference line to obtain a second calculated value.
(4) And taking the minimum value of the first calculated value and the second calculated value as a target calculated value of the video corresponding to the visible region.
(5) Determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page; the visible region duty ratio is the ratio between the area of the visible region and the area of the corresponding video.
The method for determining the target video in the video stream list by using the list direction specifically can comprise the following steps:
traversing each video in the video stream playing page along the preset list direction, and determining the video as the target video when traversing to the video with the visible area occupation ratio meeting the preset visible area occupation ratio requirement.
Optionally, the line width of the preset reference line is equal to the height value of the player container of the video.
Optionally, determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page may specifically include:
And traversing each video in the video stream playing page in sequence from small to large according to the target calculated value, and determining the video as the target video when traversing the video with the visible area ratio meeting the preset visible area ratio requirement.
Optionally, the apparatus of the embodiment of the present disclosure may further include a first judging module, configured to:
judging whether the video played under the full screen exists in the video stream playing page or not, and obtaining a first judging result.
And if the first judging result indicates that the video which is played in the full screen exists in the video stream playing page, determining that the video is the target video.
And if the first judgment result indicates that the video which is played under the full screen does not exist in the video stream playing page, judging whether a second video which is playing or pausing playing exists in the video stream playing page, and obtaining a second judgment result.
And if the second judging result indicates that the second video which is playing or pausing playing does not exist in the video stream playing page, determining the target video in the video stream list by using a reference line method and/or a list direction method.
And if the second judging result indicates that the second video which is playing or pausing playing exists in the video stream playing page, judging whether the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement or not, and obtaining a fourth judging result.
And if the fourth judging result shows that the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, determining the second video as the target video.
And if the fourth judging result shows that the visible area ratio of the player container of the second video does not meet the preset visible area ratio requirement, determining the target video in the video stream list by using a reference line method and/or a list direction method.
Alternatively, the sliding module 62 may be specifically configured to:
when the first video playing is finished, subtracting the fourth distance from the difference between the third distance and the preset value to obtain a sliding distance; the third distance is the distance between the lower boundary of the first video and the upper boundary of the video stream playing page; the fourth distance is the distance between any two videos; and then, controlling the next video of the first video to slide according to the sliding distance.
Optionally, the apparatus of the embodiment of the present disclosure may further include a play stopping module, configured to:
and stopping playing the video when the video stream playing page is invisible.
Optionally, the apparatus of the embodiment of the present disclosure may further include a second judging module, configured to:
Judging whether the video stream playing page accords with a preset automatic video playing condition or not; if the video stream playing page meets the preset automatic playing video condition, the method (namely, executing the automatic playing strategy class) is executed.
Optionally, when the video stream list control recuorview is not empty, the automatic video playing function of the video stream playing page is in an open state, the video stream playing page is in a resumed state, and the video stream playing page does not display dialogs, determining that the video stream playing page meets the preset automatic video playing condition.
For the foregoing method embodiments, for simplicity of explanation, the methodologies are shown as a series of acts, but one of ordinary skill in the art will appreciate that the present invention is not limited by the order of acts, as some steps may, in accordance with the present invention, occur in other orders or concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the apparatus class embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference is made to the description of the method embodiments for relevant points.
The steps in the method of each embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs, and the technical features described in each embodiment can be replaced or combined.
The modules and the submodules in the device and the terminal of the embodiments of the invention can be combined, divided and deleted according to actual needs.
In the embodiments provided in the present invention, it should be understood that the disclosed terminal, apparatus and method may be implemented in other manners. For example, the above-described terminal embodiments are merely illustrative, and for example, the division of modules or sub-modules is merely a logical function division, and there may be other manners of division in actual implementation, for example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules or sub-modules illustrated as separate components may or may not be physically separate, and components that are modules or sub-modules may or may not be physical modules or sub-modules, i.e., may be located in one place, or may be distributed over multiple network modules or sub-modules. Some or all of the modules or sub-modules may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional module or sub-module in the embodiments of the present invention may be integrated in one processing module, or each module or sub-module may exist alone physically, or two or more modules or sub-modules may be integrated in one module. The integrated modules or sub-modules may be implemented in hardware or in software functional modules or sub-modules.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software unit executed by a processor, or in a combination of the two. The software elements may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (9)
1. A video stream playing method, comprising:
when a video stream playing page is visible or a video stream list stops sliding, determining a target video in the video stream list, and controlling the target video to play;
when the first video playing is finished, controlling the next video of the first video to slide so that the next video slides into a video stream playing page; the first video is any video in a video stream playing page;
the determining the target video in the video stream list comprises the following steps:
judging whether a video played under a full screen exists in a video stream playing page or not, and obtaining a first judging result;
if the first judging result indicates that the video which is played in the full screen exists in the video stream playing page, determining that the video is the target video;
if the first judgment result indicates that the video which is played under the full screen does not exist in the video stream playing page, judging whether a second video which is playing or pausing playing exists in the video stream playing page, and obtaining a second judgment result;
if the second judging result indicates that the second video which is being played or paused in the video stream playing page does not exist, determining a target video in a video stream list by using a reference line method and/or a list direction method;
If the second judging result indicates that a second video which is playing or pausing playing exists in the video stream playing page, judging whether the visible area occupation ratio of a player container of the second video meets the preset visible area occupation ratio requirement or not, and obtaining a fourth judging result;
if the fourth judgment result indicates that the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, determining that the second video is the target video;
and if the fourth judging result shows that the visible area ratio of the player container of the second video does not meet the preset visible area ratio requirement, determining the target video in the video stream list by using a reference line method and/or a list direction method.
2. The method according to claim 1, wherein the determining the target video in the video stream list using the reference line method specifically comprises:
for a visible area of each video in a video stream playing page, acquiring a first distance between an upper boundary of the visible area and an upper boundary of the video stream playing page and a second distance between a lower boundary of the visible area and the upper boundary;
Calculating the absolute value of the difference between the first distance and the line width of a preset reference line to obtain a first calculated value; the preset reference line is a line segment connecting the left boundary and the right boundary of the video stream playing page in the video stream playing page; the difference value between the line width of the preset reference line and the height value of the player container of the video is within a preset difference value range;
calculating the absolute value of the difference between the second distance and the line width of the preset reference line to obtain a second calculated value;
taking the minimum value of the first calculated value and the second calculated value as a target calculated value of the video corresponding to the visible region;
determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page; the visible area occupation ratio is the ratio between the area of the visible area and the area of the corresponding video;
the method for determining the target video in the video stream list by using the list direction comprises the following steps:
traversing each video in the video stream playing page along the preset list direction, and determining the video as the target video when traversing to the video with the visible area occupation ratio meeting the preset visible area occupation ratio requirement.
3. The method of claim 2, wherein the line width of the preset reference line is equal to a height value of a player container of the video.
4. The method according to claim 2, wherein determining the target video in each video in the video stream playing page according to the target calculated value and the visible area ratio of each video in the video stream playing page specifically comprises:
and traversing each video in the video stream playing page in sequence from small to large according to the target calculated value, and determining the video as the target video when traversing the video with the visible area ratio meeting the preset visible area ratio requirement.
5. The method according to claim 1, wherein when the playing of the first video is finished, controlling the next video of the first video to slide, specifically comprises:
when the first video playing is finished, subtracting the fourth distance from the difference between the third distance and the preset value to obtain a sliding distance; the third distance is the distance between the lower boundary of the first video and the upper boundary of the video stream playing page; the fourth distance is the distance between any two videos;
And controlling the next video of the first video to slide according to the sliding distance.
6. The method as recited in claim 1, further comprising:
and stopping playing the video when the video stream playing page is invisible.
7. The method as recited in claim 1, further comprising:
judging whether the video stream playing page accords with a preset automatic video playing condition or not;
if the video stream playing page meets the preset automatic video playing condition, the method as described in claim 1 is executed.
8. The method of claim 7, wherein the video stream play page is determined to meet a preset auto-play video condition when the video stream list control recurview is not empty, the auto-play video function of the video stream play page is in an open state, the video stream play page is in a resumed state, and no dialogs are shown in the video stream play page.
9. A video stream playback device, comprising:
the video stream playing module is used for searching a target video, and when a video stream playing page is visible or a video stream list stops sliding, determining the target video in the video stream list and controlling the target video to play;
The sliding module is used for controlling the next video of the first video to slide when the first video is played, so that the next video slides into a video stream playing page; the first video is any video in a video stream playing page;
the searching and playing target video module is specifically configured to:
judging whether a video played under a full screen exists in a video stream playing page or not, and obtaining a first judging result;
if the first judging result indicates that the video which is played in the full screen exists in the video stream playing page, determining that the video is the target video;
if the first judgment result indicates that the video which is played under the full screen does not exist in the video stream playing page, judging whether a second video which is playing or pausing playing exists in the video stream playing page, and obtaining a second judgment result;
if the second judging result indicates that the second video which is being played or paused in the video stream playing page does not exist, determining a target video in a video stream list by using a reference line method and/or a list direction method;
if the second judging result indicates that a second video which is playing or pausing playing exists in the video stream playing page, judging whether the visible area occupation ratio of a player container of the second video meets the preset visible area occupation ratio requirement or not, and obtaining a fourth judging result;
If the fourth judgment result indicates that the visible area occupation ratio of the player container of the second video meets the preset visible area occupation ratio requirement, determining that the second video is the target video;
and if the fourth judging result shows that the visible area ratio of the player container of the second video does not meet the preset visible area ratio requirement, determining the target video in the video stream list by using a reference line method and/or a list direction method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310756697.4A CN116506695B (en) | 2023-06-26 | 2023-06-26 | Video stream playing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310756697.4A CN116506695B (en) | 2023-06-26 | 2023-06-26 | Video stream playing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116506695A CN116506695A (en) | 2023-07-28 |
CN116506695B true CN116506695B (en) | 2023-09-08 |
Family
ID=87323417
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310756697.4A Active CN116506695B (en) | 2023-06-26 | 2023-06-26 | Video stream playing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116506695B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105791947A (en) * | 2016-04-21 | 2016-07-20 | 腾讯科技(深圳)有限公司 | Method and device for playing video |
CN108111914A (en) * | 2016-11-24 | 2018-06-01 | 广州市动景计算机科技有限公司 | Video playback area recognition methods, device and apparatus for media playing |
CN110688571A (en) * | 2019-09-20 | 2020-01-14 | 北京字节跳动网络技术有限公司 | List stream implementation method and device, electronic equipment and storage medium |
CN110798728A (en) * | 2019-11-06 | 2020-02-14 | 北京小米移动软件有限公司 | Video playing method, device and storage medium |
CN112954441A (en) * | 2021-03-02 | 2021-06-11 | 北京字节跳动网络技术有限公司 | Video editing and playing method, device, equipment and medium |
CN114205680A (en) * | 2021-12-01 | 2022-03-18 | 广州方硅信息技术有限公司 | Video cover display method and device, equipment, medium and product thereof |
WO2022100512A1 (en) * | 2020-11-11 | 2022-05-19 | 北京字跳网络技术有限公司 | Hotspot list display method and apparatus, and electronic device and storage medium |
-
2023
- 2023-06-26 CN CN202310756697.4A patent/CN116506695B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105791947A (en) * | 2016-04-21 | 2016-07-20 | 腾讯科技(深圳)有限公司 | Method and device for playing video |
CN108111914A (en) * | 2016-11-24 | 2018-06-01 | 广州市动景计算机科技有限公司 | Video playback area recognition methods, device and apparatus for media playing |
CN110688571A (en) * | 2019-09-20 | 2020-01-14 | 北京字节跳动网络技术有限公司 | List stream implementation method and device, electronic equipment and storage medium |
CN110798728A (en) * | 2019-11-06 | 2020-02-14 | 北京小米移动软件有限公司 | Video playing method, device and storage medium |
WO2022100512A1 (en) * | 2020-11-11 | 2022-05-19 | 北京字跳网络技术有限公司 | Hotspot list display method and apparatus, and electronic device and storage medium |
CN112954441A (en) * | 2021-03-02 | 2021-06-11 | 北京字节跳动网络技术有限公司 | Video editing and playing method, device, equipment and medium |
CN114205680A (en) * | 2021-12-01 | 2022-03-18 | 广州方硅信息技术有限公司 | Video cover display method and device, equipment, medium and product thereof |
Also Published As
Publication number | Publication date |
---|---|
CN116506695A (en) | 2023-07-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107341018B (en) | Method and device for continuously displaying view after page switching | |
US11604918B2 (en) | Methods for serving interactive content to a user | |
CN110568974B (en) | Sliding view display method and device and mobile terminal | |
CN109120981B (en) | Information list display method and device and storage medium | |
US20080155428A1 (en) | Method of displaying menu based on use record in mobile terminal | |
CN115167725A (en) | Method for providing operation guidance information of terminal and terminal equipment | |
KR20150079792A (en) | Icon display method and apparatus | |
EP3690614A1 (en) | Photographing apparatus control method, photographing apparatus and storage medium | |
CN110996154B (en) | Video playing method and device and electronic equipment | |
US20240012554A1 (en) | Method for displaying trending event in application and electronic device | |
US11809811B2 (en) | Methods for serving interactive content to a user | |
CN113810777B (en) | Playing method and device | |
CN116506695B (en) | Video stream playing method and device | |
WO2019085810A1 (en) | Processing method, device, apparatus, and machine-readable medium | |
CN111273826B (en) | Desktop icon management method, device, equipment and storage medium | |
CN107508992A (en) | A kind of mobile terminal and its method and system for starting application program shortcut | |
CN111444064A (en) | Component exposure statistical method and device and mobile terminal | |
CN113268297B (en) | Page display method, device, electronic equipment and storage medium | |
CN114138158B (en) | Method and device for detecting visibility of view and computing equipment | |
CN115314560B (en) | Regional network state display control method and device | |
CN115247924B (en) | Screen sharing method and device based on intelligent refrigerator and intelligent refrigerator | |
CN111414123B (en) | Information processing method and device | |
CN112770099B (en) | Multimedia playing method, device, terminal and storage medium | |
CN114610261A (en) | Terminal screen projection method, device, equipment and medium | |
CN115514999A (en) | Method, device, equipment and storage medium for switching multiple video templates |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |