CN109634549A - Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing - Google Patents
Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing Download PDFInfo
- Publication number
- CN109634549A CN109634549A CN201811238891.9A CN201811238891A CN109634549A CN 109634549 A CN109634549 A CN 109634549A CN 201811238891 A CN201811238891 A CN 201811238891A CN 109634549 A CN109634549 A CN 109634549A
- Authority
- CN
- China
- Prior art keywords
- layer
- core layer
- presentation layer
- player
- control instruction
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000009434 installation Methods 0.000 title claims abstract description 28
- 239000010410 layer Substances 0.000 claims abstract description 195
- 239000012792 core layer Substances 0.000 claims abstract description 109
- 238000004590 computer program Methods 0.000 claims description 22
- 230000005540 biological transmission Effects 0.000 claims description 14
- 230000007175 bidirectional communication Effects 0.000 claims description 5
- 230000006854 communication Effects 0.000 claims description 5
- 238000004891 communication Methods 0.000 claims description 5
- 230000006870 function Effects 0.000 description 16
- 230000004044 response Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 4
- 230000018109 developmental process Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000005266 casting Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- PCHJSUWPFVWCPO-UHFFFAOYSA-N gold Chemical compound [Au] PCHJSUWPFVWCPO-UHFFFAOYSA-N 0.000 description 2
- 239000010931 gold Substances 0.000 description 2
- 229910052737 gold Inorganic materials 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000009472 formulation Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000008140 language development Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/16—Sound input; Sound output
- G06F3/162—Interface to dedicated audio devices, e.g. audio drivers, interface to CODECs
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
A kind of audio frequency playing method, it is realized by the audio player for including core layer, presentation layer and bridge layer, the core layer is constructed using primary code, the presentation layer is constructed using hypertext markup language, the described method includes: presentation layer shows player interface, the user's operation on the player interface is received, is generated according to the user's operation and plays control instruction, the broadcasting control instruction is sent to core layer by bridge layer;Core layer receives the broadcasting control instruction, plays out control according to the broadcasting control instruction, the broadcast information is sent to presentation layer by bridge layer by recording played information;Presentation layer receives the broadcast information, updates the player interface according to the broadcast information.The present invention also provides a kind of audio player, computer installation and computer readable storage mediums.The present invention modifies player interface in which can be convenient, and can continue to play audio from the background after player interface closing.
Description
Technical field
The present invention relates to multimedia technology fields, and in particular to a kind of audio frequency playing method, audio player, computer dress
It sets and computer readable storage medium.
Background technique
Many application programs of mobile terminal have the demand for playing audio.However, the application program of mobile terminal is playing
It is had the following problems in audio:
(1) the WebView kernel version of different mobile terminal is different, and there are compatibility issues for player interface.
(2) after player interface is closed, audio broadcasting just be stopped, and is unable to satisfy backstage and is continued to play the demand of audio.
Summary of the invention
In view of the foregoing, it is necessary to propose a kind of audio frequency playing method, audio player, computer installation and computer
Readable storage medium storing program for executing modifies player interface in which can be convenient, and can be on backstage after continued broadcasting after player interface closing
Playback frequency.
The first aspect of the application provides a kind of audio frequency playing method, and the audio player includes core layer, presentation layer
With bridge layer, the core layer is constructed using primary code, and the presentation layer is constructed using hypertext markup language, the method
Include:
The presentation layer shows player interface, the user's operation on the player interface is received, according to the user
Operation, which generates, plays control instruction, and the broadcasting control instruction is sent to the core layer by the bridge layer;
The core layer receives the broadcasting control instruction, plays out control according to the broadcasting control instruction, records
The broadcast information is sent to the presentation layer by the bridge layer by the broadcast information of the audio player;
The presentation layer receives the broadcast information, updates the player interface according to the broadcast information.
In alternatively possible implementation, the core layer uses Java code, and the presentation layer uses
JavaScript code.
In alternatively possible implementation, the presentation layer sends the broadcasting control instruction by the bridge layer
Include: to the core layer
A class is realized in the Java code, is called to the javascript;
The class is registered in the JavascriptInterface of WebView;
The method of the class of the Java code is called directly by the class in the Javascript code.
In alternatively possible implementation, the broadcast information is sent to institute by the bridge layer by the core layer
Stating presentation layer includes:
A method is realized in the Javascript code;
The Java code is described by realizing in Javascript code described in WebView.loadUrl method call
Method.
In alternatively possible implementation, the bridge layer passes through protocol realization core layer and presentation layer based on JSON
Two-way communication.
In alternatively possible implementation, the player interface includes following one one or more combination: being played
Button, pause button, stop button, last track button, next track button, play mode switching push button, rank button, played column
Table, progress bar.
In alternatively possible implementation, the hypertext markup language includes the 5th generation hypertext markup language.
The second aspect of the application provides a kind of audio playing apparatus, and the audio player includes core layer, presentation layer
And bridge layer, the core layer are constructed using primary code, the presentation layer is constructed using hypertext markup language, wherein institute
Stating core layer includes:
First receiving unit, for receiving the broadcasting control instruction from the presentation layer;
Broadcast unit, for playing out control according to the broadcasting control instruction;
Storage unit, for recording the broadcast information of the audio player;
First sending module, for the broadcast information to be sent to the presentation layer by the bridge layer;
The presentation layer includes:
Display unit receives the use on the player interface for showing the player interface of the audio player
Family operation;
Second transmission unit controls the broadcasting for generating the broadcasting control instruction according to the user's operation
Instruction is sent to the core layer by the bridge layer;
Second receiving unit, for receiving the broadcast information from the core layer;
The display unit is also used to the broadcast information based on the received and updates the player interface;
The bridge layer provides the core layer and the presentation layer for connecting the core layer and the presentation layer
Between bi-directional communication channels.
The third aspect of the application provides a kind of computer installation, and the computer installation includes processor, the processing
Device is for realizing the audio frequency playing method when executing the computer program stored in memory.
The fourth aspect of the application provides a kind of computer readable storage medium, is stored thereon with computer program, described
The audio frequency playing method is realized when computer program is executed by processor.
Audio frequency playing method of the invention realizes that the audio player includes core layer, shows by audio player
Layer and bridge layer, the core layer are constructed using primary code, and the presentation layer is constructed using hypertext markup language, the side
Method includes: that the presentation layer shows player interface, receives the user's operation on the player interface, is grasped according to the user
Make to generate and play control instruction, the broadcasting control instruction is sent to the core layer by the bridge layer;The core
Layer receives the broadcasting control instruction, plays out control according to the broadcasting control instruction, records the audio player
The broadcast information is sent to the presentation layer by the bridge layer by broadcast information;The presentation layer receives the broadcasting
Information updates the player interface according to the broadcast information.
The player interface of audio player of the invention is modified in which can be convenient, and realizes that audio player flexibly sends out version.
Also, audio player, which carries out audio broadcasting after player interface is closed in the core layer that source code constructs, still can broadcast
Playback frequency meets backstage and continues the needs of playing audio.
Detailed description of the invention
Fig. 1 is the structure chart of audio player provided in an embodiment of the present invention.
Fig. 2 is the flow chart of audio frequency playing method provided in an embodiment of the present invention.
Fig. 3 is the structure chart of computer installation provided in an embodiment of the present invention.
Specific embodiment
To better understand the objects, features and advantages of the present invention, with reference to the accompanying drawing and specific real
Applying example, the present invention will be described in detail.It should be noted that in the absence of conflict, embodiments herein and embodiment
In feature can be combined with each other.
In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, described embodiment is only
It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill
Personnel's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Unless otherwise defined, all technical and scientific terms used herein and belong to technical field of the invention
The normally understood meaning of technical staff is identical.Term as used herein in the specification of the present invention is intended merely to description tool
The purpose of the embodiment of body, it is not intended that in the limitation present invention.
Preferably, audio frequency playing method of the invention is applied in one or more computer installation.The computer
Device is that one kind can be according to the instruction for being previously set or storing, the automatic equipment for carrying out numerical value calculating and/or information processing,
Hardware includes but is not limited to microprocessor, specific integrated circuit (Application Specific Integrated
Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital processing unit
(Digital Signal Processor, DSP), embedded device etc..
The computer installation, which may be, but not limited to, any one, to pass through keyboard, mouse, remote controler, touching with user
The modes such as template or voice-operated device carry out the electronic product of human-computer interaction, for example, tablet computer, smart phone, individual digital help
Manage (Personal Digital Assistant, PDA), intelligent wearable equipment etc..
Embodiment one
Fig. 1 is the structure chart for the audio player that the embodiment of the present invention one provides.The audio player 10 is included in and answers
With in program (such as safety gold house keeper), for realizing audio playing function in the application.The application program can be
Operate in the third party application of computer installation.
As shown in fig.1, the audio player 10 includes core layer 101, presentation layer 102 and bridge layer 103.
The core layer 101 is constructed using primary code.
Primary code is SDK (Software Development Kit, the Software Development Tools provided using operating system
Packet) code of language development supported, the functional and interface that accessible operating system provides is not isolated.It is different
Operating system different primary codes can be used.For example, primary code can be when operating system is iOS system
Objective-C (ObjC expands the Object-Oriented Programming Language of C) code;When operating system is Android system, primary code
It can be Java code.
The core layer 101 saves for realizing the broadcasting control of audio player 10 and broadcast information.The broadcasting control
System include: broadcasting, pause, stopping, last track, next track, switch modes, sequence, save playlist, adjust play into
Degree etc..The broadcast information that the core layer 101 saves include: player status, current play list, currently playing song, when
Preceding playback progress, current play mode etc..
Specifically, the core layer 101 includes the first receiving unit 1011, broadcast unit 1012, storage unit 1013, the
One transmission unit 1014.
First receiving unit 1011 is used to receive the broadcasting control instruction from presentation layer 102.
For example, the first receiving unit 1011 receives the play instruction from presentation layer 102.
For another example, the first receiving unit 1011 receives the next track play instruction from presentation layer 102.
For another example, the first receiving unit 1011 receives the play mode switching command from presentation layer 102.
The broadcast unit 1012 is used to play out control according to the broadcasting control instruction.
For example, broadcast unit 1012 plays current song if receiving play instruction.
For another example, if receiving next track play instruction, broadcast unit 1012 plays next track song.
For another example, if receiving play mode switching command, broadcast unit 1012 switches the play mode of audio player 10
(such as single circulation is changed to by played in order).
The storage unit 1013 is used to record the broadcast information of audio player 10.
The casting information is used to indicate the state of audio player 10.
For example, the record of storage unit 1013 is broadcast if broadcast unit 1012 plays current song in response to the play instruction
Put the information such as device state (being at this time broadcast state), currently playing song, currently playing progress.
For another example, if broadcast unit 1012 plays next track song in response to next track play instruction, storage unit 1013 is remembered
Record the information such as currently playing song, currently playing progress.
For another example, if broadcast unit 1012 switches the play mode of audio player in response to the play mode switching command
(such as being changed to single circulation by played in order), storage unit 1013 records current play mode.
First sending module 1014 is used to the broadcast information being sent to the displaying by the bridge layer 103
Layer 102.
For example, the first transmission unit 1014 passes through the information such as player status, currently playing song, currently playing progress
The bridge layer sends the presentation layer 102 to.
For another example, the information such as currently playing song, currently playing progress are passed through the bridge layer by the first transmission unit 1014
Send the presentation layer 102 to.
For another example, the first transmission unit 1014 sends current play mode to the presentation layer 102 by the bridge layer.
In the case where presentation layer 102 is using Javascript code, the first transmission unit 1014 can pass through calling
Javascript code sends the broadcast information to presentation layer 102.For example, can be by the side WebView.loadUrl
Method calls Javascript code, sends the broadcast information to presentation layer 102.
The presentation layer 102 is constructed using hypertext markup language (Hyper Text Markup Language, HTML).
Hypertext markup language is a kind of for creating the standard markup language of webpage, and being marked by label symbol will show
The various pieces in webpage shown." hypertext ", which refers to, may include picture, link or even the non-text such as audio, program in the page
Character table.The structure of hypertext markup language includes " head " part (Head) and " main body " part (Body).Wherein, " head " portion
Divide the information provided about webpage, " main body " part provides the particular content of webpage.
In the present embodiment, the hypertext markup language can be HTML5, i.e. the 5th generation hypertext markup language.
HTML5 is the newest revision version of HTML, completes standard formulation by World Wide Web Consortium (W3C) in October, 2014.The design of HTML5
Purpose is to support multimedia on the mobile apparatus.HTML5 has some new characteristics, comprising: (1) for drawing
Canvas element;(2) video the and audio element for medium playback;(3) there is better support to local offline storage;
(4) new special content element, such as article, footer, header, nav, section;(5) new form controls, than
Such as calendar, date, time, email, url, search.
The presentation layer 102 is used to show the player interface of audio player 10.
Specifically, the presentation layer 102 includes display unit 1021, the second transmission unit 1022, the second receiving unit
1023。
The display unit 1021 is used to show the player interface of audio player 10.
The player interface includes multiple user interface controls to play control, such as broadcast button, pause are pressed
Button, stop button, last track button, next track button, play mode switching push button, rank button, playlist, progress bar
Deng.
The display unit 1021 is also used to receive the user's operation on the player interface, such as to user circle
The user's operation of face control.For example, display unit 1021 receives the clicking operation to the broadcast button.For another example, display unit
1021 receive the clicking operation to the next track button.For another example, display unit 1021, which receives, presses play mode switching
The clicking operation of button.
Second transmission unit 1022, which is used to be generated according to the user's operation, plays control instruction, and the broadcasting is controlled
System instruction is sent to the core layer 101 by the bridge layer 103.
For example, the second transmission unit 1022 generates play instruction according to the clicking operation on the broadcast button, by institute
It states play instruction and the core layer 101 is sent to by the bridge layer 103.
For another example, the second transmission unit 1022 generates next track broadcasting according to the clicking operation to the next track button and refers to
It enables, the next track play instruction is sent to the core layer 101 by the bridge layer 103.
For another example, the second transmission unit 1022 generates play mode according to the clicking operation to the play mode switching push button
The play mode switching command is sent to the core layer 101 by the bridge layer 103 by switching command.
In the case where presentation layer 102 is using Javascript code, the second transmission unit 1022 can call Protozoic
Code, sends the broadcasting control instruction to core layer 101 by the bridge layer 103.For example, can pass through
WebView.addJavascriptInterface registration interface object, is then called in JavaScript, thus will be described
It plays control instruction and core layer 101 is sent to by the bridge layer 103.
Second receiving unit 1023 is for receiving the broadcast information from core layer 101.
For example, the second receiving unit 1023 receives the letter such as the player status, currently playing song, currently playing progress
Breath.
For another example, the second receiving unit 1023 receives the information such as the currently playing song, currently playing progress.
For another example, the second receiving unit 1023 receives the current play mode.
The display unit 1021 is also used to the broadcast information based on the received and updates the player interface.
For example, (such as player status, currently playing song, current if receiving the corresponding broadcast information of play instruction
Playback progress), the presentation layer updates the player status (being revised as broadcast state) that the player interface shows, currently broadcasts
It sings bent and currently playing progress.
For another example, if receive the corresponding broadcast information of next track play instruction (such as currently playing song, it is currently playing into
Degree), the presentation layer updates the currently playing song that the player interface is shown and currently playing progress (by progress bar position
It adjusts to initial position).
For another example, if receiving the corresponding broadcast information of play mode switching command (such as current play mode), the exhibition
Show that layer updates the play mode that the player interface is shown and (is revised as the play mode that the player interface is shown currently
Play mode).
The bridge layer 103 provides 101 He of core layer for connecting the core layer 101 and the presentation layer 102
Bi-directional communication channels between the presentation layer 102.Specifically, bridge layer 103 receives the broadcasting control from presentation layer 102
Instruction, sends the broadcasting control instruction to core layer 101;And reception is from the audio player 10 of core layer 101
Broadcast state, send the broadcast state to presentation layer 102.
In one embodiment, the code (i.e. primary code) that the core layer 101 uses is Java code, the presentation layer
102 codes (i.e. code used in Web application and development) that use are JavaScript (JS) codes, and the bridge layer 103 can be with
It is realized by JSSDK.
JavaScript is a kind of scripting language of explanation type, is explained line by line in the operational process of program.
JavaScript is object-based scripting language, can not only create object, could be used that existing object.JavaScript
Using event-driven mechanism, it needs not move through Web server and can respond to the input of user.Accessing a net
When page, mouse is carried out in webpage mouse click or on move down, window is mobile etc. operate JavaScript all can be directly to these
Event provides corresponding response.JavaScript scripting language is independent of operating system, it is only necessary to the support of browser.Therefore
JavaScript script can take on any machine after writing and use, and JavaScript is by most of browser at present
It is supported.Although JavaScript update it is convenient, cannot the direct function that provides of access operation system.
Java is an Object-Oriented Programming Language, has powerful and easy to use two features.Java language is made
For the representative of static Object-Oriented Programming Language, object-oriented theory is admirably realized, allows programmer with graceful thinking
Mode carries out complicated programming.Java has simplicity, object-oriented, distribution, robustness, safety, platform independently and can
The features such as transplantability, multithreading, dynamic, can be used for writing multipad, web application, distributed system and embedding
Embedded system application program.
JSSDK is a kind of scheme communicated between primary code (i.e. Java code) and JavaScript code, can be with
Realize the two-way communication between primary code and JavaScript.Its realization principle is as follows:
(1) JavaScript code calls Java code: being registered by WebView.addJavascriptInterface
Then interface object is called in JavaScript.It is specific as follows:
Step 1:
A class is realized in primary code, is called to javascript, such as:
Wherein, the function that showToast interface is realized is one Toast prompt of pop-up.
Step 2:
The class is registered in the JavascriptInterface of WebView:
WebView.addJavascriptInterface(new Demo(),"demo");
Step 3:
The method of the class of the primary code is called directly by the class in Javascript code:
function showToast(toast){
window.demo.showToast("hello");
}
(2) primary code calls JavaScript code: passing through WebView.loadUrl method call Javascript generation
Code.It is specific as follows:
Step 1:
A method is realized in Javascript code:
function test(msg){
console.log(msg)
}
Step 2:
Primary code passes through the method in WebView.loadUrl method call Javascript code:
WebView.loadUrl("javascritp://test('hello')")
In the present embodiment, the bridge layer 103 can pass through protocol realization core layer based on JSON and presentation layer
Two-way communication.JSON (JavaScript Object Notation, JS object numbered musical notation) is a kind of data exchange lattice of lightweight
Formula stores using the text formatting for being totally independent of programming language and indicates data, the type that any JavaScript is supported
It can be indicated by JSON, such as character string, number, object, array etc..
In another embodiment, the bridge layer 103 can be realized by JSBridge.JSBridge be Java code and
Another communication mode between JavaScript code.Java code can pass through a fixed bridge object reference
JavaScript code, JavaScript code can also pass through fixed bridge object reference Java code.JSBridge is this
The well-known technique in field, details are not described herein again.
The audio player 10 of embodiment one includes core layer 101, presentation layer 102 and bridge layer 103, the core layer
101 are constructed using primary code, are saved for realizing the broadcasting control of audio player 10 and broadcast information;The presentation layer
102 are constructed using hypertext markup language, for showing the player interface of audio player 10;The bridge layer 103 is used for
The core layer 101 and the presentation layer 102 are connected, the two-way between the core layer 101 and the presentation layer 102 is provided
Believe channel.Since the player interface of audio player 10 is generated by the presentation layer that hypertext markup language constructs, audio
The player interface of player 10 is modified in which can be convenient, and realizes that audio player flexibly sends out version.Also, audio player 10 exists
The core layer of source code building, which carries out audio broadcasting, still can play audio after player interface is closed, meet backstage after
The demand of continued broadcasting playback frequency.
Embodiment two
Fig. 2 is the flow chart of audio frequency playing method provided by Embodiment 2 of the present invention.The audio frequency playing method utilizes Fig. 1
Audio player 10 audio playing function is realized in the application program (such as safety gold house keeper).The audio player 10 wraps
Include core layer 101, presentation layer 102 and bridge layer 103.The audio frequency playing method specifically includes the following steps:
Step 201, presentation layer 102 shows player interface, receives the user's operation on the player interface.
The player interface includes multiple user interface controls to play control, such as broadcast button, pause are pressed
Button, stop button, last track button, next track button, play mode switching push button, rank button, playlist, progress bar
Deng.
The presentation layer 102 can receive the user's operation to the user interface controls.For example, presentation layer 102 receives
To the clicking operation of the broadcast button.For another example, presentation layer 102 receives the clicking operation to the next track button.For another example, it opens up
Show that layer 102 receives the clicking operation to the play mode switching push button.
Step 202, presentation layer 102 generates according to the user's operation and plays control instruction, by the broadcasting control instruction
Core layer 101 is sent to by the bridge layer 103.
For example, presentation layer 102 generates play instruction according to the clicking operation on the broadcast button, the broadcasting is referred to
It enables and the core layer 101 is sent to by the bridge layer 103.
For another example, presentation layer 102 generates next track play instruction according to the clicking operation to the next track button, will be described
Next track play instruction is sent to the core layer 101 by the bridge layer 103.
For another example, presentation layer 102 generates play mode switching according to the clicking operation to the play mode switching push button and refers to
It enables, the play mode switching command is sent to core layer 101 by bridge layer 103.
In the case where presentation layer 102 is using Javascript code, presentation layer 102 can by calling primary code,
Send the broadcasting control instruction to core layer 101.For example, can pass through
WebView.addJavascriptInterface registration interface object, is then called in JavaScript, thus will be described
It plays control instruction and core layer 101 is sent to by the bridge layer 103.It specifically includes: (1) in primary code (i.e. Java generation
Code) one class of middle realization, give javascript to call;(2) class is registered to WebView's
In JavascriptInterface;(3) class of the primary code is called directly by the class in Javascript code
Method.
Step 203, core layer 101 receives the broadcasting control instruction.
For example, core layer 101 receives the play instruction.
For another example, core layer 101 receives the next track play instruction.
For another example, core layer 101 receives the play mode switching command.
Step 204, core layer 101 plays out control according to the broadcasting control instruction.
For example, core layer 101 plays current song if receiving the play instruction.
For another example, if receiving next track play instruction, core layer 101 plays next track song.
For another example, if receiving the play mode switching command, core layer 101 switches the play mode of audio player
(such as single circulation is changed to by played in order).
Step 205, core layer 101 records the broadcast information of audio player 10.
The casting information is used to indicate the state of audio player 10.
For example, if in response to the play instruction play current song, 101 record player state of core layer (at this time for
Broadcast state), currently playing song, the information such as currently playing progress.
For another example, if in response to next track play instruction play next track song, core layer 101 record currently playing song,
The information such as currently playing progress.
For another example, if in response to the play mode switching command switching audio player play mode (such as by sequence
Broadcasting is changed to single circulation), core layer 101 records current play mode.
Step 206, the broadcast information is sent to presentation layer 102 by the bridge layer 103 by core layer 101.
For example, the information such as player status, currently playing song, currently playing progress are passed through the bridge by core layer 101
It connects layer and sends the presentation layer 102 to.
For another example, core layer 101 sends the information such as currently playing song, currently playing progress to institute by the bridge layer
State presentation layer 102.
For another example, core layer 101 sends current play mode to the presentation layer 102 by the bridge layer.
In the case where presentation layer 102 is using Javascript code, the first transmission unit 1014 can pass through calling
Javascript code sends the broadcast information to presentation layer 102.For example, can be by the side WebView.loadUrl
Method calls Javascript code, specifically includes: (1) method is realized in Javascript code;(2) primary code
(i.e. Java code) passes through the method in WebView.loadUrl method call Javascript code.
Step 207, presentation layer 102 receives the broadcast information.
For example, presentation layer 102 receives the information such as the player status, currently playing song, currently playing progress.
For another example, presentation layer 102 receives the information such as the currently playing song, currently playing progress.
For another example, presentation layer 102 receives the current play mode.
Step 208, presentation layer 102 updates the player interface according to the broadcast information.
For example, (such as player status, currently playing song, current if receiving the corresponding broadcast information of play instruction
Playback progress), the presentation layer updates the player status (being revised as broadcast state) that the player interface shows, currently broadcasts
It sings bent and currently playing progress.
For another example, if receive the corresponding broadcast information of next track play instruction (such as currently playing song, it is currently playing into
Degree), the presentation layer updates the currently playing song that the player interface is shown and currently playing progress (by progress bar position
It adjusts to initial position).
For another example, if receiving the corresponding broadcast information of play mode switching command (such as current play mode), the exhibition
Show that layer updates the play mode that the player interface is shown and (is revised as the play mode that the player interface is shown currently
Play mode).
In the audio frequency playing method of embodiment two, the presentation layer 102 of audio player 10 shows player interface, receives institute
The user's operation on player interface is stated, is generated according to the user's operation and plays control instruction, by the broadcasting control instruction
Core layer 101 is sent to by the bridge layer 103;Core layer receives the broadcasting control instruction, is controlled according to the broadcasting
Instruction plays out control, records the broadcast information of audio player 10, and the broadcast information is sent out by the bridge layer 103
Give the presentation layer 102;The presentation layer receives the broadcast information, updates player circle according to the broadcast information
Face.Since the player interface of audio player is generated by the presentation layer that hypertext markup language constructs, embodiment two can
Easily to modify the player interface of audio player 10, the flexibly hair version of audio player 10 is realized.Also, embodiment two exists
The core layer 101 of source code building, which carries out audio broadcasting, still can play audio after player interface is closed, after satisfaction
Platform continues to play the demand of audio.
Embodiment three
The present embodiment provides a kind of computer readable storage medium, computer is stored on the computer readable storage medium
Program, the computer program realize the step in above-mentioned audio frequency playing method embodiment when being executed by processor, such as shown in Fig. 2
Step 201-208:
Step 201, presentation layer 102 shows player interface, receives the user's operation on the player interface;
Step 202, presentation layer 102 generates according to the user's operation and plays control instruction, by the broadcasting control instruction
Core layer 101 is sent to by bridge layer 103;
Step 203, core layer 101 receives the broadcasting control instruction;
Step 204, core layer 101 plays out control according to the broadcasting control instruction;
Step 205, core layer 101 records the broadcast information of audio player 10;
Step 206, the broadcast information is sent to presentation layer 102 by bridge layer 103 by core layer 101;
Step 207, presentation layer 102 receives the broadcast information;
Step 208, presentation layer 102 updates the player interface according to the broadcast information.
Alternatively, the function of each module/unit in above-mentioned apparatus embodiment is realized when the computer program is executed by processor,
Example core layer 101 as shown in figure 1, presentation layer 102, bridge layer 103:
Presentation layer 102, is constructed using hypertext markup language, for showing player interface, receives player circle
User's operation on face generates according to the user's operation and plays control instruction, and the broadcasting control instruction is passed through the bridge
It connects layer 103 and is sent to the core layer 101;
Core layer 101, is constructed using primary code, for receiving the broadcasting control instruction, is controlled according to the broadcasting
Instruction plays out control, records the broadcast information of the audio player, and the broadcast information is passed through the bridge layer 103
It is sent to the presentation layer 102;
Presentation layer 102 is also used to receive the broadcast information, updates the player interface according to the broadcast information;
Bridge layer 103 provides the core layer 101 and institute for connecting the core layer 101 and the presentation layer 102
State the bi-directional communication channels between presentation layer 102.
Example IV
Fig. 3 is the schematic diagram of computer installation preferred embodiment of the present invention.The computer installation 1 include memory 20,
Processor 30 and it is stored in the computer program 40 that can be run in the memory 20 and on the processor 30, such as sound
Frequency playing program.The processor 30 realizes the step in above-mentioned audio frequency playing method embodiment when executing the computer program 40
Such as step 201-208 shown in Fig. 2 suddenly:
Step 201, presentation layer 102 shows player interface, receives the user's operation on the player interface;
Step 202, presentation layer 102 generates according to the user's operation and plays control instruction, by the broadcasting control instruction
Core layer 101 is sent to by bridge layer 103;
Step 203, core layer 101 receives the broadcasting control instruction;
Step 204, core layer 101 plays out control according to the broadcasting control instruction;
Step 205, core layer 101 records the broadcast information of audio player 10;
Step 206, the broadcast information is sent to presentation layer 102 by bridge layer 103 by core layer 101;
Step 207, presentation layer 102 receives the broadcast information;
Step 208, presentation layer 102 updates the player interface according to the broadcast information.
Alternatively, realizing each module in above-mentioned apparatus embodiment/mono- when the processor 30 executes the computer program 40
The function of member, example core layer 101 as shown in figure 1, presentation layer 102, bridge layer 103:
Presentation layer 102, is constructed using hypertext markup language, for showing player interface, receives player circle
User's operation on face generates according to the user's operation and plays control instruction, and the broadcasting control instruction is passed through the bridge
It connects layer 103 and is sent to the core layer 101;
Core layer 101, is constructed using primary code, for receiving the broadcasting control instruction, is controlled according to the broadcasting
Instruction plays out control, records the broadcast information of the audio player, and the broadcast information is passed through the bridge layer 103
It is sent to the presentation layer 102;
Presentation layer 102 is also used to receive the broadcast information, updates the player interface according to the broadcast information;
Bridge layer 103 provides the core layer 101 and institute for connecting the core layer 101 and the presentation layer 102
State the bi-directional communication channels between presentation layer 102.
Illustratively, the computer program 40 can be divided into one or more module/units, it is one or
Multiple module/units are stored in the memory 20, and are executed by the processor 30, to complete the present invention.Described one
A or multiple module/units can be the series of computation machine program instruction section that can complete specific function, which is used for
Implementation procedure of the computer program 40 in the computer installation 1 is described.For example, the computer program 40 can be by
It is divided into core layer 101 in Fig. 1, presentation layer 102, bridge layer 103, each layer concrete function is referring to embodiment one.
The computer installation 1, which may be, but not limited to, any one, to pass through keyboard, mouse, remote controler, touching with user
The modes such as template or voice-operated device carry out the electronic product of human-computer interaction, for example, tablet computer, smart phone, individual digital help
Manage (Personal Digital Assistant, PDA), intelligent wearable equipment etc..It will be understood by those skilled in the art that institute
The example that schematic diagram 3 is only computer installation 1 is stated, the restriction to computer installation 1 is not constituted, may include than illustrating more
More or less component perhaps combines certain components or different components, such as the computer installation 1 can also include
Input-output equipment, network access equipment, bus etc..
Alleged processor 30 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor 30 is also possible to any conventional processor
Deng the processor 30 is the control centre of the computer installation 1, utilizes various interfaces and connection entire computer dress
Set 1 various pieces.
The memory 20 can be used for storing the computer program 40 and/or module/unit, and the processor 30 passes through
Operation executes the computer program and/or module/unit being stored in the memory 20, and calls and be stored in memory
Data in 20 realize the various functions of the computer installation 1.The memory 20 can mainly include storing program area and deposit
Store up data field, wherein storing program area can application program needed for storage program area, at least one function (for example sound is broadcast
Playing function, image player function etc.) etc.;Storage data area, which can be stored, uses created data (ratio according to computer installation 1
Such as audio data, phone directory) etc..In addition, memory 20 may include high-speed random access memory, it can also include non-easy
The property lost memory, such as hard disk, memory, plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital
(Secure Digital, SD) card, flash card (Flash Card), at least one disk memory, flush memory device or other
Volatile solid-state part.
If the integrated module/unit of the computer installation 1 is realized in the form of SFU software functional unit and as independence
Product when selling or using, can store in a computer readable storage medium.Based on this understanding, of the invention
It realizes all or part of the process in above-described embodiment method, can also instruct relevant hardware come complete by computer program
At the computer program can be stored in a computer readable storage medium, which is being executed by processor
When, it can be achieved that the step of above-mentioned each embodiment of the method.Wherein, the computer program includes computer program code, described
Computer program code can be source code form, object identification code form, executable file or certain intermediate forms etc..The meter
Calculation machine readable medium may include: can carry the computer program code any entity or device, recording medium, USB flash disk,
Mobile hard disk, magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory
Device (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It needs to illustrate
It is that the content that the computer-readable medium includes can be fitted according to the requirement made laws in jurisdiction with patent practice
When increase and decrease, such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium does not include electric carrier wave letter
Number and telecommunication signal.
In several embodiments provided by the present invention, it should be understood that disclosed computer installation and method, it can be with
It realizes by another way.For example, computer installation embodiment described above is only schematical, for example, described
The division of unit, only a kind of logical function partition, there may be another division manner in actual implementation.
It, can also be in addition, each functional unit in each embodiment of the present invention can integrate in same treatment unit
It is that each unit physically exists alone, can also be integrated in same unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds software function module.
It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie
In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter
From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power
Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims
Variation is included in the present invention.Any reference signs in the claims should not be construed as limiting the involved claims.This
Outside, it is clear that one word of " comprising " does not exclude other units or steps, and odd number is not excluded for plural number.It is stated in computer installation claim
Multiple units or computer installation can also be implemented through software or hardware by the same unit or computer installation.The
One, the second equal words are used to indicate names, and are not indicated any particular order.
Finally it should be noted that the above examples are only used to illustrate the technical scheme of the present invention and are not limiting, although reference
Preferred embodiment describes the invention in detail, those skilled in the art should understand that, it can be to of the invention
Technical solution is modified or equivalent replacement, without departing from the spirit and scope of the technical solution of the present invention.
Claims (10)
1. a kind of audio frequency playing method, this method passes through audio player and realizes, which is characterized in that the audio player includes
Core layer, presentation layer and bridge layer, the core layer are constructed using primary code, and the presentation layer uses hypertext markup language
Building, which comprises
The presentation layer shows player interface, the user's operation on the player interface is received, according to the user's operation
It generates and plays control instruction, the broadcasting control instruction is sent to the core layer by the bridge layer;
The core layer receives the broadcasting control instruction, control is played out according to the broadcasting control instruction, described in record
The broadcast information is sent to the presentation layer by the bridge layer by the broadcast information of audio player;
The presentation layer receives the broadcast information, updates the player interface according to the broadcast information.
2. the method as described in claim 1, which is characterized in that the core layer uses Java code, and the presentation layer uses
JavaScript code.
3. method according to claim 2, which is characterized in that the broadcasting control instruction is passed through the bridge by the presentation layer
It connects layer and is sent to the core layer and include:
A class is realized in the Java code, is called to the javascript;
The class is registered in the JavascriptInterface of WebView;
The method of the class of the Java code is called directly by the class in the Javascript code.
4. method according to claim 2, which is characterized in that the broadcast information is passed through the bridge layer by the core layer
Being sent to the presentation layer includes:
A method is realized in the Javascript code;
The Java code passes through the side realized in Javascript code described in WebView.loadUrl method call
Method.
5. the method as described in claim 1, which is characterized in that the bridge layer passes through the protocol realization core layer based on JSON
With the two-way communication of presentation layer.
6. the method as described in claim 1, which is characterized in that the player interface includes following one one or more group
Close: broadcast button, pause button, stop button, last track button, next track button, play mode switching push button, sequence are pressed
Button, playlist, progress bar.
7. the method as described in claim 1, which is characterized in that the hypertext markup language includes the 5th generation hypertext markup
Language.
8. a kind of audio player, which is characterized in that the audio player includes core layer, presentation layer and bridge layer, described
Core layer is constructed using primary code, and the presentation layer is constructed using hypertext markup language, wherein the core layer includes:
First receiving unit, for receiving the broadcasting control instruction from the presentation layer;
Broadcast unit, for playing out control according to the broadcasting control instruction;
Storage unit, for recording the broadcast information of the audio player;
First sending module, for the broadcast information to be sent to the presentation layer by the bridge layer;
The presentation layer includes:
Display unit receives the user behaviour on the player interface for showing the player interface of the audio player
Make;
Second transmission unit, for generating the broadcasting control instruction according to the user's operation, by the broadcasting control instruction
The core layer is sent to by the bridge layer;
Second receiving unit, for receiving the broadcast information from the core layer;
The display unit is also used to the broadcast information based on the received and updates the player interface;
The bridge layer provides between the core layer and the presentation layer for connecting the core layer and the presentation layer
Bi-directional communication channels.
9. a kind of computer installation, it is characterised in that: the computer installation includes processor, and the processor is deposited for executing
The computer program stored in reservoir is to realize the audio frequency playing method as described in any one of claim 1-7.
10. a kind of computer readable storage medium, computer program, feature are stored on the computer readable storage medium
It is: realizes the audio frequency playing method as described in any one of claim 1-7 when the computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811238891.9A CN109634549A (en) | 2018-10-23 | 2018-10-23 | Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811238891.9A CN109634549A (en) | 2018-10-23 | 2018-10-23 | Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109634549A true CN109634549A (en) | 2019-04-16 |
Family
ID=66066609
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811238891.9A Pending CN109634549A (en) | 2018-10-23 | 2018-10-23 | Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109634549A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110913277A (en) * | 2019-11-29 | 2020-03-24 | 百度在线网络技术(北京)有限公司 | Video playing method and device, electronic equipment and storage medium |
CN112015407A (en) * | 2019-05-31 | 2020-12-01 | 北京字节跳动网络技术有限公司 | Plug-in player implementation method and device and electronic equipment |
CN112181366A (en) * | 2020-09-28 | 2021-01-05 | 科大国创云网科技有限公司 | Mobile application development framework based on cross-platform interaction |
CN113791752A (en) * | 2021-09-16 | 2021-12-14 | 深圳市芯中芯科技有限公司 | Method for synchronously controlling webpage music playing state through js in android system |
CN113810494A (en) * | 2021-09-16 | 2021-12-17 | 腾讯科技(深圳)有限公司 | Audio playing control method, device, terminal and storage medium |
WO2022166573A1 (en) * | 2021-02-04 | 2022-08-11 | 上海哔哩哔哩科技有限公司 | Reading processing method, apparatus and system |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110138354A1 (en) * | 2009-12-07 | 2011-06-09 | International Business Machines Corporation | Interactive video player component for mashup interfaces |
CN102625182A (en) * | 2012-03-31 | 2012-08-01 | 百视通网络电视技术发展有限责任公司 | Method and system for integrating and controlling video player in Connected TV |
US20120209413A1 (en) * | 2011-02-14 | 2012-08-16 | Microsoft Corporation | Background Audio on Mobile Devices |
CN102779046A (en) * | 2012-07-04 | 2012-11-14 | 合一网络技术(北京)有限公司 | Video playing system based on HTML5 development and video playing method thereof |
CN104951326A (en) * | 2014-03-31 | 2015-09-30 | 腾讯科技(深圳)有限公司 | Web access method and device |
CN105354013A (en) * | 2014-08-18 | 2016-02-24 | 阿里巴巴集团控股有限公司 | Application interface rendering method and apparatus |
CN105743955A (en) * | 2014-12-11 | 2016-07-06 | 中国科学院声学研究所 | Method for JavaScript object expansion |
CN105791994A (en) * | 2014-12-25 | 2016-07-20 | 深圳Tcl数字技术有限公司 | Webkit browser video playing method and device based on Android system |
CN108683801A (en) * | 2018-04-24 | 2018-10-19 | Oppo广东移动通信有限公司 | Control method, apparatus, terminal and computer readable storage medium that audio plays |
-
2018
- 2018-10-23 CN CN201811238891.9A patent/CN109634549A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110138354A1 (en) * | 2009-12-07 | 2011-06-09 | International Business Machines Corporation | Interactive video player component for mashup interfaces |
US20120209413A1 (en) * | 2011-02-14 | 2012-08-16 | Microsoft Corporation | Background Audio on Mobile Devices |
CN102625182A (en) * | 2012-03-31 | 2012-08-01 | 百视通网络电视技术发展有限责任公司 | Method and system for integrating and controlling video player in Connected TV |
CN102779046A (en) * | 2012-07-04 | 2012-11-14 | 合一网络技术(北京)有限公司 | Video playing system based on HTML5 development and video playing method thereof |
CN104951326A (en) * | 2014-03-31 | 2015-09-30 | 腾讯科技(深圳)有限公司 | Web access method and device |
CN105354013A (en) * | 2014-08-18 | 2016-02-24 | 阿里巴巴集团控股有限公司 | Application interface rendering method and apparatus |
CN105743955A (en) * | 2014-12-11 | 2016-07-06 | 中国科学院声学研究所 | Method for JavaScript object expansion |
CN105791994A (en) * | 2014-12-25 | 2016-07-20 | 深圳Tcl数字技术有限公司 | Webkit browser video playing method and device based on Android system |
CN108683801A (en) * | 2018-04-24 | 2018-10-19 | Oppo广东移动通信有限公司 | Control method, apparatus, terminal and computer readable storage medium that audio plays |
Non-Patent Citations (1)
Title |
---|
WEIXIN_33908217, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_33908217/article/details/93589345> * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112015407A (en) * | 2019-05-31 | 2020-12-01 | 北京字节跳动网络技术有限公司 | Plug-in player implementation method and device and electronic equipment |
CN110913277A (en) * | 2019-11-29 | 2020-03-24 | 百度在线网络技术(北京)有限公司 | Video playing method and device, electronic equipment and storage medium |
CN112181366A (en) * | 2020-09-28 | 2021-01-05 | 科大国创云网科技有限公司 | Mobile application development framework based on cross-platform interaction |
CN112181366B (en) * | 2020-09-28 | 2023-01-24 | 科大国创云网科技有限公司 | Mobile application development framework based on cross-platform interaction |
WO2022166573A1 (en) * | 2021-02-04 | 2022-08-11 | 上海哔哩哔哩科技有限公司 | Reading processing method, apparatus and system |
CN113791752A (en) * | 2021-09-16 | 2021-12-14 | 深圳市芯中芯科技有限公司 | Method for synchronously controlling webpage music playing state through js in android system |
CN113810494A (en) * | 2021-09-16 | 2021-12-17 | 腾讯科技(深圳)有限公司 | Audio playing control method, device, terminal and storage medium |
CN113791752B (en) * | 2021-09-16 | 2024-06-11 | 深圳市芯中芯科技有限公司 | Method for synchronously controlling webpage music playing state in android system through js |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109634549A (en) | Audio frequency playing method, audio player, computer installation and readable storage medium storing program for executing | |
CN105981394B (en) | Lasting media player | |
Bucy et al. | Media access: Social and psychological dimensions of new technology use | |
CN102194003A (en) | Web page popup window method and device | |
JP2023179795A (en) | Barrage processing method, device, electronic apparatus, and program | |
CN104126186A (en) | Systems and methods for developing multi-platform applications for computing devices | |
US20090235230A1 (en) | System and method for presentation of cross organizational applications | |
CN101697156A (en) | Method and system for constructing chain web pages | |
WO2003081436A1 (en) | Browser and program containing multi-medium content | |
CN111142833B (en) | Method and system for developing voice interaction product based on contextual model | |
CN106354355A (en) | User interface layout method, device and system | |
CN104268273B (en) | Processing method, device and browser, the browser plug-in of pushed information | |
CN106028172A (en) | Audio/video processing method and device | |
CN114143572A (en) | Live broadcast interaction method and device, storage medium and electronic equipment | |
CN109391848A (en) | A kind of interactive advertisement system | |
CN106250007B (en) | A kind of system and method realizing branching selection and playing | |
CN104883614A (en) | WEB video playing method based on Adobe FlashPlayer and Jquery frame | |
CN108491232A (en) | The method and system of control are loaded in voice dialogue platform | |
CN109905753A (en) | The display methods and device of footmark, storage medium, electronic device | |
CN110600021A (en) | Outdoor intelligent voice interaction method, device and system | |
CN117520693A (en) | Multimedia data processing method, device, equipment and storage medium | |
CN113220200B (en) | Presentation file presentation method and device, storage medium and electronic device | |
CN112685120A (en) | Visual data conversion method, device, equipment and medium | |
CN106462868A (en) | Method for providing advertising service by means of advertising medium, and apparatus and system therefor | |
CN110244948A (en) | The method and electronic equipment that language switches over button state based on programming |
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 |