CN113115102B - Streaming media playing method and device - Google Patents

Streaming media playing method and device Download PDF

Info

Publication number
CN113115102B
CN113115102B CN202110371941.6A CN202110371941A CN113115102B CN 113115102 B CN113115102 B CN 113115102B CN 202110371941 A CN202110371941 A CN 202110371941A CN 113115102 B CN113115102 B CN 113115102B
Authority
CN
China
Prior art keywords
domain name
video
played
resolution
name resolution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110371941.6A
Other languages
Chinese (zh)
Other versions
CN113115102A (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.)
Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Original Assignee
Hunan Happly Sunshine Interactive Entertainment Media 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 Hunan Happly Sunshine Interactive Entertainment Media Co Ltd filed Critical Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Priority to CN202110371941.6A priority Critical patent/CN113115102B/en
Publication of CN113115102A publication Critical patent/CN113115102A/en
Application granted granted Critical
Publication of CN113115102B publication Critical patent/CN113115102B/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/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/238Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • 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/438Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving encoded video stream packets from an IP network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
    • H04N21/8586Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot by using a URL

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a streaming media playing method and a streaming media playing device, after domain name resolution fails, according to a corresponding error type of last resolution, such as domain name resolution failure or downloading failure caused by network jitter, abnormal downloaded data caused by operator hijacking and the like, the domain name resolution is carried out by adopting a domain name resolution mode corresponding to the error type, the success rate of the domain name resolution is improved, the problem of playing failure caused by network jitter, operator hijacking and the like is solved, and user experience is improved.

Description

Streaming media playing method and device
Technical Field
The present invention relates to the technical field of streaming media playing, and more particularly, to a streaming media playing method and apparatus.
Background
Streaming Media (Streaming Media) technology is a technology that compresses a series of Media data and then transmits the compressed Media data in a Streaming manner in segments in a network to realize real-time transmission and playing on the network, and is widely applied to the internet field.
The domain name resolution module is the most basic module in the stream media playing, and normal playing cannot be realized if the domain name resolution fails. Domain name resolution typically includes local domain name resolution and mobile internet domain name resolution. In the prior art, when a player plays an online video, a data module performs domain name resolution on a playing address, the domain name resolution uses local domain name resolution, http domain name resolution is tried once when the local domain name resolution fails, video data acquisition is started when the domain name resolution succeeds, and if the local domain name resolution fails, a playing failure is prompted. If network jitter occurs or the operator hijacks a scene, playing is easy to fail.
Disclosure of Invention
In view of this, the present invention provides a streaming media playing method and apparatus, which implement flexible domain name resolution and solve the problem of playing failure caused by network jitter and operator hijacking.
In order to achieve the above purpose, the invention provides the following specific technical scheme:
a streaming media playing method, comprising:
determining a domain name to be analyzed of a video to be played under the condition of receiving a playing instruction;
judging whether the domain name to be analyzed is analyzed for the first time;
if the first time of resolution, local domain name resolution is adopted, system domain name resolution is adopted when the local domain name resolution fails, and http domain name resolution is adopted when the system domain name resolution fails;
if the domain name is not analyzed for the first time, acquiring an error type corresponding to the last analysis, determining a domain name analyzing mode of the time according to the error type, and analyzing the domain name to be analyzed according to the domain name analyzing mode;
judging whether the domain name resolution is successful to resolve the IP address corresponding to the domain name to be resolved;
if the resolution fails, returning to execute the judgment of whether the domain name to be resolved is the first resolution or not;
if the resolution is successful, accessing an IP address corresponding to the domain name to be resolved to download the video to be played;
and playing the video to be played under the condition of successfully downloading the video to be played.
Optionally, the determining the domain name to be analyzed of the video to be played includes:
analyzing the playing instruction to obtain the URL of the video to be played, and determining a domain name and a port number corresponding to the URL of the video to be played;
inquiring whether the IP address corresponding to the domain name and the port number exists in a cache;
and determining the domain name as the domain name to be analyzed of the video to be played under the condition that the IP address corresponding to the domain name and the port number does not exist in the cache.
Optionally, the method further includes:
and under the condition that the IP addresses corresponding to the domain name and the port number exist in the cache, accessing the IP addresses corresponding to the domain name and the port number to download the video to be played.
Optionally, in the case that the video to be played is successfully downloaded, the method further includes:
and storing the corresponding relation between the combination of the domain name to be analyzed and the port number and the IP address in a cache.
Optionally, after the video to be played is downloaded by accessing the IP address corresponding to the domain name, the method further includes:
and if the video to be played is not downloaded successfully, deleting the corresponding relation between the combination of the domain name and the port number and the IP address stored in the cache.
Optionally, after storing the correspondence between the combination of the domain name to be resolved and the port number and the IP address in a cache, the method further includes:
recording the time for storing the corresponding relation between the combination of the domain name to be analyzed and the port number and the IP address into a cache;
and deleting the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache under the condition that the time for storing the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache reaches a preset survival time value.
Optionally, the determining the domain name to be analyzed of the video to be played includes:
analyzing the playing instruction to obtain the identifier and URL of the video to be played, wherein the identifier of the video to be played is generated by the server side according to the domain name and the port number by using a preset method in advance;
inquiring whether an IP address corresponding to the identifier of the video to be played exists in a cache;
and under the condition that the IP address corresponding to the identifier of the video to be played does not exist in the cache, determining the domain name in the URL of the video to be played as the domain name to be analyzed.
Optionally, when the IP address corresponding to the identifier of the video to be played exists in the cache, accessing the IP address corresponding to the identifier of the video to be played to download the video to be played;
and storing the corresponding relation between the identification of the video to be played and the IP address in a cache.
Optionally, accessing the IP address corresponding to the domain name to be resolved to download the video to be played includes:
accessing an IP address corresponding to the domain name to be analyzed to download the video to be played;
judging whether the video to be played is downloaded successfully;
if the downloading is successful, judging whether the downloaded data is abnormal data;
if the video is not abnormal data, triggering and executing the video to be played;
if the domain name to be analyzed is abnormal data, returning to execute the judgment of whether the domain name to be analyzed is analyzed for the first time.
Optionally, the determining the domain name resolution mode according to the error type includes:
when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution;
when the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, and http domain name resolution is adopted after resolution fails;
and if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
Optionally, in a case that it is determined that the domain name to be resolved is not the first resolution, the method further includes:
judging whether the retry times corresponding to the domain name to be analyzed reach a threshold value;
if the threshold value is reached, finishing retry and prompting that the playing is failed;
and if the error type does not reach the threshold value, triggering and executing the acquisition of the error type corresponding to the last analysis.
A streaming media playing apparatus, comprising:
the domain name to be analyzed determining unit is used for determining the domain name to be analyzed of the video to be played under the condition of receiving the playing instruction;
the first judging unit is used for judging whether the domain name to be analyzed is analyzed for the first time, if the domain name to be analyzed is analyzed for the first time, the first domain name analyzing unit is triggered, and if the domain name to be analyzed is not analyzed for the first time, the second domain name analyzing unit is triggered;
the first domain name resolution unit is used for adopting local domain name resolution, the system domain name resolution is adopted when the local domain name resolution fails, and the http domain name resolution is adopted when the system domain name resolution fails;
the second domain name resolution unit is used for acquiring an error type corresponding to the last resolution, determining a domain name resolution mode of this time according to the error type, and resolving the domain name to be resolved according to the domain name resolution mode;
the second judging unit is used for judging whether the domain name resolution is successful or not to resolve the IP address corresponding to the domain name to be resolved, if the resolution is failed, the first judging unit is triggered, and if the resolution is successful, the downloading unit is triggered;
the downloading unit is used for accessing the IP address corresponding to the domain name to be analyzed to download the video to be played;
and the video playing unit is used for playing the video to be played under the condition of successfully downloading the video to be played.
Optionally, the domain name to be resolved determining unit is specifically configured to:
analyzing the playing instruction to obtain the URL of the video to be played, and determining a domain name and a port number corresponding to the URL of the video to be played;
inquiring whether the IP address corresponding to the domain name and the port number exists in a cache;
and determining the domain name as the domain name to be analyzed of the video to be played under the condition that the IP address corresponding to the domain name and the port number does not exist in the cache.
Optionally, the downloading unit is further configured to, in a case that the IP address corresponding to the domain name and the port number exists in the cache, access the IP address corresponding to the domain name and the port number to download the video to be played.
Optionally, the apparatus further includes a cache management unit, configured to store, in a cache, a correspondence between the combination of the domain name to be resolved and the port number and the IP address when the video to be played is successfully downloaded.
Optionally, the cache management unit is further configured to delete the correspondence between the combination of the domain name and the port number stored in the cache and the IP address if the video to be played is not successfully downloaded after the video to be played is downloaded by accessing the IP address corresponding to the domain name.
Optionally, the cache management unit is further configured to record, after storing the corresponding relationship between the combination of the domain name to be resolved and the port number and the IP address in a cache, a time for storing the corresponding relationship between the combination of the domain name to be resolved and the port number and the IP address in the cache; and deleting the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache under the condition that the time for storing the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache reaches a preset survival time value.
Optionally, the domain name to be resolved determining unit is specifically configured to:
analyzing the playing instruction to obtain the identifier and URL of the video to be played, wherein the identifier of the video to be played is generated by the server side according to the domain name and the port number by using a preset method in advance;
inquiring whether an IP address corresponding to the identifier of the video to be played exists in a cache;
and under the condition that the IP address corresponding to the identifier of the video to be played does not exist in the cache, determining the domain name in the URL of the video to be played as the domain name to be analyzed.
Optionally, the downloading unit is further configured to, in a case that the IP address corresponding to the identifier of the video to be played exists in the cache, access the IP address corresponding to the identifier of the video to be played to download the video to be played;
the device also comprises a cache management unit used for storing the corresponding relation between the identification of the video to be played and the IP address in a cache under the condition of successfully downloading the video to be played.
Optionally, the downloading unit is specifically configured to:
accessing an IP address corresponding to the domain name to be analyzed to download the video to be played;
judging whether the video to be played is downloaded successfully;
if the downloading is successful, judging whether the downloaded data is abnormal data;
if the data is not abnormal data, triggering the video playing unit;
and if the data is abnormal data, triggering the first judgment unit.
Optionally, the second domain name resolution unit is specifically configured to:
when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution;
when the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, and http domain name resolution is adopted after resolution fails;
and if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
Optionally, the apparatus further comprises:
a third determining unit, configured to determine whether a retry number corresponding to the domain name to be resolved reaches a threshold value when it is determined that the domain name to be resolved is not the first resolution; if the threshold value is reached, finishing retry and prompting that the playing is failed; and if the domain name is not up to the threshold value, triggering the second domain name resolution unit.
Compared with the prior art, the invention has the following beneficial effects:
according to the method for playing the streaming media, after domain name resolution fails, according to the error type corresponding to the last resolution, such as domain name resolution failure or downloading failure caused by network jitter, abnormal downloading data caused by hijacking of an operator and the like, the domain name resolution is carried out in a domain name resolution mode corresponding to the error type, the success rate of domain name resolution is improved, the problem of playing failure caused by network jitter, hijacking of the operator and the like is solved, and user experience is improved.
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, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flow chart of a streaming media playing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for determining a domain name to be resolved of a video to be played according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for accessing an IP address corresponding to a domain name to be resolved to download a video to be played in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a streaming media playing apparatus according to an embodiment of the present invention.
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.
The invention provides a streaming media playing method, which realizes flexible region name resolution, solves the problem of playing failure caused by network jitter and operator hijacking, reduces the error rate of network audio and video data pulling failure, obviously improves the streaming success rate, ensures that users play more smoothly and further effectively improves the user experience.
Referring to fig. 1, the embodiment of the present invention discloses a streaming media playing method, which specifically includes the following steps:
s101: determining a domain name to be analyzed of a video to be played under the condition of receiving a playing instruction;
one of the ways is: under the condition of receiving a playing instruction, analyzing the playing instruction to obtain the URL of the video to be played, determining the domain name and the port number corresponding to the URL of the video to be played, and directly taking the domain name as the domain name to be analyzed of the video to be played.
Further, in order to improve the video playing speed and efficiency, in this embodiment, the corresponding relationship between the successfully analyzed domain name and port number combination and the IP address is stored in the cache, and when the domain name of the video to be played and the IP address corresponding to the port number exist in the cache, the video to be played is downloaded by directly accessing the IP address without performing analysis, so that the domain name analyzing time is effectively saved, and when the domain name of the video to be played and the IP address corresponding to the port number do not exist in the cache, the domain name is determined as the domain name of the video to be played to be analyzed.
That is to say, the domain name and the IP address corresponding to the port number of the video to be played are obtained by querying the cache, and domain name resolution is performed only when the domain name and the IP address corresponding to the port number of the video to be played do not exist in the cache, so that the domain name resolution time is effectively saved, and the video playing efficiency is improved.
On this basis, referring to fig. 2, another method for determining a domain name to be resolved of a video to be played provided by this embodiment is as follows:
s201: analyzing the playing instruction to obtain the URL of the video to be played, and determining the domain name and the port number corresponding to the URL of the video to be played;
it should be noted that, when no port number is included in the URL, a default port number is used, where the http default port is 80, and the https default port is 443.
S202: inquiring whether an IP address corresponding to the domain name and the port number exists in a cache;
if the IP address corresponding to the domain name and the port number exists in the cache, S203 is executed: accessing the IP address corresponding to the domain name and the port number to download the video to be played;
if the IP address corresponding to the domain name and the port number does not exist in the cache, S204 is executed: and determining the domain name as a domain name to be analyzed of the video to be played.
It should be noted that, when the domain name to be resolved is successfully resolved subsequently and the video to be played is successfully downloaded, the corresponding relationship between the combination of the domain name and the port number to be resolved and the IP address is stored in the cache, for example, the domain name + the port number are used as the key for indexing, the IP address is used as the value for storage, and the domain name + the port number are used as the key to ensure the uniqueness of the key, so that the unique corresponding IP address can be accurately queried, the domain name does not need to be resolved when the video is played next time, the domain name and the IP address corresponding to the port number of the video are directly queried in the cache, thereby effectively saving the domain name resolution time and improving the video playing efficiency.
When the video to be played is downloaded by accessing the IP address corresponding to the domain name and the port number of the video to be played in the cache, but the video to be played is not successfully downloaded, the corresponding relation between the domain name and the port number combination stored in the cache and the IP address is deleted, and the problem that the video to be played is downloaded unsuccessfully due to the fact that the IP address in the cache is accessed subsequently is avoided.
The IP address corresponding To the domain name and the port number stored in the cache may be invalid, and preferably, a Time To Live (TTL) value may be set for the correspondence between the combination of the domain name and the port number stored in the cache and the IP address, for example, set To 45 seconds. After the corresponding relation between the combination of the domain name and the port number to be resolved and the IP address is stored in the cache, the time for storing the corresponding relation between the combination of the domain name and the port number to be resolved and the IP address in the cache is recorded, when the time for storing the corresponding relation between the combination of the domain name and the port number to be resolved and the IP address in the cache reaches a preset survival time value, the IP address corresponding to the domain name to be resolved is invalid, the corresponding relation between the combination of the domain name and the port number to be resolved and the IP address in the cache is deleted, and after the deletion, the corresponding relation between the corresponding combination of the domain name and the port number and the IP address does not exist in the cache, and the domain name resolution needs to be carried out again.
Further, in order to facilitate unified management, the server side simultaneously issues an identifier and a URL of the video to be played in the playing instruction, wherein the identifier is used as a cache key of the IP address analyzed by the client side dns and has a unique characteristic. The identifier of the video to be played is generated by the server side according to the domain name and the port number by using a preset method in advance, for example, the identifier of the video is generated through a protocol such as http or https, the domain name, the port and the service type.
On the basis, under the condition that a playing instruction is received, the playing instruction is analyzed to obtain the identifier and the URL of the video to be played, whether an IP address corresponding to the identifier of the video to be played exists or not is inquired in the cache, and under the condition that the IP address corresponding to the identifier of the video to be played does not exist in the cache, the domain name in the URL of the video to be played is determined to be the domain name to be analyzed. And under the condition that the IP address corresponding to the identifier of the video to be played exists in the cache, accessing the IP address corresponding to the identifier of the video to be played to download the video to be played, and storing the corresponding relation between the identifier of the video to be played and the IP address into the cache. And when the IP address corresponding to the identifier of the video to be played in the cache is accessed to download the video to be played, but the video to be played is not successfully downloaded, deleting the corresponding relation between the identifier of the video to be played and the IP address stored in the cache.
The same way as in the above embodiment is that the lifetime value is set for the correspondence between the IP address and the combination of the domain name and the port number stored in the cache, or the lifetime value may be set for the correspondence between the IP address and the identifier of the video stored in the cache, and the correspondence between the IP address and the identifier of the video in the cache is deleted when the lifetime value reaches the preset lifetime value.
S102: judging whether the domain name to be resolved is resolved for the first time;
if the analysis is the first analysis, S103: local domain name resolution is adopted, system domain name resolution is adopted when local domain name resolution fails, and http domain name resolution is adopted when system domain name resolution fails;
the embodiment is not limited to the case that the local domain name resolution API is getaddrinfo, and the system domain name resolution is an API that is opened to the application layer by the current operating system.
If not, S104: acquiring an error type corresponding to the last resolution, determining a domain name resolution mode of this time according to the error type, and resolving the domain name to be resolved according to the domain name resolution mode;
the error types include: domain name resolution failure, data download anomaly, download failure, etc.
Specifically, the error type may be determined according to the playing error code, for example, the error code of domain name resolution failure due to network jitter is 300600, and the error code of download data abnormality due to hijacking error is 100701.
And when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution.
When the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, so as to avoid misjudgment of the last domain name resolution, and if the local domain name resolution fails, adopting http domain name resolution.
And if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
According to the method and the device, aiming at different error types corresponding to the last time of resolution, the corresponding domain name resolution mode is adopted for the domain name resolution, the success rate of the domain name resolution is improved, repeated retry is avoided, the domain name resolution time is saved, the pull-stream success rate is improved, the user playing is smoother, and the experience of watching videos by the user is effectively improved.
S105: judging whether the domain name resolution is successful to resolve the IP address corresponding to the domain name to be resolved;
if the analysis fails, returning to execute S102;
if the analysis is successful, S106: accessing an IP address corresponding to the domain name to be analyzed to download a video to be played;
preferably, in order to further ensure successful playing of the video, after downloading the video to be played, the embodiment of the present invention further determines whether the video to be played is successfully downloaded, please refer to fig. 3, and a method for accessing an IP address corresponding to a domain name to be resolved to download the video to be played disclosed in this embodiment includes the following steps:
s301: accessing an IP address corresponding to the domain name to be analyzed to download a video to be played;
s302: judging whether the video to be played is downloaded successfully;
if the download fails, S303: and prompting the download failure.
And returning to execute to judge whether the domain name to be analyzed is analyzed for the first time, and further carrying out domain name analysis again.
If the downloading is successful, S304: judging whether the downloaded data is abnormal data;
if the downloaded data is web page data, e.g. the data contains the standard html tag "< |! The data downloading method comprises the steps of determining that the downloaded data is abnormal data if DOTYPE html > ' or ' </html > ' or the downloaded data is not a ts or mp4 file and cannot be played normally.
If not, S305: triggering and executing to-be-played video;
if the data is abnormal, it indicates that the downloading of the video to be played fails, S303 is executed, and it is necessary to return to execute to determine whether the domain name to be resolved is the first resolution, and further perform domain name resolution again.
S107: and playing the video to be played under the condition of successfully downloading the video to be played.
And under the condition of successfully downloading the video to be played, decapsulating and decoding the video data to be played, and rendering and playing.
Further, in order to avoid unlimited domain name resolution retry, in this embodiment, a threshold of domain name resolution retry times is preset, and under the condition that it is determined that the domain name to be resolved is not the first resolution, it is determined whether the retry times corresponding to the domain name to be resolved reaches the threshold, if the retry times reach the threshold, the retry is ended, and a play failure is prompted, if the retry times do not reach the threshold, the execution is triggered to obtain an error type corresponding to the last resolution, the domain name resolution mode of this time is determined according to the error type, and the domain name to be resolved is resolved according to the domain name resolution mode.
It can be seen that, in the streaming media playing method disclosed in this embodiment, after domain name resolution fails, according to an error type corresponding to last resolution, such as domain name resolution failure or download failure due to network jitter, abnormal download data due to operator hijacking, and the like, the domain name resolution is performed in a domain name resolution mode corresponding to the error type, so that a success rate of domain name resolution is improved, a problem of playing failure due to network jitter, operator hijacking, and the like is solved, and user experience is improved.
Based on the method for playing streaming media disclosed in the foregoing embodiment, this embodiment correspondingly discloses a device for playing streaming media, please refer to fig. 4, where the device includes:
a domain name to be resolved determining unit 100, configured to determine a domain name to be resolved of a video to be played when a play instruction is received;
a first determining unit 200, configured to determine whether the domain name to be resolved is resolved for the first time, if so, trigger the first domain name resolving unit 300, and if not, trigger the second domain name resolving unit 400;
the first domain name resolution unit 300 is configured to use local domain name resolution, where a system domain name resolution is used for a local domain name resolution failure, and a http domain name resolution is used for a system domain name resolution failure;
the second domain name resolution unit 400 is configured to obtain an error type corresponding to the last resolution, determine a domain name resolution mode of this time according to the error type, and resolve the domain name to be resolved according to the domain name resolution mode;
a second determining unit 500, configured to determine whether the domain name resolution is successful in resolving the IP address corresponding to the domain name to be resolved, if the resolution fails, trigger the first determining unit 200, and if the resolution is successful, trigger the downloading unit 600;
the downloading unit 600 is configured to access the IP address corresponding to the domain name to be resolved to download the video to be played;
the video playing unit 700 is configured to play the video to be played when the video to be played is successfully downloaded.
Optionally, the domain name to be resolved determining unit 100 is specifically configured to:
analyzing the playing instruction to obtain the URL of the video to be played, and determining a domain name and a port number corresponding to the URL of the video to be played;
inquiring whether the IP address corresponding to the domain name and the port number exists in a cache;
and determining the domain name as the domain name to be analyzed of the video to be played under the condition that the IP address corresponding to the domain name and the port number does not exist in the cache.
Optionally, the downloading unit 600 is further configured to, in the case that the IP address corresponding to the domain name and the port number exists in the cache, access the IP address corresponding to the domain name and the port number to download the video to be played.
Optionally, the apparatus further includes a cache management unit, configured to store, in a cache, a correspondence between the combination of the domain name to be resolved and the port number and the IP address when the video to be played is successfully downloaded.
Optionally, the cache management unit is further configured to delete the correspondence between the combination of the domain name and the port number stored in the cache and the IP address if the video to be played is not successfully downloaded after the video to be played is downloaded by accessing the IP address corresponding to the domain name.
Optionally, the cache management unit is further configured to record, after storing the corresponding relationship between the combination of the domain name to be resolved and the port number and the IP address in a cache, a time for storing the corresponding relationship between the combination of the domain name to be resolved and the port number and the IP address in the cache; and deleting the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache under the condition that the time for storing the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache reaches a preset survival time value.
Optionally, the domain name to be resolved determining unit 100 is specifically configured to:
analyzing the playing instruction to obtain the identifier and URL of the video to be played, wherein the identifier of the video to be played is generated by the server side according to the domain name and the port number by using a preset method in advance;
inquiring whether an IP address corresponding to the identifier of the video to be played exists in a cache;
and under the condition that the IP address corresponding to the identifier of the video to be played does not exist in the cache, determining the domain name in the URL of the video to be played as the domain name to be analyzed.
Optionally, the downloading unit 600 is further configured to, in a case that the IP address corresponding to the identifier of the video to be played exists in the cache, access the IP address corresponding to the identifier of the video to be played to download the video to be played;
the device also comprises a cache management unit used for storing the corresponding relation between the identification of the video to be played and the IP address in a cache under the condition of successfully downloading the video to be played.
Optionally, the downloading unit 600 is specifically configured to:
accessing an IP address corresponding to the domain name to be analyzed to download the video to be played;
judging whether the video to be played is downloaded successfully;
if the downloading is successful, judging whether the downloaded data is abnormal data;
if the data is not abnormal data, triggering the video playing unit 700;
if the data is abnormal data, the first determining unit 200 is triggered.
Optionally, the second domain name resolution unit 400 is specifically configured to:
when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution;
when the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, and http domain name resolution is adopted after resolution fails;
and if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
Optionally, the apparatus further comprises:
a third determining unit, configured to determine whether a retry number corresponding to the domain name to be resolved reaches a threshold value when it is determined that the domain name to be resolved is not the first resolution; if the threshold value is reached, finishing retry and prompting that the playing is failed; and if the domain name is not up to the threshold value, triggering the second domain name resolution unit.
According to the streaming media playing device disclosed in this embodiment, after domain name resolution fails, according to a last resolution corresponding error type, for example, domain name resolution failure or downloading failure due to network jitter, abnormal downloading data due to operator hijacking, and the like, the domain name resolution is performed in a domain name resolution mode corresponding to the error type, so that the success rate of domain name resolution is improved, the problem of playing failure due to network jitter, operator hijacking, and the like is solved, and user experience is improved.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above embodiments can be combined arbitrarily, and the features described in the embodiments in the present specification can be replaced or combined with each other in the above description of the disclosed embodiments, so that those skilled in the art can implement or use the present application.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (11)

1. A method for playing streaming media, comprising:
determining a domain name to be analyzed of a video to be played under the condition of receiving a playing instruction;
judging whether the domain name to be analyzed is analyzed for the first time;
if the first time of resolution, local domain name resolution is adopted, system domain name resolution is adopted when the local domain name resolution fails, and http domain name resolution is adopted when the system domain name resolution fails;
if the domain name is not analyzed for the first time, acquiring an error type corresponding to the last analysis, determining a domain name analyzing mode of the time according to the error type, and analyzing the domain name to be analyzed according to the domain name analyzing mode;
judging whether the domain name resolution is successful to resolve the IP address corresponding to the domain name to be resolved;
if the resolution fails, returning to execute the judgment of whether the domain name to be resolved is the first resolution or not;
if the resolution is successful, accessing an IP address corresponding to the domain name to be resolved to download the video to be played;
under the condition that the video to be played is downloaded successfully, playing the video to be played;
the determining the domain name resolution mode according to the error type comprises the following steps:
when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution;
when the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, and http domain name resolution is adopted after resolution fails;
and if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
2. The method according to claim 1, wherein the determining the domain name to be resolved of the video to be played comprises:
analyzing the playing instruction to obtain the URL of the video to be played, and determining a domain name and a port number corresponding to the URL of the video to be played;
inquiring whether the IP address corresponding to the domain name and the port number exists in a cache;
and determining the domain name as the domain name to be analyzed of the video to be played under the condition that the IP address corresponding to the domain name and the port number does not exist in the cache.
3. The method of claim 2, further comprising:
and under the condition that the IP addresses corresponding to the domain name and the port number exist in the cache, accessing the IP addresses corresponding to the domain name and the port number to download the video to be played.
4. The method of claim 3, wherein in case of successful download of the video to be played, the method further comprises:
and storing the corresponding relation between the combination of the domain name to be analyzed and the port number and the IP address in a cache.
5. The method according to claim 4, wherein after the accessing the IP address corresponding to the domain name to download the video to be played, the method further comprises:
and if the video to be played is not downloaded successfully, deleting the corresponding relation between the combination of the domain name and the port number and the IP address stored in the cache.
6. The method according to claim 4, wherein after storing the correspondence between the combination of the domain name to be resolved and the port number and the IP address in a cache, the method further comprises:
recording the time for storing the corresponding relation between the combination of the domain name to be analyzed and the port number and the IP address into a cache;
and deleting the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache under the condition that the time for storing the corresponding relation between the domain name to be analyzed and the port number combination and the IP address in the cache reaches a preset survival time value.
7. The method according to claim 1, wherein the determining the domain name to be resolved of the video to be played comprises:
analyzing the playing instruction to obtain the identifier and URL of the video to be played, wherein the identifier of the video to be played is generated by the server side according to the domain name and the port number by using a preset method in advance;
inquiring whether an IP address corresponding to the identifier of the video to be played exists in a cache;
and under the condition that the IP address corresponding to the identifier of the video to be played does not exist in the cache, determining the domain name in the URL of the video to be played as the domain name to be analyzed.
8. The method of claim 7, further comprising:
under the condition that the IP address corresponding to the identifier of the video to be played exists in the cache, accessing the IP address corresponding to the identifier of the video to be played to download the video to be played;
and storing the corresponding relation between the identification of the video to be played and the IP address in a cache.
9. The method according to claim 1, wherein accessing the IP address corresponding to the domain name to be resolved to download the video to be played comprises:
accessing an IP address corresponding to the domain name to be analyzed to download the video to be played;
judging whether the video to be played is downloaded successfully;
if the downloading is successful, judging whether the downloaded data is abnormal data;
if the video is not abnormal data, triggering and executing the video to be played;
if the domain name to be analyzed is abnormal data, returning to execute the judgment of whether the domain name to be analyzed is analyzed for the first time.
10. The method according to claim 1, wherein in case it is determined that the domain name to be resolved is not the first resolution, the method further comprises:
judging whether the retry times corresponding to the domain name to be analyzed reach a threshold value;
if the threshold value is reached, finishing retry and prompting that the playing is failed;
and if the error type does not reach the threshold value, triggering and executing the acquisition of the error type corresponding to the last analysis.
11. A streaming media playing apparatus, comprising:
the domain name to be analyzed determining unit is used for determining the domain name to be analyzed of the video to be played under the condition of receiving the playing instruction;
the first judging unit is used for judging whether the domain name to be analyzed is analyzed for the first time, if the domain name to be analyzed is analyzed for the first time, the first domain name analyzing unit is triggered, and if the domain name to be analyzed is not analyzed for the first time, the second domain name analyzing unit is triggered;
the first domain name resolution unit is used for adopting local domain name resolution, the system domain name resolution is adopted when the local domain name resolution fails, and the http domain name resolution is adopted when the system domain name resolution fails;
the second domain name resolution unit is used for acquiring an error type corresponding to the last resolution, determining a domain name resolution mode of this time according to the error type, and resolving the domain name to be resolved according to the domain name resolution mode;
the second judging unit is used for judging whether the domain name resolution is successful or not to resolve the IP address corresponding to the domain name to be resolved, if the resolution is failed, the first judging unit is triggered, and if the resolution is successful, the downloading unit is triggered;
the downloading unit is used for accessing the IP address corresponding to the domain name to be analyzed to download the video to be played;
the video playing unit is used for playing the video to be played under the condition of successfully downloading the video to be played;
the determining the domain name resolution mode according to the error type comprises the following steps:
when the error type is domain name resolution failure or the downloaded data is abnormal data, determining that the domain name resolution mode is http domain name resolution;
when the error type is downloading failure, judging whether the domain name resolution is the last retry or not;
if the domain name resolution is the last retry, determining that the domain name resolution mode is that local domain name resolution is adopted firstly, and http domain name resolution is adopted after resolution fails;
and if the domain name resolution is not the last retry, determining that the domain name resolution mode is http domain name resolution.
CN202110371941.6A 2021-04-07 2021-04-07 Streaming media playing method and device Active CN113115102B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110371941.6A CN113115102B (en) 2021-04-07 2021-04-07 Streaming media playing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110371941.6A CN113115102B (en) 2021-04-07 2021-04-07 Streaming media playing method and device

Publications (2)

Publication Number Publication Date
CN113115102A CN113115102A (en) 2021-07-13
CN113115102B true CN113115102B (en) 2022-04-15

Family

ID=76714263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110371941.6A Active CN113115102B (en) 2021-04-07 2021-04-07 Streaming media playing method and device

Country Status (1)

Country Link
CN (1) CN113115102B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9083733B2 (en) * 2011-08-01 2015-07-14 Visicom Media Inc. Anti-phishing domain advisor and method thereof
CN106790747A (en) * 2016-12-13 2017-05-31 北京网瑞达科技有限公司 A kind of method of the secondary recursion resolution of domain name system DNS
CN107154963B (en) * 2017-03-31 2021-01-29 北京猎豹移动科技有限公司 Request processing method and device and electronic equipment
CN112134958B (en) * 2020-09-23 2022-04-15 北京奇艺世纪科技有限公司 Data request method, device, server and storage medium

Also Published As

Publication number Publication date
CN113115102A (en) 2021-07-13

Similar Documents

Publication Publication Date Title
US10116572B2 (en) Method, device, and system for acquiring streaming media data
CN107222484B (en) Streaming media server system supporting multi-protocol input and output
US10681413B2 (en) Determining a quality of experience metric based on uniform resource locator data
US20130290441A1 (en) Server logging module
CN107231581B (en) Method and system for video playing and streaming media playing control server
US20100095317A1 (en) Determining User Attention Level During Video Presentation by Monitoring User Inputs at User Premises
US8781300B2 (en) System and apparatus for managing video content recordings
WO2019134303A1 (en) Live stream room popularity processing method and apparatus, server and storage medium
KR20110102241A (en) Broadcasting contents providing method and apparatus and system thereof
US20230308733A1 (en) System and method for delivering media content to users
CN107682711B (en) Video interception method, server and online video playing system
US20180270002A1 (en) Method, server, user terminal and system for key points prompt in live broadcast
CN113115102B (en) Streaming media playing method and device
CN104639904A (en) Monitoring video code sending management system
JP6532764B2 (en) Method of operating a cache arranged in a transmission path between a client terminal and at least one server, and corresponding cache
CN106686156B (en) Internet audio and video domain name resolution method and device
US10700916B2 (en) Streaming media file processing method and apparatus
EP2105854A1 (en) Method for determining complementary data relating to at least one piece of content, method for transmitting these complementary data, associated processing device and application server
CN112003749A (en) Host information adding method and system and electronic equipment
CN113596053B (en) Communication service processing method, system, device, medium and equipment
WO2022166591A1 (en) Method and apparatus for playing live streaming resource, and storage medium and electronic device
CN112509296B (en) Alarm pushing method and device, electronic equipment and machine-readable storage medium
CN115460471B (en) Video playing method, device, electronic equipment and computer readable medium
KR20110019922A (en) Creation system for preview file of offer system with contents
CN108564971A (en) Audio frequency playing method and device

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