Android-based video player development

Summary:Based on open source mobile terminal operating system Android developed a video player. The video player is composed of a file browser, video player, audio player, playlist management and lyrics synchronization display. The interface is generated by XML and script configuration. The software implements the management of the media library based on the file browser, which greatly facilitates the user's operation. Each time the software starts, it scans the storage device and saves the scanned lyrics file to the lyric database. For the song being played, the lyric file is retrieved according to the song name, and the lyrics are displayed simultaneously. The player was functionally tested and verified on the Android emulator and the OMAP 3530 development board.
Keywords: Android; video player; lyrics display; OMAP3530

0 Introduction The original meaning of the word Android refers to “robot” and is the name of the open source mobile terminal operating system based on Linux platform announced by Google on November 5, 2007. The platform consists of operating system, middleware, user interface and application software. The composition is the first truly open and complete mobile software for mobile devices.
With the continuous development of technology, mobile phones are no longer just mobile communication tools for people's daily life, but a multimedia platform that can provide powerful multimedia functions. More and more people like to use mobile phones to listen to music and watch movies. The music player built into the Android system manages songs based on the media library, and does not support simultaneous display of lyrics. For some users who are used to the file browser-based player, it is inconvenient to operate. For the Android mobile operating system, you can take advantage of its rich programmable scalability to develop new player applications.

1 Android platform Android software development mainly involves related technologies including Android SDK (development plug-in, debugging toolkit, etc.), Android system architecture and Android application components.
1.1 Android SDK
The Android SDK (Software Development Kit) provides API interfaces and tools for Android application development using the Java language on the Android platform. Among them, the most important tools are the Android emulator and Eclipse's Android developer plug-in, and the SDK also contains a variety of tools for debugging, packaging and installation on the emulator.
The Eclipse IDE's Android Development Tools Plugin for the Eclipse IDE (ADT) greatly extends the Eclipse integrated environment capabilities, making it easy and fast to generate and debug Android applications. With Eclipse, the ADT plugin speeds up the development of Android apps.
The Android emulator is a virtual mobile device running on a computer that can be used to simulate, design, debug, and test an application using a simulator to simulate an actual Android runtime environment.
The Dalvik Debug Monitor Service (DDMS) integrates Dalvik (a virtual machine (VM) customized for the Android platform) that manages processes and assists debugging on the emulator or device. DDMS provides process management, generates trace data, observes heap and thread information, intercepts simulator screens, and simulates incoming calls or text messages.
1.2 Android System Architecture Android is a software set specifically for mobile devices, which includes an operating system, middleware and some important applications. From top to bottom, Android's system architecture is the application, application framework and components, Android runtime library and other libraries, and optimized Linux kernel.
1.3 Android application components Mobile phone operating environment is more complicated, a program often runs a lot of unexpected situations, such as calls or text messages and insufficient power. These issues have solutions in Android. In Android apps, the following components are especially important:
(1) Activity
As the name suggests, Activity is an activity. The application must contain at least one Activity. Activity provides a virtual user interface, each Activity has a default window that can be used to display the user interface. In general, it is a full-screen window. For example, each user interface of the video playback software is an Activity.
(2) Service
The main difference between Service and Activity is that Service is active in the background, it has no user interface. A typical application scenario is that after the user selects a playlist to start playing, he or she leaves the user interface (Activity). If you still want the song to not pause, you can use the Service to call the player instead of calling the player in the Activity. .
(3) Intent
In Android, every behavior can be abstracted into an Intent. You can simply understand an Intent as a message that contains data. Intents can be used to initiate an Act-ivity or Service that can be used for inter-process communication. In fact, the launch of the application is also implemented through the Intent.
(4) Content providers
The Android platform has a built-in SQLite data storage mechanism and a set of related methods for managing SQLite Database. In the application, you can access the database through Content prov-iders. Each Content provider defines a set of methods for accessing its corresponding database. Applications can also define corresponding Con-tent providers to share data with other applications when creating a new database. In general, the application does not directly call the function defined by the Content provider, but indirectly through the ContentResolver. The advantage of this design is that a ContentResolver can access any Content provider and unify the interface.

2 Hardware platform The hardware platform of the system uses DevKit8000, a development board based on OMAP3530. TI's OMAP3530 application processor integrates a 600 MHz ARM Cortex-A8 CPU core with a 430 MHz C64x+ DSP core and provides USB 2. A wide range of peripheral interfaces such as OOTG, SD/MMC and LCD for a variety of wireless handheld applications. The DevKit8000 development board is externally connected to a 4.3-inch LCD screen, resistive touch screen and audio input/output interface, which can be used to develop Android-based video players.
By patching the package and developing peripheral drivers such as LCD drivers, touch screen drivers, and button drivers, the Linux kernel version 6.2.29 and the Android system version 1.6 were ported on the DevKit8000 development board.

3 Android video player software development
3.1 Software Features Android video playback software mainly includes the following functions:
(1) Play video Support fast forward, rewind, pause, resume and progress drag.
(2) Play audio Support fast forward, fast reverse, previous, next, pause, continue, stop and progress drag; support random play, loop play two modes; support lyrics synchronous display.
3.2 Relationship between modules Audio and video playback software project files mainly include src folder (Java source code), res folder (resource file) and AndroidManifest. Xml (program list). The software is mainly composed of 8 Activities, and each Activity corresponds to one module. Different Activities communicate and call each other through an Intent.
The relationship between the various modules is shown in Figure 1.

This article refers to the address: http://

1.JPG


The order in which the video playback is called is <Startup Screen>, <Main Menu>, <File Browser>, <Video Player>;
The order in which audio playback is called is <Startup Screen>, <Main Menu>, <Playlist Management>, <Playlist Content Management>, <Now Playing>. On the <Now Playing> interface. The lyrics synchronization display function can be performed by clicking the corresponding button.
In the AndroidManifest.xml (list file) of the project directory, add a description of each Activity. The following is a description of the corresponding splash screen:
2.JPG


3.3 Software Module According to the function of audio and video playback software, the software can be divided into the following modules:
(1) <Startup Screen> module. The main function is to display the software startup screen. The timer thread is used to control the startup screen display time, and when the user presses the button, the startup screen display is immediately interrupted and jumps to the <Main Menu> module.
(2) <Main Menu> module. The main function is to provide a user interface for the playback software. The user interface is generated by the XML configuration of Android.
The main menu provides three options, namely video playback, audio playback and exit program; when the video is playing, the <File Browser> module is called to let the user select the video file to be played. When playing audio, call the <Playlist Management> module to let the user select the list that needs to be played.
(3) <File Browser> module. Used to browse files on the memory card. If the path is a folder, all files under the file are listed; if the path is a file, first check whether the file extension is a supported video format, and if so, call the built-in player to play.
(4) <Audio Playback> module. It includes the following modules:
1 <Playlist Management> module. The main function is to add, delete, and rename lists. Access the system's playlist database through Content providers and update the database with the modified results. Because it uses the system's database, it is shared with the built-in music player list. It also provides an interface to add list content. Go to the <Playlist Content Management> module through the playlist management module.
2 <Playlist Content Management> module. The main function is to add, delete, and multi-select songs in the playlist. In Android, each list will have a corresponding 歹 表 table content library, which saves the song ID contained in the list. It can be accessed and modified through ContentProviders. Among them, the add function is implemented based on the file browser, and the music file can be marked and added in the file browser.
3<Now Playing> module. The main function is to display the related information of the song (album cover, album name, singer, length, etc.) and display the time progress of the song being played, and control the playback of the song.
The interface of the <Now Playing> module is generated using the XML configuration.
3.JPG
The actual effect diagram is shown in Figure 2.

7.jpg


The Android's music library has parsed the song's Idv2 or Idv3 tags and saved the song's related information (including singer, genre, duration, etc.) in the media database. You only need to access the database through Content providers, you can get the relevant information and send it to display. The program source code for getting song related information is as follows:

5.JPG
By creating a MediaPlayer player class object, the API provided by Android can be used to decode and play the file.
4 <Lyric Synchronization Display> module. When the program starts, the memory card is scanned, and the scanned lyric file name and path are saved to the lyric database. For the song being played, the lyric file is automatically retrieved according to the song name, and the lyrics are displayed simultaneously. The first time you start the program, you need to create a new lyrics database to save the lyrics file information. Android provides the class SQLiteOpenHelper for creating a new database.
6.JPG
DATABASE_CREATE is a string macro of a SQL primitive whose content is "create table lyric_meta(_id integerprimary key autoincrement,_disp-alay_name text not null,_date text not null);" means a table for creating a lyric file containing _id, _display_name, _data three columns. Where _id is a self-incrementing and unique integer, _display_name is the lyrics file name, and _data is the lyrics file path. The lyrics display effect is shown in Figure 3.

8.jpg



4 System Test First, debug the functions of the AV player on the simulator of Android SDK1.6. After debugging, copy the compiled installation file (.APK) to the SD card, use the Android file manager to install the playback software to the OMAP3530 development board system, and then test the video files, MP3 music files and corresponding The lyrics file (.lrc) is copied to the SD card. The audio and video player on the OMAP3530 development board can select the video file through the file browser and play it normally. When playing the audio file, the matching lyrics can be displayed normally, and fast forward and rewind are supported. Pause and other control functions.

5 Conclusion This article takes the development of audio and video player on Android as an example, and gives the development method of the application on Android in detail. The developed audio and video player was tested on the Android phone simulator and the OMAP35 30 development board.

Smart mini garden spotlight, 9 pieces for 1 set, two power versions are available, electric power supply and solar power supply. The mini garden spot light has both lighting and RGB colorful lighting mode, the angel of lamp head can be changed. Lamp body is  waterproof IP66, rainproof and dustproof. It can be easily inserted on lawns, gardens and beaches.



The light color, brightness, cycle mode and timing can be controlled by App.The App are developed on the most advanced Bluetooth Mesh technology. [LinkupHome" App can be downloaded in the App store or Google Player, then you can control our product without any complicated steps. The App is stable, easy control and multifunctional.


3   5


The advantages of Bluetooth Mesh are fast connect, low power consumption, no password required and Ad-Hoc Network. No need WIFI and hubs, as long as you have a Bluetooth-enabled smart phone, you can experience the smart light. When you install several smart gardenspots, the self-organizing network function can make the signals free connect, break the limitation of distance. 

Blutooth Mesh


Product Parameters


Lamp Power: 3W
Lamp Color: RGBW
Protocol: Bluetooth Mesh
Solar Board: Voltage
Wireless Transmission: 20m
WaterProof: IP66(Lamp) IP44(ECG)
Dimension: 50x35x155mm
Accessories:  9pcs lamps and 1pc 10 meters cable


Smart Gardenspot Outdoor Light

Solar Powered Garden Lights,Smart 3W Garden Spot Light,Outdoor Solar String Lights,Smart Gardenspot Outdoor Light

Ningbo Homey Photoelectric Technology. Co., Ltd , http://www.linkuphome.com

Posted on