CN108390935A - A kind of audio broadcast strategy based on file stream - Google Patents

A kind of audio broadcast strategy based on file stream Download PDF

Info

Publication number
CN108390935A
CN108390935A CN201810165767.8A CN201810165767A CN108390935A CN 108390935 A CN108390935 A CN 108390935A CN 201810165767 A CN201810165767 A CN 201810165767A CN 108390935 A CN108390935 A CN 108390935A
Authority
CN
China
Prior art keywords
audio
file
audio file
address
stream
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.)
Pending
Application number
CN201810165767.8A
Other languages
Chinese (zh)
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.)
Beijing Kuwo Technology Co Ltd
Original Assignee
Beijing Kuwo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kuwo Technology Co Ltd filed Critical Beijing Kuwo Technology Co Ltd
Priority to CN201810165767.8A priority Critical patent/CN108390935A/en
Publication of CN108390935A publication Critical patent/CN108390935A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present invention relates to a kind of audio broadcast strategies based on file stream, and steps are as follows:(1)User asks to play audio in client terminal start-up App;(2)It obtains audio and plays necessary information;(3)Audio-frequency information manager is called, checks whether necessary information completely can be used;(4)According to the addresses URL of audio file, asks network channel and attempt to access;(5)Authentication process is executed, confirms client, App and with having permission per family;(6)Confirm whether audio file access rights and user match;(7)The addresses URL of audio file decode, and obtain audio file and really obtain address;(8)Audio file is obtained in the form of file stream from the real address that obtains;(9)Play audio file.The present invention, process flow is clear, zmodem, safe, and decoding speed is fast, can take into account a variety of file protocols and the decoding of a variety of audio formats, and the operational efficiency of player is secure, plays safety, good reliability online, is convenient for later maintenance.

Description

A kind of audio broadcast strategy based on file stream
Technical field
The present invention relates to audio on-line normalization and play-back technology field, specifically a kind of audio based on file stream plays Strategy.
Background technology
Streaming Media is called streaming video, is the media broadcast when passing, is multimedia one kind.It is broadcast when passing and refers to:Media At " simultaneously " of transmission over networks media, user one side constantly receives and watches for provider(Video)Or it listens to(Audio)It is passed Defeated media." stream " of " stream " media refers to the transmission mode of media(The mode of stream), and do not imply that media itself.I.e.: So-called Streaming Media refers to the media formats played in Internet by the way of stream transmission.
Server is transmitted media information(Abbreviation media)It sends out, is transmitted on network as data packet.User passes through solution After pressure equipment decompresses these data packets, media will be shown as before sending.Streaming Media in long-distance education, regard Frequency point broadcasts, network radio station, Internet video etc. have a wide range of applications.
In the prior art, in media informations such as transmission over networks audio/videos, mainly there are two kinds of sides of download and stream transmission Case.
Download is often required to spend several minutes of even a few hours, user locally need big memory capacity support media download and It preserves, could be watched after download(Video)Or it listens to(Audio)Media information, so the delay of this processing method is also very big.
Stream transmission is particularly suitable for time-base media(The multimedia files such as audio, video), time-base media is by transmission service Device is continuous to subscriber computer, transmits in real time, and user need not wait until that entire file is all downloaded and finish, and need to only pass through several seconds Or ten the start-up study of several seconds can be watched or listened to.When time-base media plays on the client, the remainder of file Divide and will continue to transmit out of server on backstage.Streaming not only shortens start-up study tenfold, hundred times of ground, but also need not be too Big buffer memory capacity.Stream transmission avoids user and has to wait for entire file all download could be watched from Internet Disadvantage.
Streaming video does not download entire file before broadcasting, and beginning content is only stored in subscriber computer(Such as Memory), the data flow of streaming video transmits at any time to be played at any time, is only beginning with some delays.The pass that Streaming Media is realized Key technology is exactly to transmit as a stream.
Stream transmission definition is very extensive, refers mainly to through transmission of network media(Such as audio, video)Technology general name.It realizes There are two types of methods for stream transmission:Real Time Streaming(Real time streaming)And sequential control design method (progressive streaming).
Sequential control design method is progressive download, and user may be viewed by online Media while downloading file, in given time, User can only watch the part downloaded, and cannot jump to the front part having not yet been downloaded, during the transmission not according to user The speed of connection adjusts to downloading order.
Real Time Streaming can guarantee that media signal bandwidth is matched with network connection, make media that can be watched in real time.It is real When stream transmission according to network condition adjust output audio and video quality to realize the lasting real-time transmission of media, Yong Huke F.F. is retreated to watch the content of above or below.
It is, in general, that if video is real-time broadcast, or streaming media server is used, or application such as RTSP(Real Time Streaming Protocol, RFC2326, real time streaming transport protocol is an application layer in ICP/IP protocol system Agreement)Real-time protocol (RTP), as Real Time Streaming.Such as use HTTP(HyperText Transfer Protocol, it is super literary This transport protocol is a kind of procotol being most widely used on internet)Server, file are sent by sequential flow, As sequential control design method.Which kind of transmission method is specific requirements is relied on using.Certainly, stream-oriented file is also supported before broadcasting completely Download to hard disk.
The concept of stream:Stream, is just built upon a kind of work of abstract processing data on the basis of object-oriented in simple terms Tool.In stream, the basic operation of some processing data is defined, such as reads data, write-in data etc., programmer is that convection current carries out All operations, and without being concerned about the real flow direction of the other end data of stream.Stream can not only handle file, can also handle dynamic A variety of data modes such as state memory, network data.If your operation of convection current is very skilled, the convenience of stream is utilized in a program Property, efficiency can be greatly improved by having write program.
In iOS system, file stream operation class-NSFileHandle is provided, allows to more efficiently use file, Objective-C carries out stream operation using NSFileHandle classes to file, can be very good to support Streaming Media, more suitable for sound Frequency on-line normalization and broadcasting.
NSFileHandle basic steps are as follows:
1, file is opened, NSFileHandle objects are obtained.
2, to opening file above, I/O stream operations are carried out by NSFileHandle objects.
3, file is closed.
Since audio frequency media is related to copyright, safety, reliability in network transmission are the key that industry competitions, respectively Processing strategy when family plays audio is all different, it is contemplated that front end is developed and coordination, the later maintenance of backstage exploitation, has Necessary unified standard is suitable for this enterprise App(The abbreviation of English Application refers to the third party application of smart machine, Such as smart mobile phone, Intelligent flat etc., smart machine can be referred to as client)Audio broadcast strategy.
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of, and the audio based on file stream plays Strategy, process flow is clear, zmodem, safe, and decoding speed is fast, can take into account a variety of file protocols and a variety of audio lattice Formula decodes, and the operational efficiency of player is secure, plays safety, good reliability online, is convenient for later maintenance.
To achieve the above objectives, the technical solution adopted by the present invention is that:
A kind of audio broadcast strategy based on file stream, which is characterized in that include the following steps:
Step 1, user is in client terminal start-up App, and asks to play audio;
Step 2, App obtains audio and plays necessary information, and the audio plays necessary information and includes at least:
The ID of audio file is used for a certain audio file of unique mark,
The acquisition address of audio file, including:The physical address of audio file or the addresses URL of audio file, physical address pair It should be in playing local audio, the addresses URL, which correspond to, plays online audio,
The audio format of audio file,
The code check of audio file,
The playing duration of audio file;
Step 3, App calls audio-frequency information manager, checks that audio plays whether necessary information completely can be used,
If information is imperfect available, unavailable error message is returned,
If information completely is available, 4 are gone to step;
Step 4, when obtaining the physical address that address is audio file, relay is put local audio processing, is implemented by the prior art, no It is described in detail again,
When obtaining the addresses URL that address is audio file, then asks network channel and attempt to access;
Step 5, authentication process is executed, confirm client, App and accesses audio file with network channel is entitled by per family The addresses URL,
If failed authentication, lack of competence error message is returned,
If authenticated successfully, 6 are gone to step;
Step 6, confirm whether audio file access rights and user match,
If user's lack of competence accesses audio file, lack of competence error message is returned,
If user has permission to access audio file, 7 are gone to step;
Step 7, the addresses the URL decoding of audio file, obtains audio file and really obtains address, prevent address from stealing chain, prevent Unauthorized access really obtains address and is directed toward preset transmission server,
If decoding error, return address error message,
If decoding is correct, 8 are gone to step;
Step 8, audio file is obtained in the form of file stream from the real address that obtains;When obtaining audio file, cycle etc. Question paper stream;Cycle pending file stream is passed through in a streaming manner because audio file is not disposable locally downloading Network transmission;
Step 9, audio file is played.
Based on the above technical solution, when App described in step 2 obtains audio broadcasting necessary information, audio is also obtained Show that necessary information, the audio show that necessary information includes at least:
Musical designation,
Artist name,
Album title,
Music front cover picture,
The music lyrics.
Based on the above technical solution, check that audio plays whether necessary information completely can be used specifically described in step 3 Steps are as follows:
Check that audio plays whether necessary information lacks,
Check whether the ID formats of audio file are correct,
Check whether the acquisition address format of audio file is correct,
Check audio file audio format whether be player support audio format,
Check whether the code check format of audio file is correct.
Based on the above technical solution, authentication process described in step 5 is as follows:
Client by iOS device unique identifier UDID or ad identifier IDFA or site identifier MAC Address into Row authentication, user determines whether to bind client by selecting switch, its parameter setting of the client of binding and/or fills There is high priority, parameter setting can be synchronized in other clients of unbound same user for value payment, and recharging and paying can It is executable to be set as only binding client, for preventing user's fund is stolen from brushing, usurp, use of going beyond one's commission;
App is authenticated by the unique mark bundle_id of Universally Unique Identifier UUID or " machine+application ", for preventing Only App is called once when App starts for the first time by malicious modification, utilization, is then stored the string, replace when needed It is used for UDID;
User is carried out by user account+password or user account+password+interim identifying code or user account+short message verification code Authentication, for preventing from being not logged in or unauthorized is used for surpassing permission.
Based on the above technical solution, step 6 is as follows:
The Permission Levels of user are judged according to user's id information,
According to the Permission Levels of the ID of audio file and user, network is asked, checks whether user has permission broadcasting audio file The corresponding audio files of ID,
The copyright registration of audio file is judged according to the ID of audio file, checks whether audio file is authorized to use.
Based on the above technical solution, the addresses the URL decoding of audio file described in step 7 is as follows:
The ID of audio file is obtained,
The client key of client and server-side agreement is obtained,
The addresses URL of the ID of audio file, client key, audio file are sent to server-side,
After server-side verification client key passes through, complete, to the decoding of the addresses URL of audio file, to obtain with server-side key Audio file really obtains address,
Address is really obtained with client key and timestamp encrypted audio files, obtains secondary encryption address,
Secondary encryption address is returned to client by server-side,
Server-side by timestamp user bound ID,
The timestamp of binding is obtained by User ID,
Client client key and timestamp complete the decoding to secondary encryption address, obtain audio file and really obtain Address.
Based on the above technical solution, the obtaining step of file stream described in step 8 is as follows:
Step 8.1, App calls downloader, and audio file is obtained in the form of file stream from transmission server,
Whether judgement currently downloads to data,
If not downloading to data, download error message is returned,
If there is downloading to data, then 8.2 are gone to step;
Step 8.2, it further determines whether to need to decrypt,
If necessary to decrypt, then file stream is redirected, is decrypted, file stream damper is written after decryption again,
If you do not need to decryption, then write direct file stream damper;
Step 8.3, the buffered messages that pending file stream damper is sent out,
If amount of available data is less than, continue waiting for,
If amount of available data has expired, tail of file is returned, completes to obtain audio file.
Based on the above technical solution, it before executing step 8, first carries out at the judgement and correction of audio format Reason, is as follows:
After the audio format for obtaining the audio file in audio broadcasting necessary information, audio format analyzer is called, judges audio Play whether necessary information can be used,
If it is not then format unknown error is returned,
If it is available, then inquiry audio file buffer, judges the local audio file that whether there is the audio format,
If it is present 9 are gone to step,
If it does not exist, then executing step 8.
Based on the above technical solution, after executing step 8, analysis obtains the audio format of audio file, production Raw Ad Hoc audio format,
Ad Hoc audio format and audio are played to the audio format comparison of the audio file in necessary information,
If it is not the same, correction prompt message is then returned,
If identical, audio file buffer is written in audio file.
Based on the above technical solution, transmission server receives correction prompt message, verifies the audio of audio file Format,
The audio format of the audio file recorded in transmission server is corrected,
The audio format for the audio file that audio plays in necessary information is corrected,
If revised audio format is different from audio file buffer middle pitch frequency file, it is temporary further to empty audio file Storage re-executes step 8.
Audio broadcast strategy of the present invention based on file stream, process flow is clear, zmodem, safe, Decoding speed is fast, can take into account a variety of file protocols and the decoding of a variety of audio formats, the operational efficiency of player is secure, broadcasts online Safety, good reliability are put, later maintenance is convenient for.
Description of the drawings
The present invention has following attached drawing:
The flow chart of Fig. 1 present invention.
Specific implementation mode
Below in conjunction with attached drawing, invention is further described in detail.
Audio broadcast strategy of the present invention based on file stream, functional planning are as follows:
Function 1:Online audio is played,
When playing online audio, based on the media information of file steaming transfer audio file,
Online audio is based on file steaming transfer and is stored as local audio,
The practical protection for obtaining address of audio file.
Function 2:Local audio is played, when playing local audio, implements by the prior art, is not described in detail in the present invention.
Function 3:The judgement and correction of audio format.
Function 4:The decoder of audio format obtains.
Function 5:The encryption and decryption of file stream.
Function 6:It plays audio and skips prelude function.
Function 7:Real Time Dragging playing progress rate, AF playing function.
Function 8:Automatically switch song function.
Function 9:Play mode selection function.
Function 10:Play sound quality handoff functionality.
As shown in Figure 1, the audio broadcast strategy of the present invention based on file stream, includes the following steps:
Step 1, user is in client terminal start-up App, and asks to play audio;
Step 2, App obtains audio and plays necessary information, and the audio plays necessary information and includes at least:
The ID of audio file is used for a certain audio file of unique mark,
The acquisition address of audio file, including:The physical address of audio file or the addresses URL of audio file, physical address pair It should be in playing local audio, the addresses URL, which correspond to, plays online audio,
The audio format of audio file,
The code check of audio file,
The playing duration of audio file;
Step 3, App calls audio-frequency information manager, checks that audio plays whether necessary information completely can be used,
If information is imperfect available, unavailable error message is returned,
If information completely is available, 4 are gone to step;
Step 4, when obtaining the physical address that address is audio file, relay is put local audio processing, is implemented by the prior art, no It is described in detail again,
When obtaining the addresses URL that address is audio file, then asks network channel and attempt to access;
Step 5, authentication process is executed, confirm client, App and accesses audio file with network channel is entitled by per family The addresses URL,
If failed authentication, lack of competence error message is returned,
If authenticated successfully, 6 are gone to step;
Step 6, confirm whether audio file access rights and user match,
If user's lack of competence accesses audio file, lack of competence error message is returned,
If user has permission to access audio file, 7 are gone to step;
Step 7, the addresses the URL decoding of audio file, obtains audio file and really obtains address, prevent address from stealing chain, prevent Unauthorized access really obtains address and is directed toward preset transmission server,
If decoding error, return address error message,
If decoding is correct, 8 are gone to step;
Step 8, audio file is obtained in the form of file stream from the real address that obtains;When obtaining audio file, cycle etc. Question paper stream;Cycle pending file stream is passed through in a streaming manner because audio file is not disposable locally downloading Network transmission;
Step 9, audio file is played.
The file stream refers to being transmitted the file in server-side in the form of streaming, is transferred to client.Client After server-side is received to the stream come, stream buffering can be entered local file, usual processing mode is as follows:
Firstly the need of some file of open is opened, such as:
void open(const char* filename,ios_base::openmode mode);
The meaning of parameter:
filename:The filename to be opened
mode:Open the mode of file
After opening file, file is written into stream using write functions.And file stream deposit player memory is buffered into buffer In, prepare to play.
Be using file stream because:In stream, the basic operation of some processing data is defined, such as reads data, write-in Data etc., programmer are that convection current carries out all operations, and does not have to the real flow direction for being concerned about the other end data of stream.And very It is flexibly easy-to-use.
Based on the above technical solution, when App described in step 2 obtains audio broadcasting necessary information, audio is also obtained Show that necessary information, the audio show that necessary information includes at least:
Musical designation,
Artist name,
Album title,
Music front cover picture,
The music lyrics.
Based on the above technical solution, the audio plays necessary information and audio shows necessary information, is stored in In the data structure MusicItem of customized music information, App calls the data knot of customized music information when needed To be stored in or take out, audio plays necessary information to structure MusicItem and audio shows necessary information.
App uses the data structure MusicItem of customized music information, preferably can play necessary letter to audio Breath and audio show that necessary information is managed, and later maintenance is also more convenient.Such as:
Create a MusicItem class
public class MusicItem {
String name;-- the name of storage music
Uri songUri;-- the addresses Uri of storage music
Uri albumUri;-- the addresses Uri of storage Music front cover
Bitmap thumb;-- storage cover picture
long duration;-- the playing duration of storage music, unit is millisecond
MusicItem(Uri songUri, Uri albumUri, String strName, long duration) {
this.name = strName;
this.songUri = songUri;
this.duration = duration;
this.albumUri = albumUri;
}
}
The specifying information of MusicItem classes can adjust on demand, above are only an example.
Based on the above technical solution, App described in step 1 safeguards a playlist, being played on for storing Music and music to be played is waited,
When App starts every time, from music being played on when playlist acquisition last time operation and music to be played is waited.
Based on the above technical solution, check that audio plays whether necessary information completely can be used specifically described in step 3 Steps are as follows:
Check that audio plays whether necessary information lacks,
Check whether the ID formats of audio file are correct,
Check whether the acquisition address format of audio file is correct,
Check audio file audio format whether be player support audio format,
Check whether the code check format of audio file is correct.
Based on the above technical solution, authentication process described in step 5 is as follows:
Client by iOS device unique identifier UDID or ad identifier IDFA or site identifier MAC Address into Row authentication, user determines whether to bind client by selecting switch, its parameter setting of the client of binding and/or fills There is high priority, parameter setting can be synchronized in other clients of unbound same user for value payment, and recharging and paying can It is executable to be set as only binding client, for preventing user's fund is stolen from brushing, usurp, use of going beyond one's commission;
App is authenticated by the unique mark bundle_id of Universally Unique Identifier UUID or " machine+application ", for preventing Only App is called once when App starts for the first time by malicious modification, utilization, is then stored the string, replace when needed It is used for UDID;
User is carried out by user account+password or user account+password+interim identifying code or user account+short message verification code Authentication, for preventing from being not logged in or unauthorized is used for surpassing permission.
Based on the above technical solution, step 6 is as follows:
The Permission Levels of user are judged according to user's id information,
According to the Permission Levels of the ID of audio file and user, network is asked, checks whether user has permission broadcasting audio file The corresponding audio files of ID,
The copyright registration of audio file is judged according to the ID of audio file, checks whether audio file is authorized to use.
Based on the above technical solution, the addresses the URL decoding of audio file described in step 7 is as follows:
The ID of audio file is obtained,
The client key of client and server-side agreement is obtained,
The addresses URL of the ID of audio file, client key, audio file are sent to server-side,
After server-side verification client key passes through, complete, to the decoding of the addresses URL of audio file, to obtain with server-side key Audio file really obtains address,
Address is really obtained with client key and timestamp encrypted audio files, obtains secondary encryption address,
Secondary encryption address is returned to client by server-side,
Server-side by timestamp user bound ID,
The timestamp of binding is obtained by User ID,
Client client key and timestamp complete the decoding to secondary encryption address, obtain audio file and really obtain Address.
On the basis of above-mentioned decoded, the URL address encryptions of corresponding audio file are as follows:
Server-side generates encrypted random number,
Server-side by encrypted random number and client subscribed client key,
Server-side generates server-side key by encrypted random number,
Server-side really obtains address by server-side key pair audio file and is encrypted, and obtains externally issuing The addresses URL of audio file.
In order to simplify the fussy degree that encrypting and decrypting audio file really obtains address, also contemplate for redirect address, Interim addresses URL with timestamp fstime generate the modes such as ciphering signature character string using the encryption function made by oneself, to sound Frequency file really obtains address and is encrypted and decryption processing, and the addresses URL of the audio file after encryption is public Open user.
Based on the above technical solution, the obtaining step of file stream described in step 8 is as follows:
Step 8.1, App calls downloader, and audio file is obtained in the form of file stream from transmission server,
Whether judgement currently downloads to data,
If not downloading to data, download error message is returned,
If there is downloading to data, then 8.2 are gone to step;
Step 8.2, it further determines whether to need to decrypt,
If necessary to decrypt, then file stream is redirected, is decrypted, file stream damper is written after decryption again,
If you do not need to decryption, then write direct file stream damper;
Step 8.3, the buffered messages that pending file stream damper is sent out,
If amount of available data is less than, continue waiting for,
If amount of available data has expired, tail of file is returned, completes to obtain audio file.
The amount of available data is current audio file(Such as song)Total amount of data, need to download from network and fill out It fills, when amount of available data has expired, represents Audio Buffer success, i.e. current audio file(Such as song)Downloaded from network Filling finishes.
Based on the above technical solution, it before executing step 8, first carries out at the judgement and correction of audio format Reason, is as follows:
After the audio format for obtaining the audio file in audio broadcasting necessary information, audio format analyzer is called, judges audio Play whether necessary information can be used,
If it is not then format unknown error is returned,
If it is available, then inquiry audio file buffer, judges the local audio file that whether there is the audio format,
If it is present 9 are gone to step,
If it does not exist, then executing step 8.
If audio file locally has existed, without executing step 8, therefore before executing step 8, there is this pretreatment Process.
Based on the above technical solution, after executing step 8, analysis obtains the audio format of audio file, production Raw Ad Hoc audio format,
Ad Hoc audio format and audio are played to the audio format comparison of the audio file in necessary information,
If it is not the same, correction prompt message is then returned,
If identical, audio file buffer is written in audio file.
Based on the above technical solution, transmission server receives correction prompt message, verifies the audio of audio file Format,
The audio format of the audio file recorded in transmission server is corrected,
The audio format for the audio file that audio plays in necessary information is corrected,
If revised audio format is different from audio file buffer middle pitch frequency file, it is temporary further to empty audio file Storage re-executes step 8.
The reason of emptying audio file buffer is as follows:Because can there be playback of songs data in audio buffer, if Revised audio format is different from audio file buffer middle pitch frequency file, then needing to empty buffer, if do not emptied Can then data buffering be caused to exist, if other one correct song is played at this time, then can be before use in buffer Junk data causes to play entanglement.
Based on the above technical solution, it in step 9, plays audio file and is as follows:
Step 9.1, device plays permission is obtained, in iOS system, when device plays audio, which needs to obtain current device audio, to be broadcast It delegates power limit, app is made to possess the right for playing app,
If play right obtains failure, it tries the acquisition of not more than preset times retries, and acquiescence preset times are 3 times, such as Failure is still obtained, then is returned without play right error message,
If play right obtains successfully, audio-frequency information and voice data stream are obtained;
Step 9.2, judge whether audio-frequency information can be used,
If it is not then returning to audio plays failure information,
If it is available, then setting plays queue;
Step 9.3, judge whether audio buffer receives file stream,
If do not received, continue waiting for, go to step 9.4,
If there is receiving, then 9.5 are gone to step;
Step 9.4, further judge whether wait for is more than threshold value,
If it does, then returning to audio plays failure information,
If not above, 9.3 are gone to step,
Step 9.5, voice data stream is handled.
Based on the above technical solution, step 9.5 is as follows:
Step 9.5.1 calls audio decoder management module, and whether decodable code plays audio data stream,
If it is not possible, then returning to audio plays failure information,
If it is then going to step 9.5.2;
Whether decodable code broadcasting refers to whether supporting the broadcasting of the corresponding audio format of voice data stream;
Step 9.5.2 determines whether corresponding audio decoder according to audio format,
Have and then directly call audio decoder from local,
Not then after respective server downloads audio decoder to local, audio decoder is called from local;
Step 9.5.3, audio decoder decode playing audio-fequency data stream,
If decoding failure returns to audio and plays failure information,
It is that output decoding data plays out if successfully decoded.
The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of audio broadcast strategy based on file stream, which is characterized in that include the following steps:
Step 1, user is in client terminal start-up App, and asks to play audio;
Step 2, App obtains audio and plays necessary information, and the audio plays necessary information and includes at least:
The ID of audio file is used for a certain audio file of unique mark,
The acquisition address of audio file, including:The physical address of audio file or the addresses URL of audio file, physical address pair It should be in playing local audio, the addresses URL, which correspond to, plays online audio,
The audio format of audio file,
The code check of audio file,
The playing duration of audio file;
Step 3, App calls audio-frequency information manager, checks that audio plays whether necessary information completely can be used,
If information is imperfect available, unavailable error message is returned,
If information completely is available, 4 are gone to step;
Step 4, when obtaining the physical address that address is audio file, relay is put local audio processing, is implemented by the prior art, no It is described in detail again,
When obtaining the addresses URL that address is audio file, then asks network channel and attempt to access;
Step 5, authentication process is executed, confirm client, App and accesses audio file with network channel is entitled by per family The addresses URL,
If failed authentication, lack of competence error message is returned,
If authenticated successfully, 6 are gone to step;
Step 6, confirm whether audio file access rights and user match,
If user's lack of competence accesses audio file, lack of competence error message is returned,
If user has permission to access audio file, 7 are gone to step;
Step 7, the addresses the URL decoding of audio file, obtains audio file and really obtains address, prevent address from stealing chain, prevent Unauthorized access really obtains address and is directed toward preset transmission server,
If decoding error, return address error message,
If decoding is correct, 8 are gone to step;
Step 8, audio file is obtained in the form of file stream from the real address that obtains;When obtaining audio file, cycle etc. Question paper stream;Cycle pending file stream is passed through in a streaming manner because audio file is not disposable locally downloading Network transmission;
Step 9, audio file is played.
2. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:App described in step 2 obtains sound When frequency plays necessary information, also obtains audio and show that necessary information, the audio show that necessary information includes at least:
Musical designation,
Artist name,
Album title,
Music front cover picture,
The music lyrics.
3. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:Audio is checked described in step 3 Whether broadcasting necessary information, which completely can be used, is as follows:
Check that audio plays whether necessary information lacks,
Check whether the ID formats of audio file are correct,
Check whether the acquisition address format of audio file is correct,
Check audio file audio format whether be player support audio format,
Check whether the code check format of audio file is correct.
4. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:Authentication process described in step 5 It is as follows:
Client by iOS device unique identifier UDID or ad identifier IDFA or site identifier MAC Address into Row authentication, user determines whether to bind client by selecting switch, its parameter setting of the client of binding and/or fills There is high priority, parameter setting can be synchronized in other clients of unbound same user for value payment, and recharging and paying can It is executable to be set as only binding client, for preventing user's fund is stolen from brushing, usurp, use of going beyond one's commission;
App is authenticated by the unique mark bundle_id of Universally Unique Identifier UUID or " machine+application ", for preventing Only App is called once when App starts for the first time by malicious modification, utilization, is then stored the string, replace when needed It is used for UDID;
User is carried out by user account+password or user account+password+interim identifying code or user account+short message verification code Authentication, for preventing from being not logged in or unauthorized is used for surpassing permission.
5. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:Step 6 is as follows:
The Permission Levels of user are judged according to user's id information,
According to the Permission Levels of the ID of audio file and user, network is asked, checks whether user has permission broadcasting audio file The corresponding audio files of ID,
The copyright registration of audio file is judged according to the ID of audio file, checks whether audio file is authorized to use.
6. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:Audio file described in step 7 The addresses URL decoding be as follows:
The ID of audio file is obtained,
The client key of client and server-side agreement is obtained,
The addresses URL of the ID of audio file, client key, audio file are sent to server-side,
After server-side verification client key passes through, complete, to the decoding of the addresses URL of audio file, to obtain with server-side key Audio file really obtains address,
Address is really obtained with client key and timestamp encrypted audio files, obtains secondary encryption address,
Secondary encryption address is returned to client by server-side,
Server-side by timestamp user bound ID,
The timestamp of binding is obtained by User ID,
Client client key and timestamp complete the decoding to secondary encryption address, obtain audio file and really obtain Address.
7. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:File stream described in step 8 Obtaining step is as follows:
Step 8.1, App calls downloader, and audio file is obtained in the form of file stream from transmission server,
Whether judgement currently downloads to data,
If not downloading to data, download error message is returned,
If there is downloading to data, then 8.2 are gone to step;
Step 8.2, it further determines whether to need to decrypt,
If necessary to decrypt, then file stream is redirected, is decrypted, file stream damper is written after decryption again,
If you do not need to decryption, then write direct file stream damper;
Step 8.3, the buffered messages that pending file stream damper is sent out,
If amount of available data is less than, continue waiting for,
If amount of available data has expired, tail of file is returned, completes to obtain audio file.
8. the audio broadcast strategy based on file stream as described in claim 1, it is characterised in that:Before executing step 8, first Judgement and the correction process for executing audio format, are as follows:
After the audio format for obtaining the audio file in audio broadcasting necessary information, audio format analyzer is called, judges audio Play whether necessary information can be used,
If it is not then format unknown error is returned,
If it is available, then inquiry audio file buffer, judges the local audio file that whether there is the audio format,
If it is present 9 are gone to step,
If it does not exist, then executing step 8.
9. the audio broadcast strategy based on file stream as claimed in claim 8, it is characterised in that:After executing step 8, point Analysis obtains the audio format of audio file, generates Ad Hoc audio format,
Ad Hoc audio format and audio are played to the audio format comparison of the audio file in necessary information,
If it is not the same, correction prompt message is then returned,
If identical, audio file buffer is written in audio file.
10. the audio broadcast strategy based on file stream as claimed in claim 9, it is characterised in that:Server reception is transmitted to rectify Positive prompt message verifies the audio format of audio file,
The audio format of the audio file recorded in transmission server is corrected,
The audio format for the audio file that audio plays in necessary information is corrected,
If revised audio format is different from audio file buffer middle pitch frequency file, it is temporary further to empty audio file Storage re-executes step 8.
CN201810165767.8A 2018-02-28 2018-02-28 A kind of audio broadcast strategy based on file stream Pending CN108390935A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810165767.8A CN108390935A (en) 2018-02-28 2018-02-28 A kind of audio broadcast strategy based on file stream

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810165767.8A CN108390935A (en) 2018-02-28 2018-02-28 A kind of audio broadcast strategy based on file stream

Publications (1)

Publication Number Publication Date
CN108390935A true CN108390935A (en) 2018-08-10

Family

ID=63069061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810165767.8A Pending CN108390935A (en) 2018-02-28 2018-02-28 A kind of audio broadcast strategy based on file stream

Country Status (1)

Country Link
CN (1) CN108390935A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109584891A (en) * 2019-01-29 2019-04-05 乐鑫信息科技(上海)股份有限公司 Audio-frequency decoding method, device, equipment and medium under embedded environment
CN111182053A (en) * 2019-12-27 2020-05-19 北京明略软件系统有限公司 Method and device for downloading file, computer storage medium and terminal
CN111859088A (en) * 2020-07-23 2020-10-30 闵雯 User authority management system and method based on big data
CN113301395A (en) * 2021-04-30 2021-08-24 当趣网络科技(杭州)有限公司 Voice searching method combining user grades in video playing state

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130254159A1 (en) * 2011-10-25 2013-09-26 Clip Interactive, Llc Apparatus, system, and method for digital audio services
CN103997681A (en) * 2014-06-02 2014-08-20 合一网络技术(北京)有限公司 Method for conducting link theft protection processing on live video and system thereof
CN106330842A (en) * 2015-07-02 2017-01-11 天脉聚源(北京)科技有限公司 Network audio file playing method and network audio file playing system
CN106358050A (en) * 2016-08-30 2017-01-25 华南理工大学广州学院 Android based audio and video streaming push method and device as well as Android based audio and video streaming playing method and device
CN106612281A (en) * 2016-12-26 2017-05-03 广东技术师范学院 Electronic resource service right control method based on mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130254159A1 (en) * 2011-10-25 2013-09-26 Clip Interactive, Llc Apparatus, system, and method for digital audio services
CN103997681A (en) * 2014-06-02 2014-08-20 合一网络技术(北京)有限公司 Method for conducting link theft protection processing on live video and system thereof
CN106330842A (en) * 2015-07-02 2017-01-11 天脉聚源(北京)科技有限公司 Network audio file playing method and network audio file playing system
CN106358050A (en) * 2016-08-30 2017-01-25 华南理工大学广州学院 Android based audio and video streaming push method and device as well as Android based audio and video streaming playing method and device
CN106612281A (en) * 2016-12-26 2017-05-03 广东技术师范学院 Electronic resource service right control method based on mobile terminal

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109584891A (en) * 2019-01-29 2019-04-05 乐鑫信息科技(上海)股份有限公司 Audio-frequency decoding method, device, equipment and medium under embedded environment
CN111182053A (en) * 2019-12-27 2020-05-19 北京明略软件系统有限公司 Method and device for downloading file, computer storage medium and terminal
CN111859088A (en) * 2020-07-23 2020-10-30 闵雯 User authority management system and method based on big data
CN111859088B (en) * 2020-07-23 2021-12-10 积木堂(上海)信息技术有限公司 User authority management system and method based on big data
CN113301395A (en) * 2021-04-30 2021-08-24 当趣网络科技(杭州)有限公司 Voice searching method combining user grades in video playing state
CN113301395B (en) * 2021-04-30 2023-07-07 当趣网络科技(杭州)有限公司 Voice searching method combined with user grade in video playing state

Similar Documents

Publication Publication Date Title
JP4190293B2 (en) Method and network for distributing streaming data
US7484103B2 (en) Method and system for the information protection of digital content
CN101547205B (en) Method, apparatus and system for remote real-time access of multimedia content
US10425427B2 (en) Template uniform resource locator signing
US8873751B2 (en) Extending data confidentiality into a player application
CN108390935A (en) A kind of audio broadcast strategy based on file stream
US20080216177A1 (en) Contents Distribution System
JP5557897B2 (en) Digital media content protection system and method
US20160197939A1 (en) Segment Authentication for Dynamic Adaptive Streaming
US20080052319A1 (en) File splitting, scalable coding, and asynchronous transmission in streamed data transfer
US20070106805A1 (en) System and method for peer-to-peer digital content sharing
US20120159575A1 (en) Communication system, communication device, communication method, and computer program
US20020065074A1 (en) Methods, systems, and devices for wireless delivery, storage, and playback of multimedia content on mobile devices
CN106791986A (en) A kind of live index list encrypted antitheft catenary systems of HLS and method
JP4935346B2 (en) Broadcast content reception and storage system, reception storage device and program
US7865723B2 (en) Method and apparatus for multicast delivery of program information
CN102143129A (en) Method and system for realizing service protection in hyper text transmission protocol (HTTP) streaming transmission
CN106936815A (en) A kind of document transmission system and its method based on encrypted audio stream
KR20000033213A (en) Method for transfering multimedia contents using meta data
CN108400987A (en) A kind of audio play in address protection strategy
CN108322786A (en) A kind of audio play in audio transmission strategy
CN101630519A (en) IP streaming copy control method and system
CN108322821A (en) A kind of audio play in data buffering strategy
KR20030046817A (en) Method of providing multimedia data by pre-transmission of partial data
KR102194021B1 (en) Peer-to-peer content delivery network, method, and manager

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180810