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. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
The following embodiments of the present invention can be applied to the environment shown in fig. 1 without specific description, and as shown in fig. 1, the sharing server 100, the mobile terminal 400, and the third-party CDN300 are respectively connected in communication by a wired or wireless network.
The third-party CDN300 is a distributed file storage architecture system provided by a third party, and the system employs a Content Delivery Network (CDN). The third-party CDN300 includes a plurality of third-party CDN nodes and a location server. The multiple third-party CND nodes are used for sharing storage load, and the position server is used for positioning storage information, so that the reliability, the availability and the access efficiency of the system are improved, and the expansion is easy. The third-party CDN node can avoid bottlenecks and links which possibly influence the data transmission speed and stability on the Internet as far as possible, so that the content transmission is faster and more stable. Specifically, the third-party CDN300 is a one-layer intelligent virtual network based on an existing network, and is configured by placing storage servers (third-party CDN nodes) at nodes of each network, and the third-party CDN nodes can redirect requests or voice data of users to the third-party CDN nodes closest to the users in real time according to traffic of the network and comprehensive information such as connection, load conditions, distances to the users, and response time of each node. The method aims to enable the user to store and obtain the required content nearby and solve the problem of the congestion of the Internet network.
Fig. 2 is a block diagram of the sharing server 100. The sharing server 100 includes a video sharing device 200, a memory 111, a processor 112, and a communication unit 113.
The memory 111, the processor 112 and the communication unit 113 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The video sharing apparatus 200 includes at least one software function module which can be stored in the memory 111 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the sharing server 100. The processor 112 is configured to execute executable modules stored in the memory 111, such as software functional modules and computer programs included in the video sharing apparatus 200.
The Memory 111 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 111 is used for storing a program and voice data, and the processor 112 executes the program after receiving an execution instruction.
The communication unit 113 is configured to establish a communication connection between the sharing server 100 and the mobile terminal 400 and the third-party CDN300 through the network, and to receive and transmit data through the network.
First embodiment
Fig. 3 is a flowchart illustrating a video sharing method applied to the application environment shown in fig. 1 according to a preferred embodiment of the present invention. As shown in fig. 3, the video sharing method includes the following steps:
step S101, the mobile terminal 400 responds to a user operation, and queries whether the corresponding video to be shared exists according to the obtained storage path.
In this embodiment, whether a video exists is queried on the mobile terminal 400 according to the acquired storage path, where the existing video is a video to be shared. And if the video flow does not exist, avoiding the program exception caused by uploading a non-existing video.
Step S102, when the video to be shared exists, the mobile terminal 400 acquires the video to be shared.
In this embodiment, according to the storage path, the mobile terminal 400 constructs a local video collection object AVURLAsset. This video collection object is composed of a plurality of sub-videos of the video to be shared.
Step S103, the mobile terminal 400 obtains feature information of the video to be shared.
In this embodiment, the feature information includes capacity information and identification information of the video to be shared. The capacity information may be size information of the video to be shared. Optionally, the obtaining of the capacity information of the video to be shared by the mobile terminal 400 may be calculating the size information of each sub-video by sequentially obtaining the number of bytes per second and the duration information of each sub-video in the video set object AVURLAsset, and then overlapping the size information of all the sub-videos to obtain the capacity information of the video to be shared. For example, the number of wonderful bytes of each sub-video can be obtained by calling the function estimatedatatrate, and then the duration information of each sub-video can be obtained by calling the function CMTimeGetSeconds. The identification information is unique information defined for the video to be shared, and the identification information can be a unique name of the video to be shared and can also be a unique number of the video to be shared.
In step S104, the mobile terminal 400 sends the feature information to the third-party CDN300 through the sharing server 100.
In this embodiment, the mobile terminal 400 sends the feature information to the sharing server 100. For example, the mobile terminal 400 calls a network request function "assign _ getuploadvideotokenjndaurlhiltfulfilename" by using a network request tool type InterfaceManager, and the request function "assign _ getuploadvideotokenjndaurlhfulfilename" takes the feature information as a parameter to transmit the feature data to the sharing server 100.
After the sharing server 100 receives the feature information, the sharing server 100 obtains the current load information of each third-party CDN 300. The sharing server 100 selects a target CDN from the third-party CDN300 according to the capacity information in the feature information and the current load information. Namely, the third-party CDN300 with the best current operating state is selected from the plurality of third-party CDNs 300 as the target CDN. Optionally, when the target CDN is selected, the target CDN may be selected from the third-party CDN300 by combining a priority level set in the sharing server 100 in advance according to a previous cooperation situation. The sharing server 100 sends the feature information to the target CDN.
Step S105, the third-party CDN300 allocates, according to the feature information, a third-party CDN node that allows storage to the video to be shared, so as to obtain a storage address and qualification information that the video to be shared is allowed to be stored at the third-party CDN node.
In this embodiment, the target CDN selects a target CDN node from the multiple corresponding third-party CDN nodes according to the feature information as a storage node for storing the video to be shared. Optionally, the feature information may further include location information, network information, and the like of the mobile terminal 400, and the target CDN may select a target CDN node from the corresponding third-party CDN nodes according to a preset algorithm according to the capacity information, the location information, and the network information in the feature information. And the target CDN acquires the address of the target CDN node as the storage address. And then sending the characteristic information to the target CDN node to obtain qualification information which is generated by the target CDN node according to the characteristic information and can be used for storing the corresponding video to be shared at the target CDN node. The qualification information may include an identifier of the target CDN node, identifier information of the video to be shared, and capacity information.
Step S106, the third CDN300 issues a storage address and qualification information to the mobile terminal 400 through the sharing server 100.
In this embodiment, the sharing server 100 sends the storage address and the qualification information to the mobile terminal 400, so that the mobile terminal 400 can share the video at the last time with the storage address and the qualification information. The information under the sharing server 100 is more reliable. The user of the mobile terminal 400 can use the mobile terminal with ease, and user experience is improved. Meanwhile, the control of the sharing server 100 on the whole sharing process can be strengthened through the sharing server 100. The sharing server 100 can be used for improving the cooperation with the service provided by the third party.
Step S107, the mobile terminal 400 generates an upload request according to the qualification information and the identification information corresponding to the video to be shared, and sends the upload request to the third-party CDN node corresponding to the storage address.
Step S108, the third-party CDN node verifies the uploading request.
In this embodiment, the third-party CDN node that receives the upload request verifies the qualification information in the upload request. The third-party CDN node that receives the upload request verifies whether the qualification information in the upload request is qualification information generated and sent by itself, for example, checks whether a target node identifier in the qualification information is consistent with a node identifier of itself, and if so, passes the qualification information verification. And when the qualification information passes verification, verifying the identification information of the video to be shared corresponding to the uploading request according to the qualification information. Optionally, whether the identification information in the qualification information is the same as the identification information corresponding to the shared video in the upload request is verified, and if the identification information is the same, the verification is passed. It should be noted that whether the identification information in the qualification information is the same as the identification information corresponding to the shared video in the upload request is checked to ensure that the shared video requested to be sent to the third-party CDN300 by the sharing server 100 is consistent with the shared video finally sent to the third-party CDN300 by the mobile terminal 400.
Step S109, when the upload request passes verification, the third-party CDN node receives and stores the video to be shared.
In this embodiment, after the third-party CDN node stores the video to be shared, video address information is generated according to a specific location of the video to be shared, where the video is stored in the third-party CDN node.
Step S110, the third-party CDN node feeds back, to the sharing server 100 through the mobile terminal 400, video address information (for example, a video id) corresponding to the video to be shared, so that the mobile terminal 400 obtains a video sharing address from the sharing server 100. It should be noted that, after the mobile terminal 400 receives the video address information, the video to be shared can be deleted from the local storage space, so that the memory usage is reduced.
Step S111, when the sharing server 100 receives the sharing request sent by the mobile terminal 400, matching corresponding video address information according to the sharing request.
In this embodiment, when the mobile terminal 400 needs to share the video to be shared, a sharing request is generated according to the video identification information of the video to be shared, and is sent to the sharing server 100. The sharing server 100 searches for the stored video address information corresponding to the identification information according to the sharing request.
In step S112, the sharing server 100 generates the video sharing address by splicing according to the video address information, and sends the video sharing address to the mobile terminal 400.
In this embodiment, an h5 address is spliced according to the video address information. So that the user who obtains the video sharing address can directly obtain and watch the video to be shared from the third-party CDN300 through the address.
Second embodiment
Referring to fig. 4, a flowchart of a video sharing method applied to the sharing server 100 shown in fig. 1 according to a preferred embodiment of the present invention is shown. The method comprises the following steps:
step S201, receiving the feature information sent by the mobile terminal 400.
In this embodiment, the feature information includes capacity information and identification information of the video to be shared.
Step S202, obtaining a third-party CDN node allowed to be stored from the third-party CDN300 according to the feature information.
In the same way, a third-party CDN node allowing storage is selected, and a storage address and qualification information that the video to be shared is allowed to be stored in the third-party CDN node are obtained. Alternatively, as shown in fig. 5, step S202 may include the following sub-steps:
in the substep S2021, current load information of each third party CDN300 is obtained.
And a substep S2022, selecting a target CDN from the third party CDN300 according to the capacity information and the current load information.
Substep S2023, sending the characteristic information to the target CDN.
And a substep S2024, receiving the storage address and qualification information fed back by the target CDN, where the storage address is a storage address of a target CDN node selected by the target CDN from a plurality of corresponding third-party CDN nodes according to the capacity information, and the qualification information is the qualification information generated by the target CDN node according to the identification information in the feature information.
Step S203, feeding back the storage address and qualification information to the mobile terminal 400.
In this embodiment, the mobile terminal 400 generates an upload request according to the qualification information and the identification information corresponding to the video to be shared, and sends the upload request to the third-party CDN node corresponding to the storage address. The third-party CDN node verifies the upload request. And when the uploading request passes the verification, the third-party CDN node receives and stores the video to be shared, and generates video address information corresponding to the video to be shared according to the address for storing the video to be shared.
Step S204, receiving video address information corresponding to the video to be shared, which is fed back by the third-party CDN node through the mobile terminal 400.
Step S205, when receiving the sharing request sent by the mobile terminal 400, obtaining the corresponding video address information according to the sharing request to generate a video sharing address.
In this embodiment, when the mobile terminal 400 needs to share the video to be shared, a sharing request is generated according to the video identification information of the video to be shared, and is sent to the sharing server 100. The sharing server 100 searches for the stored video address information corresponding to the identification information according to the sharing request. The sharing server 100 splices the video sharing addresses according to the video address information (e.g., splices an h5 address). So that the user who obtains the video sharing address can directly obtain and watch the video to be shared from the third-party CDN300 through the address.
Step S206, feeding back the video sharing address to the mobile terminal 400.
Third embodiment
Referring to fig. 6, fig. 6 is a video sharing device 200 applied to the sharing server 100 shown in fig. 1 according to a preferred embodiment of the present invention, where the video sharing device 200 includes: the device comprises a receiving module 201, an obtaining module 202, a feedback module 203 and a generating module 204.
A receiving module 201, configured to receive feature information sent by the mobile terminal 400, where the feature information includes capacity information and identification information of the video to be shared.
In this embodiment of the present invention, the step S201 may be performed by the receiving module 201.
An obtaining module 202, configured to obtain, from a third-party CDN300 according to the feature information, a third-party CDN node that is allowed to be stored, so as to obtain a storage address and qualification information that the video to be shared is allowed to be stored at the third-party CDN node.
In this embodiment of the present invention, the step S202 may be executed by the obtaining module 202. As shown in fig. 7, the obtaining module 202 further includes the following functional sub-modules:
the obtaining sub-module 2021 is configured to obtain current load information of each third party CDN 300.
In the embodiment of the present invention, the sub-step S2021 may be performed by the obtaining sub-module 2021.
The selecting sub-module 2022 is configured to select a target CDN from the third party CDN300 according to the capacity information and the current load information.
In an embodiment of the present invention, the sub-step S2022 may be performed by the selecting sub-module 2022.
The sending submodule 2023 is configured to send the feature information to the target CDN.
In the embodiment of the present invention, the sub-step S2023 may be performed by the sending sub-module 2023.
The receiving submodule 2024 is configured to receive the storage address and qualification information fed back by the target CDN, where the storage address is a storage address of a target CDN node selected by the target CDN from multiple corresponding third-party CDN nodes according to the capacity information, and the qualification information is the qualification information generated by the target CDN node according to the identification information in the feature information.
In the embodiment of the present invention, the sub-step S2024 may be performed by the receiving sub-module 2024.
A feedback module 203, configured to feed back the storage address and the qualification information to the mobile terminal 400, so that the mobile terminal 400 generates an upload request according to the qualification information and the identification information corresponding to the video to be shared, and sends the upload request to a third-party CDN node corresponding to the storage address.
In this embodiment of the present invention, the step S203 may be performed by the feedback module 203.
The receiving module 201 is further configured to receive video address information corresponding to the video to be shared, which is fed back by the third-party CDN node through the mobile terminal 400.
In this embodiment of the present invention, the step S204 may be executed by the receiving module 201.
The generating module 204 is configured to, when receiving a sharing request sent by the mobile terminal 400, obtain the corresponding video address information according to the sharing request to generate a video sharing address, where the sharing request corresponds to the video to be shared.
In this embodiment of the present invention, the step S205 may be executed by the generating module 204.
The feedback module 203 is further configured to feed back the video sharing address to the mobile terminal 400.
In this embodiment of the present invention, the step S206 may be performed by the feedback module 203.
In summary, the video sharing method, device and sharing server provided by the present invention include: the method comprises the steps that the mobile terminal obtains feature information of a video to be shared, wherein the feature information comprises capacity information and identification information of the video to be shared; the mobile terminal sends the feature information to the third-party CDN through the sharing server; the third-party CDN allocates a storage address of the third-party CDN node allowed to be stored for the video to be shared and qualification information of the video to be shared, which is allowed to be stored in the third-party CDN node, to the third-party CDN according to the characteristic information; the third-party CDN sends a storage address and qualification information to the mobile terminal through the sharing server; the mobile terminal generates an uploading request according to the qualification information and the identification information corresponding to the video to be shared and sends the uploading request to a third-party CDN node corresponding to the storage address; the third-party CDN node verifies the upload request; when the uploading request passes verification, the third-party CDN node receives and stores the video to be shared; the third-party CDN node feeds back video address information corresponding to the video to be shared to the sharing server through the mobile terminal, so that the mobile terminal can obtain a video sharing address from the sharing server. The association between the sharing server and the third party CDN is strengthened. The advantage of low cost of the third-party CDN is utilized, the whole video to be shared can be effectively managed in the sharing process, and efficient cooperation between the third-party CDN and the sharing server is enhanced.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.