Historical record processing method and device
Technical Field
The embodiment of the invention relates to the technical field of information processing, in particular to a method and a device for processing a history record.
Background
With the continuous development of information processing technology, most applications can automatically record the access history of a user, for example, a web browser, an audio or video player, common office software, and the like all have a history record storage function, so that the user can quickly find content once accessed through the history record.
In the existing history record saving method, each application typically saves its own history record separately, for example, a web browser may save related information of a web page clicked by a user in the web browser, a video player a may save related information of a video watched by the user through the video player a, and a video player B may save related information of a video watched by the user through the video player B. However, when a user needs to search for some viewed video information without remembering which player the video was viewed in, the user needs to turn on each video player to search, which results in low efficiency of searching for a history record.
Disclosure of Invention
The embodiment of the invention provides a method and a device for processing a history record, which are used for solving the defect of low efficiency of searching the history record in the prior art and improving the efficiency of searching the history record.
The embodiment of the invention provides a method for processing a history record, which comprises the following steps:
receiving a call request from an application program; wherein the invocation request includes: address information of the multimedia content;
acquiring and playing the multimedia content according to the address information;
and in the process of playing the multimedia content, storing the history record of the playing of the multimedia content corresponding to the application program.
An embodiment of the present invention provides a history processing apparatus, including:
the first request receiving module is used for receiving a calling request from an application program; wherein the invocation request includes: address information of the multimedia content;
the content acquisition module is used for acquiring and playing the multimedia content according to the address information;
and the record storage module is used for storing the playing history of the multimedia content corresponding to the application program in the process of playing the multimedia content.
According to the method and the device for processing the history record, the multimedia content is obtained and played according to the received call request from the application program; and in the process of playing the multimedia content, storing the history record of the playing of the multimedia content corresponding to the application program. By the embodiment of the invention, the calling requests of various application programs can be managed in a unified way, and the history records of the multimedia playing corresponding to the application programs are stored, so that the history records of the multimedia playing carried out by calling the player by different application programs can be stored and managed in a unified way, and a user can inquire the history records of the multimedia content playing corresponding to different application programs through the history records, thereby improving the efficiency of inquiring the history records.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart illustrating steps of a first embodiment of a history processing method of the present invention;
FIG. 2 is a flow chart showing steps of a second embodiment of a history processing method of the present invention;
FIG. 3 is a flow chart showing the steps of a third embodiment of a history processing method of the present invention; and
FIG. 4 is a block diagram of an embodiment of a history processing apparatus according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. 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 flowchart illustrating a first step of a history processing method according to a first embodiment of the present invention is shown, which may specifically include:
step 101, receiving a call request from an application program; wherein the invocation request includes: address information of the multimedia content;
the embodiment of the invention can be applied to terminal equipment with independent operating systems, such as mobile phones, tablet computers and the like, and is used for uniformly recording the history records generated by calling the player to play the multimedia contents by each APP (Application program), thereby improving the efficiency of inquiring the history records. The embodiment of the present invention is mainly described by taking a terminal device with an android system as an example, and the terminal devices with other operating systems such as IOS may refer to each other.
In a preferred embodiment of the present invention, the step of receiving a call request from an application program may specifically include:
java receives a call request from an application program through the common interface mediaplayer.
For the android system, the processing mode for multimedia content is typically such that the system player of the operating system can provide an interface to the application program, such as mediaplayer. The application program can call the system player through the interface to realize the playing of the multimedia content. In the embodiment of the present invention, the application may invoke the system player through the common interface "mediaplayer. java", play the multimedia content using the system player, and collect the history of the play. It is understood that the above-mentioned calling system player collection history using mediaplayer. java interface is only an application example of the present invention, and in practical application, the present invention does not impose a limitation on the specific form of the common interface and the player.
In the embodiment of the invention, the APP can be used for representing programs which are installed on the terminal equipment, run in a user mode, can interact with a user and have a visual user interface, such as a WeChat APP, a music APP, a browser and the like. Specifically, the application program may receive a play request of a user, where the play request may carry an address of the multimedia content, such as a URL (Uniform resource Locator); thus, upon receiving a play request from a user, the application program may transfer address information of the multimedia content to the player by calling an interface provided by the player.
In an embodiment of the present invention, the multimedia content may specifically include: any one or a combination of pictures, texts, videos and audios, the multimedia content may be transmitted in a format of Streaming media, and the Streaming media may follow an HLS (dynamic bit rate adaptation) protocol, etc., and the embodiment of the present invention does not limit specific multimedia content and a transmission protocol thereof. For convenience of description, the embodiments of the present invention all take video as an example, and other multimedia contents may be referred to each other.
102, acquiring and playing the multimedia content according to the address information;
and 103, in the process of playing the multimedia content, saving the history record of the playing of the multimedia content corresponding to the application program.
In this embodiment of the present invention, the receiving of the call request from the application program may further include: application type information. The application type information may be used to indicate the type of the application program, for example, whether the application program is a third-party application such as WeChat or microblog, or a browser.
In an optional embodiment of the present invention, when the application program is a third-party application, such as a wechat or a microblog, and when a user clicks a video shared by a friend in the wechat APP, the wechat APP may invoke a system player through a mediaplayer.
In another optional embodiment of the present invention, when the application is a browser, that is, when a user needs to play video content in a certain webpage, similarly, a system player may be called through a mediaplayer.
In practical applications, when collecting and storing the history record, besides the URL address of the video and the URL address of the reference web page, any other history information related to the multimedia playing can be stored. In a preferred embodiment of the present invention, the history record may include at least any one of the following information:
the address information of the multimedia content, the process name corresponding to the application program, the playing start time information, the multimedia duration information, the multimedia title information and the multimedia key frame information.
Taking multimedia content as an example of a video, wherein the address information of the multimedia content may specifically be a URL address of the video, the application type information may specifically be a third party application or a browser, the play start time information may specifically be start time for playing the video content, the multimedia duration information may specifically be total duration of the video content, the multimedia title information may specifically be a title of the video, and the multimedia key frame information may specifically be a picture thumbnail of a certain key frame in the video playing process.
In practical applications, any one or a combination of the above information may be collected and saved, of course, the history records that may be saved are not limited to the above listed information, and those skilled in the art may collect and save any history information related to multimedia playing as needed, and the specific content of the history information is not limited by the present invention.
To sum up, the embodiment of the present invention obtains and plays the multimedia content according to the received call request from the application; and in the process of playing the multimedia content, storing the history record of the playing of the multimedia content corresponding to the application program. By the embodiment of the invention, the calling requests of various application programs can be managed in a unified way, and the history records of the multimedia playing corresponding to the application programs are stored, so that the history records of the multimedia playing carried out by calling the player by different application programs can be stored and managed in a unified way, and a user can inquire the history records of the multimedia content playing corresponding to different application programs through the history records, thereby improving the efficiency of inquiring the history records.
Example two
The present embodiment may further include the following optional technical solutions on the basis of the first embodiment.
In a preferred embodiment of the present invention, the step of saving the history of playing the multimedia content corresponding to the application program may specifically include the following sub-steps:
substep S11, obtaining the process name of the application program through a public interface;
and a substep S12 of saving the process name of the application program and the history of the multimedia content playing corresponding to the process name.
Referring to fig. 2, a flowchart illustrating steps of a second embodiment of a history record processing method according to the present invention is shown, which may specifically include:
java receives a call request from an application program through a public interface media player; the call request may specifically include: address information of the multimedia content;
step 202, acquiring and playing the multimedia content according to the address information;
step 203, obtaining the process name of the application program through the public interface mediaplayer.
And 204, in the process of playing the multimedia content, saving the process name of the application program and the history record of the multimedia content playing corresponding to the process name.
In a specific application, when an application calls a system player to play an online video, a URL address parameter of the video may be introduced through a setDataSource () method in a common interface mediaplayer.
void setDataSource(Context context,Uri uri,Map<String,String>headers);
In practical applications, the setDataSource () method is used to load a specified video file, in the above example, the setDataSource () method is used to specify a file represented by a load uri, and in an embodiment of the present invention, the system player may save the received uri parameter as the variable rec _ url.
In a specific application, a process name corresponding to a current application program may be obtained through a mediaplayer.
If(headers==null){
Map<String,String>headers=new HashMap<String,String>;
headers.put(“process”,process_name);
native SetDataSource (url, heads); // invoking setDataSource of System Player
}
In a specific application, the setDataSource () method in the mediaplayer. In the embodiment of the present invention, when an application calls the setDataSource () method of the system player by calling the setDataSource () method of mediaplayer.
In a specific application, the time when the application program calls the setDataSource () method is the play start time information, and the system player can save the play start time in the variable rec _ time.
In the embodiment of the present invention, the system player may obtain the metadata header file of the video through the parsing module, and obtain the duration information of the video and the title information of the video through parsing, and the system player stores the duration information of the video and the title information of the video in the variables rec _ duration and rec _ title, respectively.
The system player can decode the video file to obtain a video picture for playing through the decoding module, one of the key frames can be stored as a picture thumbnail in the playing process, and the picture thumbnail is stored in the variable rec _ image.
When the video is played completely or the application program actively exits the playing process, the system player can store the values stored in the variables rec _ url, rec _ time, rec _ duration, rec _ processname and rec _ image into the database. Through the process, the system player can store historical records of address information of the multimedia content, process names corresponding to the application programs, playing start time information, multimedia duration information, multimedia title information, multimedia key frame information and the like in a database in the process of playing the multimedia content, so that a user can search the historical playing records of the multimedia content corresponding to various application programs through the database, convenience is brought to the searching process, and the searching efficiency can be improved. For example, after a user opens a system player, the user can see the play history corresponding to each application program in the history option, and compared with the prior art that the user needs to open the player corresponding to each application program to find the history, the search efficiency can be improved. In addition, according to the embodiment of the invention, when the shared videos of the social application programs such as WeChat and microblog are played, the corresponding history records can be recorded.
In a preferred embodiment of the present invention, when the application type information is a browser, the history record may further include: and the address information of the webpage where the multimedia content is located.
In a specific application, if the video playing request is initiated by the browser, the browser can call the system player through a mediaplayer. When the mediaplayer. java interface is called, the address of the current webpage is transferred into setDataSource () of the mediaplayer. java interface through the headers parameter, and the specific process may be as follows:
Map<String,String>headers=new HashMap<String,String>;
headers.put(“webpage”,wepage_url);
media layer setdatasource (url, heads); java call setDataSource
Java calls the system player through mediaplayer, when an application calls the setDataSource () method of the system player through calling the setDataSource () method of mediaplayer, the headers parameter can be transferred to the system player, the system player can acquire the address information of the webpage (reference webpage) where the video is located from the incoming headers parameter, and the address information of the reference webpage is stored in the variable rec _ webpage.
When the video is played completely or the application program actively exits the playing process, the system player can store rec _ webpage in the database while saving rec _ url, rec _ time, rec _ duration, rec _ processname and rec _ image.
The embodiment of the invention can acquire the process name corresponding to the application program through the public interface, and save the process name of the application program and the history record of the multimedia content playing corresponding to the process name in the process of playing the multimedia content. The history records of the multimedia playing called by different application programs and carried out by the player can be uniformly stored and managed, and the user can inquire the history records of the multimedia content playing corresponding to different application programs through the history records, so that the efficiency of inquiring the history records can be improved.
EXAMPLE III
In this embodiment, on the basis of the first embodiment or the second embodiment, a history record playback function may be provided. Referring to fig. 3, a flowchart illustrating a third step of an embodiment of a history record processing method according to the present invention is shown, which may specifically include:
step 301, receiving a call request from an application program; the call request may specifically include: address information of the multimedia content;
step 302, obtaining and playing the multimedia content according to the address information;
step 303, during the process of playing the multimedia content, saving a history record of playing the multimedia content corresponding to the application program;
step 304, displaying the history record of the multimedia content playing corresponding to the application program to the user according to the browsing history record request from the user;
step 305, receiving a playback request selected by a user for the historical record;
and step 306, acquiring and playing the multimedia content according to the address information of the multimedia content in the history record corresponding to the playback request.
In the embodiment of the present invention, after the system player saves the history of playing the multimedia content corresponding to the application program, when the user opens the application program again, the user may select to browse the history, and then the application program reads the corresponding history from the database and displays the history in the display interface of the player, specifically, the history may be displayed in a form of a list.
The user can select a record to be played back from the displayed history records, and the application program can call the system player again for playing through the mediaplayer.
In a preferred embodiment of the present invention, the step of saving the history of playing the multimedia content corresponding to the application program during the playing of the multimedia content may specifically include the following sub-steps:
substep S21, determining the type of the call request, and storing a history record of playing the multimedia content corresponding to the application program in the process of playing the multimedia content when the call request is a first request;
and a substep S22, when the call request is a playback request, skipping the operation of saving the history of the multimedia content playing corresponding to the application program in the process of playing the multimedia content.
In the embodiment of the invention, when a media player.java interface calls a system player, whether the call request is a first request or a playback request can be judged, and when the media player.java interface detects that the call request is a playback request, the media player.java interface can inform the system player that the call request of a current application program is a playback request through a headers parameter in a setDataSource () method; the system player does not save the history record when playing the corresponding video content, so as to avoid the waste of memory resources caused by repeated saving.
In this embodiment of the present invention, the step of determining the type of the invocation request may specifically include:
searching whether a corresponding relation between the process name of the application program and the address information of the multimedia content exists in a history record, and if so, judging that the calling request is a playback request; otherwise, judging the calling request as a first request.
In the embodiment of the present invention, the system player may be informed that the current call request is a playback request through the following steps:
Map<String,String>headers=new HashMap<String,String>;
headers.put(“skip_rec”,“yes”);
mediaplayer.setDataSource(url,headers);
when the system player checks that the call request is a playback request in the headers of the setDataSource (), the operation of saving the history record can be skipped, so as to avoid the waste of memory resources caused by repeated saving.
Device embodiment
Referring to fig. 4, a block diagram of a structure of an embodiment of a history processing apparatus according to the present invention is shown, which may specifically include:
a first request receiving module 410, configured to receive a call request from an application; wherein the invocation request includes: address information of the multimedia content;
a content obtaining module 420, configured to obtain and play the multimedia content according to the address information;
the record saving module 430 is configured to save a history record of playing of the multimedia content corresponding to the application program in the process of playing the multimedia content.
In a preferred embodiment of the present invention, the record saving module 430 may specifically include:
the acquisition submodule is used for acquiring the process name of the application program through a public interface;
and the saving submodule is used for saving the process name of the application program and the history record of the multimedia content playing corresponding to the process name.
In another preferred embodiment of the present invention, the apparatus may further include:
the record display module is used for displaying the history record of the multimedia content playing corresponding to the application program to the user according to the browsing history record request from the user;
the second request receiving module is used for receiving a playback request of the user for the historical record selection;
and the content playing module is used for acquiring and playing the multimedia content according to the address information of the multimedia content in the history record corresponding to the playback request.
In another preferred embodiment of the present invention, the record saving module 430 may specifically include:
the type judgment submodule is used for judging the type of the calling request, and storing a history record of playing the multimedia content corresponding to the application program in the process of playing the multimedia content when the calling request is a first request;
and the record skipping submodule is used for skipping the operation of saving the history record of the multimedia content playing corresponding to the application program in the process of playing the multimedia content when the calling request is a playback request.
In another preferred embodiment of the present invention, the type determining sub-module may specifically include:
the judging unit is used for searching whether the corresponding relation between the process name of the application program and the address information of the multimedia content exists in a historical record, and if so, judging that the calling request is a playback request; otherwise, judging the calling request as a first request.
In a further preferred embodiment of the invention, the history record may comprise at least any one of the following information:
the address information of the multimedia content, the process name corresponding to the application program, the playing start time information, the multimedia duration information, the multimedia title information and the multimedia key frame information.
In a further preferred embodiment of the present invention, the invoking request may further include: application type information;
when the application type information is a browser, the history record may further include: and the address information of the webpage where the multimedia content is located.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.