CN114501134A - iOS cross-page video playing method, device, equipment and storage medium - Google Patents

iOS cross-page video playing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114501134A
CN114501134A CN202111636020.4A CN202111636020A CN114501134A CN 114501134 A CN114501134 A CN 114501134A CN 202111636020 A CN202111636020 A CN 202111636020A CN 114501134 A CN114501134 A CN 114501134A
Authority
CN
China
Prior art keywords
playing
video
transition
request
page
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.)
Granted
Application number
CN202111636020.4A
Other languages
Chinese (zh)
Other versions
CN114501134B (en
Inventor
麦淼
邹磊
钟坤斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Southern Intelligent Media Technology Co ltd
Original Assignee
Guangdong Southern New Media Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Southern New Media Technology Co ltd filed Critical Guangdong Southern New Media Technology Co ltd
Priority to CN202111636020.4A priority Critical patent/CN114501134B/en
Publication of CN114501134A publication Critical patent/CN114501134A/en
Application granted granted Critical
Publication of CN114501134B publication Critical patent/CN114501134B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44213Monitoring of end-user related data
    • H04N21/44218Detecting physical presence or behaviour of the user, e.g. using sensors to detect if the user is leaving the room or changes his face expression during a TV program
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • H04N21/4431OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB characterized by the use of Application Program Interface [API] libraries
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47217End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Social Psychology (AREA)
  • General Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Library & Information Science (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an iOS cross-page video playing method, device, equipment and storage medium, comprising: before each target video is played, a playing model object is created; after responding to a transition gesture interaction instruction of a user, performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration; after the video player carries out cross-page transition, judging whether the continuous playing video API is called or not; if so, acquiring request data from the resource loading request object, and inquiring a playing progress correspondingly stored in the target video in a local cache so as to continue playing the target video; if not, stopping video playing, performing reset operation on the playing model object, and acquiring request data from the resource loading request object after the reset operation, thereby re-playing the target video. The invention solves the problem of repeated video caching during multi-page switching in the prior art.

Description

iOS cross-page video playing method, device, equipment and storage medium
Technical Field
The invention relates to the field of audio and video data processing, in particular to an iOS cross-page video playing method, device, equipment and storage medium.
Background
At present, the video played by the iOS end is mainly played by using an AVPlayer of the system, the AVPlayer encapsulates details such as audio and video acquisition, decoding and encoding and the like of a bottom layer, and an application layer does not need to care about the implementation details, so that the use is more convenient and simpler. However, AVPlayer does not provide a buffer-related API, and thus cannot know where the buffer of AVPlayer is, and thus cannot fully utilize the buffer to realize seamless playback of the same video across pages. Research shows that the buffer memory can be controlled by using the AVAssetResourceLoaderDelegate (self-defined audio and video stream loader agent) to control the video data stream, so before the AVPlayer is used for playing video, the self-defined audio and video stream loader agent is required to be added to the AVPlayer to realize the playing and buffer memory of the audio and video. The UIView controllerTransitioning (UI visual transition control) is a transition protocol in an apple UIKit framework, the UIKit is subordinate to a Cocoa Touch (the Cocoa Touch is provided by apple Inc. for developing api for developing software on iPhone iPod iPad), the UIKit belongs to an iPhone OS side UI framework, is different from an iPod framework for executing events by a mouse in the Mac OS side, and is mainly suitable for an interface system interacting with gestures, and the UIView controllerTransitioning protocol is mainly used for transition during jumping between controllers, can realize different transition animation sequences to achieve different effects by customizing animation and interaction, and is suitable for more jumping application scenes.
However, due to the uncertainty of the network environment on the current mobile application terminal, the video playing is affected by the network environment from time to time, and the video is repeatedly cached when the transition from the information flow list to the detail page is switched among multiple pages, which wastes both the user traffic and the memory space, and also causes the slow response speed of the playing.
In order to make the user play the played video without perception, that is, without downloading the same media file for multiple times, so as to provide more complete use experience for the user, especially in the current network era taking multimedia as the mainstream, various caching technologies are also very important, so that the technical personnel in the field have an incentive to develop a seamless video resume technology of cross-page jump based on the avassetreresourceloader and uiviewcontrollertransition protocol technologies.
Disclosure of Invention
The invention provides an iOS cross-page video playing method, device, equipment and storage medium, and aims to solve the technical problem that videos are repeatedly cached in multi-page switching in the prior art.
In order to solve the above technical problem, an embodiment of the present invention provides an iOS cross-page video playing method, including:
before each target video is played, a playing model object is created; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing;
after responding to a transition gesture interaction instruction of a user, performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration;
after the video player carries out cross-page transition, judging whether the continuous playing video API is called or not;
if so, acquiring request data from the resource loading request object, and inquiring a playing progress correspondingly stored in the target video in a local cache so as to continue playing the target video;
if not, stopping video playing, performing reset operation on the playing model object, and acquiring request data from the resource loading request object after the reset operation, thereby re-playing the target video.
As a preferred scheme, after responding to a transition gesture interaction instruction of a user, performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration, specifically:
after responding to a gesture interaction instruction of a user, acquiring a container view and an animation target controller according to a preset transition context parameter, adding the view of the animation target controller when a preset transition animation is finished into the container view, determining a start coordinate value and an end coordinate value of the preset transition animation, transmitting preset transition duration time into the preset transition animation, calculating the position of the video player on the view of the animation target controller, and finishing transition by using the preset transition context parameter in the call back of the finish of the preset transition animation, thereby finishing the cross-page transition of the video player.
As a preferred scheme, the playing of the target video specifically includes:
acquiring request data of the resource loading request object according to the resource loading request object; the request data comprises a request range and a request address;
the resource loading request object is downloaded in a fragmentation mode, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after the response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task;
and after finishing downloading one data segment, filling the downloaded data segment into a video player for playing, recording the playing time, and simultaneously locally caching the downloaded data segment and the recorded playing time according to the request address.
As a preferred scheme, the filling the downloaded data segment into a video player for playing, recording the playing time, and performing local caching on the downloaded data segment and the recorded playing time according to the request address specifically includes:
recording the offset and the length of the downloaded data segment, filling the downloaded data segment into a video player for playing, recording the playing time, acquiring the MD5 value of the request address, and locally caching the playing time and the downloaded data segment according to the request address according to the offset and the length of the downloaded data segment.
As a preferred scheme, the obtaining of the request data from the resource loading request object and the querying of the local cache about the playing progress correspondingly stored in the target video are performed, so as to continue playing the target video, specifically:
and when the corresponding data segment in the local cache corresponds to the downloaded data segment after the transition, the video is directly accelerated to the playing time, and the corresponding data segment in the local cache is provided for continuous playing.
Correspondingly, the invention also provides an iOS cross-page video playing device, comprising: the device comprises a creating module, a transition module, a judging module, a first executing module and a second executing module;
the creating module is used for creating a playing model object before playing the target video each time; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing;
the transition module is used for responding to a transition gesture interaction instruction of a user and then performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration;
the judging module is used for judging whether the continuous playing video API is called or not after the video player carries out cross-page transition;
the first execution module is configured to, if the resume video API is called, obtain request data from the resource loading request object, and query, in a local cache, a playing progress that is correspondingly stored in the target video, so as to resume playing of the target video;
and the second execution module is used for stopping video playing, resetting the playing model object and acquiring request data from the resource loading request object after the resetting operation if the continuous playing video API is not called, so as to play the target video again.
Preferably, the method further comprises the following steps: the device comprises a request module, a downloading module and a cache module;
the request module is used for acquiring request data of the resource loading request object according to the resource loading request object; the request data comprises a request range and a request address;
the downloading module is used for downloading the resource loading request object in a fragmentation manner, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after a response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task;
and the cache module is used for filling the downloaded data segment into the video player to play after downloading one data segment, recording the playing time and locally caching the downloaded data segment and the recorded playing time according to the request address.
As a preferred scheme, the transition module is configured to perform cross-page transition on the video player according to a preset transition context parameter and a preset transition duration after responding to a transition gesture interaction instruction of a user, and specifically includes:
after responding to a gesture interaction instruction of a user, acquiring a container view and an animation target controller according to a preset transition context parameter, adding the view of the animation target controller when a preset transition animation is finished into the container view, determining a start coordinate value and an end coordinate value of the preset transition animation, transmitting preset transition duration time into the preset transition animation, calculating the position of the video player on the view of the animation target controller, and finishing transition by using the preset transition context parameter in the call back of the finish of the preset transition animation, thereby finishing the cross-page transition of the video player.
As a preferred scheme, the filling the downloaded data segment into a video player for playing, recording the playing time, and performing local caching on the downloaded data segment and the recorded playing time according to the request address specifically includes:
recording the offset and the length of the downloaded data segment, filling the downloaded data segment into a video player for playing, recording the playing time, acquiring the MD5 value of the request address, and locally caching the playing time and the downloaded data segment according to the request address according to the offset and the length of the downloaded data segment.
As a preferred scheme, the obtaining of the request data from the resource loading request object and the querying of the local cache about the playing progress correspondingly stored in the target video are performed, so as to continue playing the target video, specifically:
and when the corresponding data segment in the local cache corresponds to the downloaded data segment after the transition, the video is directly accelerated to the playing time, and the corresponding data segment in the local cache is provided for continuous playing.
Accordingly, the present invention also provides a computer readable storage medium comprising a stored computer program; wherein the computer program, when running, controls the device on which the computer-readable storage medium is located to execute any of the iOS cross-page video playing methods described above.
Accordingly, the present invention also provides a terminal device, comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the iOS cross-page video playing method as described in any one of the above when executing the computer program.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
according to the technical scheme, the playing of the video can be controlled by creating the playing model object before the video is played, the video player is subjected to cross-page transition according to the preset transition context parameter and the preset transition duration time, whether the video player after transition needs to be continuously played or not is judged through the API in the playing model object, the request data is obtained from the resource loading request object, the playing progress correspondingly stored in the target video is inquired in the local cache, and therefore the target video is continuously played, the cached video can be played by a user in an unhappy manner, the playing response speed is improved, the phenomenon that the same video is cached for multiple times is avoided, and the flow is repeatedly consumed by the mobile terminal is avoided.
Drawings
FIG. 1: the steps of the method for playing the iOS cross-page video provided by the embodiment of the invention are represented by a flow chart;
FIG. 2: the video caching flow chart in the iOS cross-page video playing method provided by the embodiment of the invention is shown;
FIG. 3: the structure diagram of an iOS cross-page video playing device provided by the embodiment of the present invention;
FIG. 4: the embodiment of the invention provides a schematic structural diagram of a module for downloading and caching in an iOS cross-page video playing device.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, a cross-page iOS video playing method according to an embodiment of the present invention includes the following steps S101-S105:
s101: before each target video is played, a playing model object is created; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing.
In this embodiment, a target video is played, and specifically, request data of the resource loading request object is obtained according to the resource loading request object; the request data comprises a request range and a request address; the resource loading request object is downloaded in a slicing mode, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after the response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task; and after finishing downloading one data segment, filling the downloaded data segment into a video player for playing, recording playing time, and locally caching the downloaded data segment and the recorded playing time according to the request address.
Specifically, after a data segment is downloaded, the offset and the length of the downloaded data segment are recorded, the downloaded data segment is filled into a video player to be played, the playing time is recorded, the MD5 value of the request address is obtained, and the playing time and the downloaded data segment are locally cached according to the offset and the length of the downloaded data segment.
It should be noted that, the video player is an AVPlayer of the iOS system, the AVPlayer does not perform the caching process by default during playing, and needs to download again when playing next time, so before playing the target video, a play model object needs to be created, and a self-defined nfvideoplayer resource loader inherits from the NSObject, follows the avsetresourceloadeloader protocol, so as to make it become a proxy object of the AVPlayer, after setting the play address resource (avurl) for the player video player, it is determined whether the play address resource is legal, if so, the video data is downloaded, and at the same time, the player video player will obtain the video play data from the proxy object.
In this embodiment, each time a download request is sent to the server, the download request includes a request header encapsulating a download range preset in the download task, and is used to determine data information such as a file type and a file length of video data, and when waiting to receive a response from the server, the video player is notified of a format and a video length of a currently downloaded video, and whether playing can be supported is determined according to the format and the video length of the currently downloaded video; if the playing is not supported, the playing address resource (AVURLAsset) fails; and if the video information is legal, carrying out fragment downloading on the data fragment of the resource loading request object according to the generated downloading task.
The data response (responseWithData) method is called by the resource loading request object to provide a data stream which can be played for the video player, because of fragmentation downloading, the data response (responseWithData) can be called for many times, incremental data is received step by step until an error is encountered or the video with the whole length is downloaded, after the video is normally downloaded, the resource loading request object can call back the finish loading (finishingLoading) method to finish the downloading of the video, and if the error is encountered, the error stop loading (finishingloadwithholderherror) method is triggered to inform the video player that the request fails and the downloading is stopped continuously.
As a preferred solution of this embodiment, please refer to fig. 2, which is a flowchart of video caching in the embodiment of the present invention, before a download task is generated, a downloader class of nfvideoplaylandloaders is further created to manage downloading of a local cache, and a nfvideoplaylandechecache file is further created to perform operations such as writing and reading of the cache. In a downloader, creating an NSURLSession session object, acquiring a request address of current video playing by request data provided by a resource loading request object to generate a downloading task (NFResourceLoadIngRequestWebTask), triggering the current downloading task to execute and download data, and after the data is downloaded successfully, using NFVideoPlayerCacheFile class to store the received data segments locally through NSFileManger management; different data segments are incrementally spliced into the cache file according to an offset value (offset) of a request header in the download request; and performing MD5 according to the current request address, and then using the MD5 as a cache file name, and storing the cache file in an NSCachesDirectory directory of the sandbox, thereby realizing a complete video stream data request and a local cache storage task.
S102: and after responding to a transition gesture interaction instruction of a user, performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration.
Specifically, after responding to a gesture interaction instruction of a user, acquiring a container view and an animation target controller according to a preset transition context parameter, adding a view of the animation target controller when a preset transition animation is finished into the container view, determining a start coordinate value and an end coordinate value of the preset transition animation, transmitting a preset transition duration time into the preset transition animation, calculating a position of the video player on the view of the animation target controller, and finishing transition by using the preset transition context parameter in a call-back process of finishing the transition of the preset transition animation, so that the video player performs cross-page transition.
It should be noted that, the cross-page transition part needs to be implemented by the nfvideoplayer identifier class of the uiviewcontrollertransition protocol technology, and two necessary methods for completing the animation are implemented in the class by accepting a CGRect parameter, i.e. the frame value of the UITableViewCell control for placing the video player before the page jump: the transitionDuration method and animatettransition method. the transitionDuration method is the time for which the transition animation is performed; the animatettransition method is used for realizing how transition is carried out when a page jumps, and the animatettransition method is provided with a preset transition context parameter (transitiontext). From the preset transition context parameters, two parameters can be obtained for implementing the jump of the transition animation: a container view (containView) and an animation object controller (UITransitionContext).
S103: and after the video player carries out cross-page transition, judging whether the continuous playing video API is called.
It should be noted that the resume video API supports the current resume API for one of several externally provided play APIs: (resumePlayWithURL: shownlayers: options: consistent-completion:), the API that externally provides playback is generated from a playback model object created before the target video is played.
S104: if so, acquiring request data from the resource loading request object, and inquiring a playing progress correspondingly stored in the target video in a local cache, so as to continue playing the target video.
Specifically, the converted request data is obtained from the resource loading request object, the playing time corresponding to the request address in the converted request data is inquired, the local cache corresponding to the data of the target video is searched according to the MD5 value of the request address, the offset and the length corresponding to the downloaded data segment after the conversion are obtained through the converted downloading request, and when the corresponding data segment in the local cache corresponds to the downloaded data segment after the conversion, the video is directly accelerated to the playing time, and the corresponding data segment in the local cache is provided for continuous playing.
As a preferred solution of this embodiment, the method further includes verifying a request address in the current playback model object; if the request address in the current playing model object is not consistent with the request address before transition, removing the layer of the video player in the playing model object from the parent view of the video player, stopping playing the current video, resetting the playing model object, and acquiring request data from the resource loading request object after the resetting operation, thereby re-playing the target video; if the request address in the current playing model object is consistent with the request address before transition, acquiring the request data after transition from the resource loading request object, inquiring the playing time corresponding to the request address in the request data after transition, searching the local cache corresponding to the data of the target video according to the MD5 value of the request address, acquiring the offset and the length corresponding to the data fragment downloaded after transition according to the downloading request after transition, and directly fast forwarding the video to the playing time and providing the corresponding data fragment in the local cache for continuous playing when the corresponding data fragment corresponds to the data fragment downloaded after transition.
S105: if not, stopping video playing, performing reset operation on the playing model object, and acquiring request data from the resource loading request object after the reset operation, thereby re-playing the target video.
It should be noted that, if the video playback continuation API is not called, the layer of the video player in the playback model object is removed from its parent view, the playback of the current video is stopped, meanwhile, reset operations such as monitoring of the video state are removed, and a new playback model object is created to enter a completely new video playback flow.
The embodiment of the invention has the following effects:
according to the embodiment of the invention, the playing of the video can be controlled by creating the playing model object before the video is played, the video player is subjected to cross-page transition according to the preset transition context parameter and the preset transition duration time, whether the video player after transition needs to be continuously played is judged through the API in the playing model object, the request data is obtained from the resource loading request object, and the playing progress correspondingly stored in the target video is inquired in the local cache, so that the target video is continuously played, the user can play the cached video without feeling, the playing response speed is improved, the phenomenon that the same video is repeatedly cached is avoided, the repeated consumption of the mobile terminal on the flow is caused, and more complete use experience is provided for the user.
Example two
Accordingly, please refer to fig. 3, which is a diagram illustrating an iOS cross-page video playing apparatus according to an embodiment of the present invention, including: the system comprises a creation module 201, a transition module 202, a judgment module 203, a first execution module 204 and a second execution module 205;
the creating module 201 is configured to create a play model object each time before the target video is played; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing;
the transition module 202 is configured to perform cross-page transition on the video player according to a preset transition context parameter and a preset transition duration after responding to a transition gesture interaction instruction of a user;
as a preferred scheme of this embodiment, the transition module 202 is configured to, after responding to a gesture interaction instruction of a user, obtain a container view and an animation target controller according to a preset transition context parameter, add a view of the animation target controller when a preset transition animation ends to the container view, determine a start coordinate value and an end coordinate value of the preset transition animation, transmit a preset transition duration to the preset transition animation, calculate a position of the video player on the view of the animation target controller, and end transition with the preset transition context parameter in a call-back of the end of the preset transition animation, so as to complete cross-page transition of the video player.
The judging module 203 is configured to judge whether the continuous playing video API is called after the video player performs a cross-page transition;
the first execution module 204 is configured to, if the resume video API is called, obtain request data from the resource loading request object, and query, in a local cache, a playing progress that is correspondingly stored in the target video, so as to resume playing of the target video.
As a preferred embodiment of this embodiment, the first executing module 204 is configured to obtain request data after transition from the resource loading request object, query a playing time corresponding to a request address in the request data after transition, search a local cache corresponding to the data of the target video according to an MD5 value of the request address, obtain, through a download request after transition, an offset and a length corresponding to a data segment downloaded after transition, and when a corresponding data segment in the local cache corresponds to the data segment downloaded after transition, directly fast forward the video to the playing time, and provide the corresponding data segment in the local cache for continuous playing.
The second executing module 205 is configured to stop video playing, perform a reset operation on the playing model object, and obtain request data from the resource loading request object after the reset operation, so as to play the target video again if the continuous playing video API is not called.
As a preferred solution of this embodiment, please refer to fig. 4, which is a cross-page iOS video playing apparatus according to this embodiment of the present invention, further including: a request module 301, a download module 302 and a cache module 303;
the request module 301 is configured to obtain request data of the resource loading request object according to the resource loading request object; the request data includes a request range and a request address.
The downloading module 302 is configured to perform fragment downloading on the resource loading request object, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after a response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task.
The cache module 303 is configured to, after each data segment is downloaded, fill the downloaded data segment into the video player for playing, record playing time, and locally cache the downloaded data segment and the recorded playing time according to the request address.
As a preferred solution of this embodiment, the caching module 303 is configured to record an offset and a length of a downloaded data segment, fill the downloaded data segment into a video player for playing, record playing time, obtain an MD5 value of the request address, and locally cache the playing time and the downloaded data segment according to the offset and the length of the downloaded data segment.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
The embodiment of the invention has the following effects:
according to the embodiment of the invention, the playing of the video can be controlled by creating the playing model object before the video is played, the video player is subjected to cross-page transition according to the preset transition context parameter and the preset transition duration time, whether the video player after transition needs to be continuously played is judged through the API in the playing model object, the request data is obtained from the resource loading request object, and the playing progress correspondingly stored in the target video is inquired in the local cache, so that the target video is continuously played, the user can play the cached video without feeling, the playing response speed is improved, the phenomenon that the same video is repeatedly cached is avoided, the repeated consumption of the mobile terminal on the flow is caused, and more complete use experience is provided for the user.
EXAMPLE III
An embodiment of the present invention further provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor, when executing the computer program, implements the iOS cross-page video playing method according to any of the above embodiments.
Preferably, the computer program may be divided into one or more modules/units (e.g., computer program) that are stored in the memory and executed by the processor to implement the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program in the terminal device.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, a discrete hardware component, etc., the general purpose Processor may be a microprocessor, or the Processor may be any conventional Processor, the Processor is a control center of the terminal device, and various interfaces and lines are used to connect various parts of the terminal device.
The memory mainly includes a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like, and the data storage area may store related data and the like. In addition, the memory may be a high speed random access memory, may also be a non-volatile memory, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), and the like, or may also be other volatile solid state memory devices.
It should be noted that the terminal device may include, but is not limited to, a processor and a memory, and those skilled in the art will understand that the terminal device is only an example and does not constitute a limitation of the terminal device, and may include more or less components, or combine some components, or different components.
Example four
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program; wherein, when running, the computer program controls the device where the computer-readable storage medium is located to execute the iOS cross-page video playing method according to any of the above embodiments.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and are not intended to limit the scope of the present invention. It should be understood that any modifications, equivalents, improvements and the like, which come within the spirit and principle of the invention, may occur to those skilled in the art and are intended to be included within the scope of the invention.

Claims (10)

1. An iOS cross-page video playing method is characterized by comprising the following steps:
before each target video is played, a playing model object is created; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing;
after responding to a transition gesture interaction instruction of a user, performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration;
after the video player carries out cross-page transition, judging whether the continuous playing video API is called or not;
if so, acquiring request data from the resource loading request object, and inquiring a playing progress correspondingly stored in the target video in a local cache so as to continue playing the target video;
if not, stopping video playing, performing reset operation on the playing model object, and acquiring request data from the resource loading request object after the reset operation, thereby re-playing the target video.
2. The iOS cross-page video playing method of claim 1, wherein after responding to a transition gesture interaction instruction of a user, performing a cross-page transition on the video player according to a preset transition context parameter and a preset transition duration, specifically:
after responding to a gesture interaction instruction of a user, acquiring a container view and an animation target controller according to a preset transition context parameter, adding the view of the animation target controller when a preset transition animation is finished into the container view, determining a start coordinate value and an end coordinate value of the preset transition animation, transmitting preset transition duration time into the preset transition animation, calculating the position of the video player on the view of the animation target controller, and finishing transition by using the preset transition context parameter in the call back of the finish of the preset transition animation, thereby finishing the cross-page transition of the video player.
3. The iOS cross-page video playing method of claim 1, wherein the playing of the target video is specifically:
acquiring request data of the resource loading request object according to the resource loading request object; the request data comprises a request range and a request address;
the resource loading request object is downloaded in a slicing mode, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after the response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task;
and after finishing downloading one data segment, filling the downloaded data segment into a video player for playing, recording playing time, and locally caching the downloaded data segment and the recorded playing time according to the request address.
4. The iOS cross-page video playing method of claim 3, wherein the step of filling the downloaded data segment into a video player for playing, recording the playing time, and performing local caching on the downloaded data segment and the recorded playing time according to the request address specifically comprises:
recording the offset and the length of the downloaded data segment, filling the downloaded data segment into a video player for playing, recording the playing time, acquiring the MD5 value of the request address, and locally caching the playing time and the downloaded data segment according to the request address according to the offset and the length of the downloaded data segment.
5. The iOS cross-page video playing method according to claim 4, wherein the obtaining of the request data from the resource loading request object and the querying of the local cache for the playing progress correspondingly stored in the target video, thereby continuing playing the target video, specifically:
and when the corresponding data segment in the local cache corresponds to the downloaded data segment after the transition, the video is directly accelerated to the playing time, and the corresponding data segment in the local cache is provided for continuous playing.
6. An iOS cross-page video playback apparatus, comprising: the device comprises a creating module, a transition module, a judging module, a first executing module and a second executing module;
the creating module is used for creating a playing model object before playing the target video each time; the playing model object comprises a video player, a resource loading request object and a video continuous playing API, and the target video is used as the resource loading request object of the current video playing;
the transition module is used for responding to a transition gesture interaction instruction of a user and then performing cross-page transition on the video player according to a preset transition context parameter and a preset transition duration;
the judging module is used for judging whether the continuous playing video API is called or not after the video player carries out cross-page transition;
the first execution module is configured to, if the resume video API is called, obtain request data from the resource loading request object, and query, in a local cache, a playing progress that is correspondingly stored in the target video, so as to resume playing of the target video;
and the second execution module is used for stopping video playing, resetting the playing model object and acquiring request data from the resource loading request object after the resetting operation if the continuous playing video API is not called, so as to play the target video again.
7. The iOS cross-page video playback apparatus of claim 6, further comprising: the device comprises a request module, a downloading module and a cache module;
the request module is used for acquiring request data of the resource loading request object according to the resource loading request object; the request data comprises a request range and a request address;
the downloading module is used for downloading the resource loading request object in a fragmentation manner, so that in the downloading process of each data fragment, a downloading task is generated according to a preset downloading range and the request address, a downloading request is sent to a server, and after a response of the server is received, the data fragment of the resource loading request object is downloaded according to the downloading task;
and the cache module is used for filling the downloaded data segment into the video player to play after downloading one data segment, recording the playing time and locally caching the downloaded data segment and the recorded playing time according to the request address.
8. The iOS cross-page video playing device of claim 6, wherein the transition module is configured to perform a cross-page transition on the video player according to a preset transition context parameter and a preset transition duration after responding to a transition gesture interaction instruction of a user, and specifically:
after responding to a gesture interaction instruction of a user, acquiring a container view and an animation target controller according to a preset transition context parameter, adding the view of the animation target controller when a preset transition animation is finished into the container view, determining a start coordinate value and an end coordinate value of the preset transition animation, transmitting preset transition duration time into the preset transition animation, calculating the position of the video player on the view of the animation target controller, and finishing transition by using the preset transition context parameter in the call back of the finish of the preset transition animation, thereby finishing the cross-page transition of the video player.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored computer program; wherein the computer program, when executed, controls an apparatus on which the computer-readable storage medium is located to perform the iOS cross-page video playback method of any of claims 1-5.
10. A terminal device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the iOS cross-page video playback method of any one of claims 1-5 when executing the computer program.
CN202111636020.4A 2021-12-28 2021-12-28 iOS cross-page video playing method, device, equipment and storage medium Active CN114501134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111636020.4A CN114501134B (en) 2021-12-28 2021-12-28 iOS cross-page video playing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111636020.4A CN114501134B (en) 2021-12-28 2021-12-28 iOS cross-page video playing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114501134A true CN114501134A (en) 2022-05-13
CN114501134B CN114501134B (en) 2022-11-18

Family

ID=81507998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111636020.4A Active CN114501134B (en) 2021-12-28 2021-12-28 iOS cross-page video playing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114501134B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023284498A1 (en) * 2021-07-13 2023-01-19 富途网络科技(深圳)有限公司 Video playing method and apparatus, and storage medium
CN116962832A (en) * 2023-07-28 2023-10-27 加客云科技(河北)有限公司 Multi-page switching continuous video playing method, terminal and medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964202A (en) * 2010-09-09 2011-02-02 南京中兴特种软件有限责任公司 Audio data file playback processing method mixed with multiple encoded formats
CN106231344A (en) * 2016-07-21 2016-12-14 青岛海信电器股份有限公司 A kind of video break-point continuous playing method and display device
US20170111414A1 (en) * 2015-10-16 2017-04-20 Le Holdings (Beijing) Co., Ltd. Video playing method and device
US20170188109A1 (en) * 2015-12-29 2017-06-29 Le Holdings (Beijing) Co., Ltd. Method and electronic device for switching video
US20170195613A1 (en) * 2015-12-31 2017-07-06 Le Holdings (Beijing) Co., Ltd. Method and electronic device for displaying video being played
CN109218834A (en) * 2017-06-30 2019-01-15 武汉斗鱼网络科技有限公司 A kind of live streaming list browse exchange method and device
CN110062284A (en) * 2019-04-03 2019-07-26 北京字节跳动网络技术有限公司 Video broadcasting method, device and electronic equipment
CN110611844A (en) * 2019-10-18 2019-12-24 网易(杭州)网络有限公司 Control method and device of player in application and video playing device
CN110708602A (en) * 2019-10-15 2020-01-17 北京字节跳动网络技术有限公司 Video starting method and device, electronic equipment and storage medium
CN111629251A (en) * 2020-06-10 2020-09-04 北京字节跳动网络技术有限公司 Video playing method and device, storage medium and electronic equipment
CN112423116A (en) * 2020-11-20 2021-02-26 广州欢网科技有限责任公司 Method and system for continuously playing multimedia file

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964202A (en) * 2010-09-09 2011-02-02 南京中兴特种软件有限责任公司 Audio data file playback processing method mixed with multiple encoded formats
US20170111414A1 (en) * 2015-10-16 2017-04-20 Le Holdings (Beijing) Co., Ltd. Video playing method and device
US20170188109A1 (en) * 2015-12-29 2017-06-29 Le Holdings (Beijing) Co., Ltd. Method and electronic device for switching video
US20170195613A1 (en) * 2015-12-31 2017-07-06 Le Holdings (Beijing) Co., Ltd. Method and electronic device for displaying video being played
CN106231344A (en) * 2016-07-21 2016-12-14 青岛海信电器股份有限公司 A kind of video break-point continuous playing method and display device
CN109218834A (en) * 2017-06-30 2019-01-15 武汉斗鱼网络科技有限公司 A kind of live streaming list browse exchange method and device
CN110062284A (en) * 2019-04-03 2019-07-26 北京字节跳动网络技术有限公司 Video broadcasting method, device and electronic equipment
CN110708602A (en) * 2019-10-15 2020-01-17 北京字节跳动网络技术有限公司 Video starting method and device, electronic equipment and storage medium
CN110611844A (en) * 2019-10-18 2019-12-24 网易(杭州)网络有限公司 Control method and device of player in application and video playing device
CN111629251A (en) * 2020-06-10 2020-09-04 北京字节跳动网络技术有限公司 Video playing method and device, storage medium and electronic equipment
CN112423116A (en) * 2020-11-20 2021-02-26 广州欢网科技有限责任公司 Method and system for continuously playing multimedia file

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023284498A1 (en) * 2021-07-13 2023-01-19 富途网络科技(深圳)有限公司 Video playing method and apparatus, and storage medium
CN116962832A (en) * 2023-07-28 2023-10-27 加客云科技(河北)有限公司 Multi-page switching continuous video playing method, terminal and medium
CN116962832B (en) * 2023-07-28 2024-02-27 加客云科技(河北)有限公司 Multi-page switching continuous video playing method, terminal and medium

Also Published As

Publication number Publication date
CN114501134B (en) 2022-11-18

Similar Documents

Publication Publication Date Title
CN114501134B (en) iOS cross-page video playing method, device, equipment and storage medium
JP6915091B2 (en) Application processing methods, equipment and storage media
CN110333947B (en) Method, device, equipment and medium for loading subcontracting resources of game application
KR101979621B1 (en) System and method for optimizing transfers of downloadable content
CN110096302B (en) Software data storage and upgrading method, device, equipment and storage medium
EP2863320B1 (en) Method, terminal and electronic device for processing an e-book document
CN105138376A (en) Mixed model application, webpage resource upgrading method thereof, mobile terminal and system
US9373358B2 (en) Collaborative media editing system
WO2017036183A1 (en) Differential upgrade package processing method and device, upgrade method, system and device
CN112333536A (en) Audio and video editing method, equipment and computer readable storage medium
US20150268808A1 (en) Method, Device and System for Multi-Speed Playing
US8768924B2 (en) Conflict resolution in a media editing system
JP2017522638A (en) Multimedia display method, apparatus and device
JP2008234668A (en) Memory management device, memory management method, memory management program and computer readable recording medium recording this program
JP5110541B2 (en) Content selection system, providing device, transfer device, content selection method, and content selection program
US20080058973A1 (en) Music playback system and music playback machine
CN104581404A (en) Method, device and system for processing multimedia data
CN107463524A (en) A kind of method and relevant device for accessing data
US20090144490A1 (en) Method, apparatus and computer program product for providing improved memory usage
US8898253B2 (en) Provision of media from a device
WO2018028321A1 (en) Method and apparatus for managing virtual external storage device, and terminal
CN110413800B (en) Method and equipment for providing novel information
CN110704157B (en) Application starting method, related device and medium
CN109669764B (en) Processing method, apparatus, device and machine readable medium
CN114115912A (en) Application installation method based on cloud mobile phone, cloud platform and related equipment

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
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 26/F, Building A, News Center, No. 289, Guangzhou Avenue, Yuexiu District, Guangzhou, Guangdong 510000

Patentee after: Guangdong Southern Intelligent Media Technology Co.,Ltd.

Address before: 510000 room 306, 3 / F, news center, 289 Guangzhou Avenue central, Yuexiu District, Guangzhou City, Guangdong Province

Patentee before: Guangdong Southern New Media Technology Co.,Ltd.