Joke Collection Website - Public benefit messages - How to realize online audio playback of MMS radio station with ios and android browsers on mobile phones?

How to realize online audio playback of MMS radio station with ios and android browsers on mobile phones?

From the function of the software, MMS can be divided into call list, message list, SMS editing, MMS editing, SMS display, MMS display and configuration.

From the perspective of implementation, it is divided into GUI presentation layer, sending/receiving, MMS parsing, MMS attachment, information data and so on. These categories correspond to various packages in the source code.

Source navigation

The source code of MMS is located in android/packages/apps/Mms.

Among them, Mms/src/com/android/mms contains MMS-related codes, while Mms/src/org/w3c/dom contains a class library, which is mainly used for parsing and displaying MMS formats. Here we mainly talk about the main uses of some packages and classes under Mms/src/com/android/mms.

Ui-GUI presentation layer is used to display dialogue list, message list, message editing page, MMS attachment editing, MMS presentation and slide show. Responsible for direct interaction with users.

Java-the adapter of ConversationList is used to bind data to the conversation list of the display layer.

Java-a data structure representing each item in the dialog list, which contains the information to be displayed in the dialog list.

ConversationList.java-This is the display window activity of the dialogue list, and it is a ListActivity. These classes are related to conversation lists and are used to display, edit and manage all conversations.

ComposeMessageActivity.java-This is the core window activity, which edits information and displays all communication information in the conversation thread. MessageListView will be added to it, and AttachmentEditor will also be added to it. This activity is also responsible for responding to external applications and sending requests, such as SENDTO or send. For example, if an external application wants to send information, it will be responded by this activity.

MessageItem.java-the abstract data representing a message, which contains all information-related contents, such as the subject of the message, the content of the message, the address of the letter, the content of the attachment and so on. All its data are internal members of the company and can be accessed directly.

MessageListAdapter.java- Used to bind data to the message list display layer (created by ComposeMessageActivity and bound to MessageListView).

MessageListView.java-used to display the message list, inherited from ListView, and its life cycle is controlled by ComposeMessageActivity, and whether it is displayed or not is also controlled by it.

MessageListItem.java- is a layout for displaying and controlling the display of each message in the message list.

AttachmentTypeSelectAdapter.java-list of attachments supported when adding attachments, which is a menu.

AttachmentEditor.java- Used to display added attachments when editing multimedia messages. Its life cycle is controlled by ComposeMessageActivity, and whether it is displayed or not is also controlled by ComposeMessageActivity. It will be displayed when there are MMS attachments, otherwise it will be hidden. It is a layout manager that manages the following four layouts and dynamically displays one of the following four views according to the attachment type.

AudioAttachmentView.java- Used to display audio attachments in the editor, which is inherited from the linear layout. It is not used directly in code, but as a layout manager in a layout file.

ImageAttachmentView.java- Used to display picture attachments in the editor, which is inherited from linear layout. It is not used directly in code, but as a layout manager in a layout file.

Java-used to display slide attachments in the editor, which inherits from the linear layout. It is not used directly in code, but as a layout manager in a layout file.

VideoAttachmentView.java- Used to display video attachments in the editor, which inherits the linear layout. It is not used directly in code, but as a layout manager in a layout file.

Slideshowactivity.java-used to play slides in full screen, that is, to show slides, because MMS is created and played in the form of slides, that is, one by one, each with text, pictures, video and audio on it, and each has browsing time.

SlideshowEditActivity.java- Manage slides in a list, that is, show all slides in the list. Users can add a slide or click Edit a slide to create and edit slides.

SlideshowEditor.java- Used to edit slides, such as adding elements, deleting elements and replacing elements. The elements here can be pictures, videos, audio and text. It can also be used to edit an entire slide, such as deleting a slide and adjusting the position of this slide among all slides. It is a concrete operation slide package, which was created by SlideEditorActivity and used to complete the slide editing.

SlideshowPresenter.java- used to display all the slides, that is, to play all the slides. Created and used by SlideshowActivity.

SlideViewInterface.java- Defines some interfaces for displaying slide content, such as setting images, setting videos, setting audio, playing videos, playing audio, pausing, randomly positioning and so on. The views shown in the attachment: audioattachmentview, ImageAttachmentView, SlideshowAttachmentView and VideoAttachmentView all implement this interface, so that the AttachmentEditor can use a unified interface to control the content playback regardless of the specific content.

SlideEditorActivity.java- Used to edit slides, such as adding audio, adding video, adding images, adding text, etc. It just provides a user interface that allows users to operate various buttons to add elements, replace elements or delete elements. The operation of specific slides is completed through SlideshowEditor, which is mainly responsible for interacting with users.

The layout management of each item in the list in slidelistitemview.java-slideshow edit activity is inherited from LinearLayout.

MmThumbnailpresenter.java-Used to display thumbnails of multimedia messages in the message list. Because the content of MMS is not fixed, it may be pictures, audio, video or slides, so this class is used to process and display thumbnails of MMS.

The configuration information editor of MessagingpReferenceActivity. Java-MMS is used to edit and change the configuration information and inherit the information preferenceactivity. It is responsible for interacting with users, displaying and changing configurations. When Mms starts, MmsConfig will read the configuration information from SharedPreference. At runtime, get the configuration information of other classes from MmsConfig. MmsConfig provides many Get methods to get configuration information.

Presenter.java-an abstract class for displaying attachments.

PresenterFactory.java factory law.

RecipientsAdapter.java

RecipientsEditor.java-an edit box used to display recipients on the information editing page, which can be completed automatically, and the completed data is provided by RecipientsAdapter.

ViewInterface.java-the base class that represents views, and is used to show content in slides or take thumbnails. You can measure the length, width and height of the field of vision.

BasicSlideEditorView.java- The layout used when editing slides, that is, the layout used in SlideEditorActivity.java.

EditSlidedDurationActivity. Java-As the name implies, it is used to edit the browsing time of slides.

ManageSimMessages.java- This is used in the settings to manage the information in the SIM card. One of the settings is to manage the information on the SIM card. In MMS settings, there is an option to set whether to store information in SIM card or mobile phone. SmsReceiverService will check this setting when receiving the mail, and then write the received information to the corresponding address. ManageSimMessages also displays the information in the SIM in the form of a list, and provides two menus: save the information in the mobile phone and delete it.

NumberPickerButton.java- Button for displaying the selected number, used in configuration.

NumberPickerDialog.java- Used to display a dialog box for selecting numbers, used in configuration.

NumberPicker.java- Used to select numbers during configuration. These numeric selectors are mainly used for setting.

Deliver reporting activities. Java- information sending status report. Display in the form of a list

DeliveryReportAdapter.java correspondence adapter

DeliveryReportItem.java--corresponding data, data of each item.

DeliveryReportListItem.java--the layout of each project.

Data-Data related to information currently being edited, such as contact list, such as current conversation, such as current message. Responsible for managing the information currently being edited, the current conversation and the contacts used by the current information. These classes are used when editing information, because most of them are used to manage data, but they cannot be passed directly to the editor as objects. So many of their methods are static, that is, these classes are similar to single keys.

WorkingMessage.java- used to manage the message currently being edited. It exists from creation, draft to sending. As long as you open the page for editing information, a working message will be created until you exit the editing page.

Conversation.java- Used to manage session threads, usually used to manage the current session, that is, the entered session and the ongoing session. It is also used to manage the session list, such as querying the session list.

Contact.java- used to represent the information of a contact, manage contacts, and load contact information, including the corresponding cache. Because the data of a contact person is relatively large, including first name, last name, various telephone numbers, various addresses and so on. Because the contact is directly used as the contact in the MMS, all information is directly obtained from it. In addition, because information interaction will also involve contacts, because a series of telephone numbers can be used directly when sending and receiving letters, it is necessary to add the function of contacts at this time. There are many asynchronous operations in Contact, such as loading contact information or updating cache, so as not to block the caller.

ContactList.java- is a contact list, which is inherited from the array list.

RecipientiCache.java-Used to save the Id and address (phone number) of the contact person used. Every time WorkingMessage updates the cache, ContactList will first query the contacts from the cache.

Dom-a toolkit for parsing MMS content smil

Drm-a toolkit for processing DRM media files

Layout-Layout elements rewritten to meet special needs.

Model-defines the attachment data structure and attachment organization mode supported by MMS. MMS can include pictures, videos, audio and text. These contents can exist separately or together. If combined together, it becomes a slide. Users can use slides to create attachments with multiple media, with illustrations and descriptions. Video, audio, pictures and text can be added to each slide, but usually only one picture or video can be added to a slide, text can be added, only audio can be added, but no video can be added. When playing, you can set the duration of each slide, the scrolling speed of the text and so on.

This is a specific multimedia message attachment checkpoint. For unsupported attachments, or the attachment size exceeds the limit, or the image resolution is wrong, or the image size exceeds the size, exceptions will be thrown: unsupported ContentTypeException, ResolutionException, ExceedMessageSizeException, ContentRestrictionException.

ContentRestriction.java is an interface for checking attachments, which can be used directly from outside. The concrete implementation is CarrierContentRestriction.

ContentRestrictionFactory.java is the factory method for creating attachment inspection. Create a ContentRestriction object externally through this factory, and then use the inspection method defined in it to inspect the attachment internally.

Tool class used by SmilHelper.java to parse and process Smil in attachments.

IModelChangedObserver.java interface, which is used to monitor the changes of attachment contents.

Model.java-The data organization and management mode of MMS attachments is that each attachment is a subclass of Model, which is not only used to manage the specific data of attachments, such as Uri, size, file name, location, etc., but also used to display and view attachments in GUI.

LayoutModel.java-a class inherited from Model, used to manage the layout of visual attachments. It is used to manage basic elements such as RegionModel. Just like some layout managers such as ViewGroup or LinearLayout and RelativeLayout, they are used to organize and manage basic layout elements, that is, subclasses of RegionModel, such as ImageModel, TextModel and VideoModel.

RegionModel.java-Inherited from Model, used to manage visual attachments and layouts, such as images, videos and texts. Especially when displaying visual attachments, it is used to control the position of visual attachments in the screen. RegionModel represents a region on the slide, which is the basic element of layout on the slide. Just like View in UI elements, but most of them use its subclasses, namely ImageModel, TextModel and VideoModel.

RegionMediaModel.java- Inherited from MediaModel, it is used for layout control of visual parts in multimedia attachments, mainly used for display of attachments and control when playing slides. Its subclasses are ImageModel, TextModel and VideoModel.

MediaModel.java- Inherited from the model, it represents the data structure of media, manages specific attachment data, and also manages the display control of attachments, such as image display, audio and video playback control, etc.

MediaModelFactory.java- used to parse the media model in the Pdu attachment, that is, to convert the Pdu into the attachment data in Mms.

Image model. Java— Inherited from RegionMediaModel, it is used to manage and control the display of image attachments.

VideoModel.java- Inherited from RegionMediaModel, used to manage and control the playback of video attachments.

AudioModel.java- inherited from MediaModel, used to manage and control the playback of audio attachments.

SlideModel.java-Inherited from the model, used to manage a set of attachments displayed to users at the same time. Just like a slide show, each SlideModel has a list that can store models, which can contain text, audio, images or videos, and display its attachments.

SlideshowModel.java- Inherited from the model, used to manage all attachments in multimedia messages. It contains a list of stored SlideModel, which is used to save and control all attachments in MMS. In addition, it is responsible for displaying these attachments, organizing the SlideModel and playing them. I am also responsible for converting these MMS attachments (various models) into the attachment Pdu of Android, and proposing my own model from the Pdu, because Slideshow is the MMS processing method of application layer, and the MMS data that can be sent and received is Pdu.

TextModel.java- Inherited from RegionMediaModel, it is used to manage and control the display of text attachments, such as scrolling by time.

Util-this is a tool class enjoyed by the whole Mms***, and it is a single-key or directly used class. You cannot create and use objects in the form of objects.

AddressUtils.java- a tool class about addresses. At present, there is only one getFrom () method to get the sender's address.

DraftCache.java-Used to identify which conversations have drafts and which don't, that is, used to manage and query the draft status of conversations and whether there are drafts. It maintains a HashSet that contains all thread ids with drafts. It also has a HashSet for storing OnDraftChangedListener, that is, when the draft state of a thread changes, DraftCache will call the corresponding listener to inform the corresponding module that the draft state of this conversation has changed. You can set the draft status of the dialogue through draftcache. setdraftstate (threadid,state); You can query whether a conversation contains a draft through DraftCache.hasDraft(threadId).

Recycler.java- is an abstract tool class, in which SmsRecycler and MmsRecycler are defined to delete outdated messages or information exceeding the information limit. The method of use is a recycler. getsmsrecycler。 Deleteoldmessages (context) or recycler. getmmrecycler。 Deleteoldmessages (context)

SmileyParser.java- Converts punctuation characters into graphic expressions, such as? Please use the icon smiley face instead.

DownloadManager.java- Don't be confused by the name, it is not a real download manager because it is not responsible for the download process or the management of downloaded files. It is used to manage configuration information related to downloading, such as whether downloading is automatic or not, and various notifications during downloading, such as notification bar and Toast prompt.

RateController.java

SendingProgressTokenManager.java

Transaction-the minimum package of MMS, invisible to users, responsible for the final processing of sending messages and the initial processing of receiving messages. Mainly responsible for sending information and receiving information. It doesn't really send and receive information. The system framework is responsible for receiving and sending information. This package is only for Mms application layer to send and receive.

AbstractRetryScheme.java

Java-These two classes implement the retry mechanism, because the sending and receiving of information will be limited by the environment. For example, if there is no signal on the mobile phone now, or the network connection is unsuccessful, then the information will be put in the pending queue and will be sent and received again after a while. The two classes here implement this retry mechanism.

HttpUtils.java is the lowest implementer of sending and receiving MMS, and is responsible for receiving and sending MMS to MMSC MMS service center through HTTP protocol.

Message sender. Java— As the name implies, it is an interface encapsulated for sending information, and there is only one method sendMessage (). The UI layer only needs to call the class that implements this interface to send information.

Messagenotification.java-Responsible for the notification on the status bar, such as the newly received information, or the failure to send or receive the information. It is used by the UI layer and the underlying logic layer.

MmMessageSender.java—Inherited from messagesender, it is specially used for sending multimedia messages. Instead of sending, it does some error checking and preparation work, and then starts TransactionService to do sending related things.

Java—-inherited from Transaction, responsible for receiving MMS and update notifications. When there is a new MMS, the framework will send a short message called MMS notification instruction, which contains MMS-related information (MMSC, MMS content location (URL), etc. ), and then the application will go to MMSC to get the MMS with the content location. This NotificationTransaction is dedicated to handling MMS notifications. It will get MMS data (Pdu) from MMSC, write it into the database, and then update the notification. It should be noted that MMS will be downloaded only when the setting of MMS is "automatic retrieval", otherwise, MMS notification instructions will only be processed and MMS will not be downloaded.

Observable. Java-the observation object is defined in it, and Transaction is its subclass. Other entities are observation objects, and there is a list that holds observer references. When the transaction is completed or an exception occurs, the notifyObservers () method will be called to inform the observers of the status.

Observer.java-Observer and TransactionService implement this interface. It is an observer of all transactions, monitoring their status and processing results. Because all transactions are asynchronous, observation mode is used to inform the processing results of transactions.

Privilegedsmsreceiver. Java- an event monitor inherited from SmsReceiver, which is responsible for monitoring the new SMS event android.provider.telephony.intents.sms _ received _ action ("android.provider.telephony.sms _ received"); When this intention is received, it means that there is a new short message. It will wake up SmsReceiverServier to process short messages.

ProgressCallbackEntity.java

The pushreceiver.java-broadcastreceiver is dedicated to receiving multimedia message events android.provider.telephony.wap _ push _ received _ action ("android.provider.telephony.wap _ push _ received"). It will do some preprocessing first, and then start TransactionService, which will create NotificationTransaction to handle MMS notifications.

ReadRecTransaction.java

Retrieve Transaction. Java— Inherited from Transaction, used to actively obtain multimedia message data. When the multimedia message is set to non-automatic acquisition, the user needs to trigger the acquisition, and the TransactionService will create a RetrieveTransaction to acquire the multimedia message data (Pdu), store it in the database, and update the notification.

RetryScheduler.java

Send Transaction. Java— Inherited from Transaction, used to send MMS data.

SimFullReceiver.java

Java-the encapsulation of sending short messages, inherited from MessageSender. It will start SmsReceiverService sending.

It's a broadcast receiver. Don't be confused by its name. It is not responsible for receiving new SMS notifications. Instead, it is used to send messages, receive requests to send messages, and call SmsReceiverService to handle sending. This may be the reason for the naming rules of Android. The four components in Android like to add the names of their own components, such as ComposeMessageActivity is an activity, TransactionService is a service, and the SmsReceiver here is a BroadcastReceiver, which has nothing to do with receiving short messages. Of course, this is a completely bad name.

Smsreceiverservice.java-This is a service dedicated to sending and receiving short messages. It is started by SmsReceiver and PrivilegedSmsReceiver, and does not listen to the intent event itself.

SmsRejectedReceiver.java

Java-inherited from SmsMessageSender, it calls the framework layer interface to send information to the receiver. For the MMS application, this is the last stop to send SMS, that is, for the application, it will send SMS.

Transactionbundle.java-A data structure used by a transaction to transfer data to a transaction.

Transaction.java-the base class of various transactions, and defines two methods: getPdu () and sendPdu (). These two methods are to obtain MMS data from MMSC and send the data to MMSC. It is a layer of packaging for HttpUtils.

Transactionservice.java-is a service that receives various transaction requests and then processes the transaction. Each transaction will start a new thread asynchronous processing, so when the processing is completed, TransactionService will be notified through Observer.

Transaction settings. Java- Data structure of configuration information related to MMS, such as MMSC, proxy, port, etc. The requester can provide these data and use them (if provided); Otherwise, the default data will be loaded from the telephone database, which is related to the settings of the operator and APN.

Transactionstate.java-A data structure that identifies each transaction. It is very simple and only indicates whether the processing is successful or failed. Use it when a transaction is called back to the TransactionService.

There are some files in the root directory of com/android/mms, most of which are defined base class exceptions and some public classes.

MMS App. Java-MMS application will do some necessary initialization work when the application process starts, such as configuration, download, contact, dialogue, smiley face parser, notification and so on.

MmsConfig.java- Manage some common configurations of MMS, such as the maximum size of MMS, the maximum size of MMS pictures, the maximum number of recipients, and so on. These configuration information are stored in res/XML/MMS _ config.xml. The MmsApp will call MmsConfig.init () at initialization time, and call loadMmsSettings to parse MMS _ config.xml to obtain the required configuration information. Other modules can only access these configuration information through MmsConfig.

LogTag.java- Control log trace information. It can easily control the log output level. But in fact, there are not many places where this LogTag is used in the whole Mms code.