Aplikasi Interaktif Media Player
Requirement / Kebutuhan : - Aplikasi berjalan di Linux Ubuntu (14.x dan setelahnya) - Aplikasi berjalan di Raspberry Pi3 - Aplikasi menggunakan library / component standar, dan seandainya memerlukan tambahan, maka library/komponen tsb harus bersifat Free & Opensource - Menggunakan database SQLite yg diinstall lokal - Aplikasi didevelop menggunakan Lazarus / FPC Aplikasi ini dapat diwujudkan dalam 2 aplikasi kecil : - iMediaDownloader - iMediaPlayer iMediaDownloader berjalan di background, yang berfungsi sebagai aplikasi yg secara periodic melakukan request ke sebuah Webservis, memparsing respon Json-nya, melakukan insert/update ke database lokal (SQLite), kemudian memberitau iMediaPlayer utk memutar/merestart diri sendiri. iMediaPlayer adalah aplikasi yang berfungsi membuat region secara dinamis ukuran dan layoutnya (sesuai database), dan mengisi region tersebut dengan konten berupa : image / video, teks, dsb. Berikut ini gambaran garis besarnya : Webservice 2 1 1. iMediaDownloader 2. iMediaPlayer SQLite DB Alur iMediaDownloader : 1. Aplikasi dijalankan 2. Baca file setting.ini à url_server, mesin_id, interval, token_id 3. GetDetailUser à HttpPost(url,token) 4. Tampilkan DetailUser nya di Tab Registrasi sbg informasi tampilan user terdaftar 5. Secara periodik (interval) melakukan HttpGet ke webservis sesuai url_server 6. Hasil HttpGet di parsing JSON dan lakukan insert ke database sesuai masing-masing table 7. Beritau Aplikasi iMediaPlayer jika ada data yang baru, agar iMediaPlayer dapat melakukan loading data-data
Gambar 1 – Alur iMediaDownloader
Gambar 2 – Tampilan tab Registrasi
Gambar 3 – Tab Identitas Untuk Tab Autocheck Content berisi : Log Aktivitas tiap nn detik (interval) Untuk Tab Setting berisi : Interval setting, lokasi file database SQLite Alur Aplikasi iMediaPlayer 1. Aplikasi membaca database SQLite 2. Aplikasi membuat region-region sesuai layout yang aktif (top,left,width,height dibaca dari database) 3. Aplikasi menjalankan / playing region sesuai tipenya .. misal video, maka dia akan memutar film/video, image slideshow akan membuat slideshow dg urutan image yg sudah ditetapkan, dst Berikut contohnya : background Region1 Region2 Video Image Slideshow Region4 Region3 RSSFeed Dataset/table Region5 Running Text Pembagian region bersifat dinamis sesuai database
Dan hasilnya seperti ini :
Untuk image slideshow bisa menggunakan komponen Picshow http://www.delphiarea.com/products/delphi-components/picshow/ tapi harus di convert dulu ke Lazarus. Berikut gambaran desain databasenya :
Untuk media_type (f_media_type) macam-macamnya sbb : - Image : menampilkan 1 gambar saja tanpa animasi transisi - Slideshow : menampilkan beberapa gambar dengan animasi transisi - Text : menampilkan running text dg jenis font, warna, dan ukuran sesuai parameter - Video : menampilkan video - Dataset : Menampilkan data-data sesuai table - Web Html : menampilkan konten html sesuai URL yg didefinisikan - PDF : menampilkan konten file PDF - Flash : menampilkan file flash swf - Chart : menampilkan chart / grafis Berikut ini contoh Json hasil HttpGet : (silakan dilakukan JSon beautify biar bisa dibaca) {"status":200,"msg":"Group Layout ditemukan","data":{"kode_mesin":"2200293797_17","nama_mesin":"Macbook","last_update":"2016-09-13 07:06:00","file_path":"http:\/\/media.urlserverpublik.com\/public\/uploads","group":[{"kode_group":"26","nama_gro up":"playlist 1","durasi":"200","layout":[{"durasi":"15","layout_id":"60","name":"Sample Templates Agrokusuma","width":"1920","height":"1080","background":"BACKGROUND.jpg","schedule":" 00:00:00","region":[{"region_id":"990","width":"1920","height":"365","top":"0","left":"0","media":[{"layout_media_id": "1837","media_type":"Slideshow","media_path":"a.jpg","media_script":"Random:10","order":"0"},{"layout_media_i d":"1838","media_type":"Slideshow","media_path":"b.jpg","media_script":"Random:10","order":"1"},{"layout_medi a_id":"1839","media_type":"Slideshow","media_path":"c.jpg","media_script":"Random:10","order":"2"}]},{"region_i d":"991","width":"552","height":"494","top":"470","left":"34","media":[{"layout_media_id":"1840","media_type":"Slid eshow","media_path":"1a.jpg","media_script":"Random:10","order":"0"},{"layout_media_id":"1841","media_type":" Slideshow","media_path":"1b.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1842","media_typ e":"Slideshow","media_path":"1c.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"992","width":"552"," height":"494","top":"470","left":"682","media":[{"layout_media_id":"1843","media_type":"Slideshow","media_path":" 2a.jpg","media_script":"Random:10","order":"0"},{"layout_media_id":"1844","media_type":"Slideshow","media_pat h":"2b.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1845","media_type":"Slideshow","media_ path":"2c.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"993","width":"552","height":"494","top":"470" ,"left":"1332","media":[{"layout_media_id":"1846","media_type":"Slideshow","media_path":"3a.jpg","media_script": "Random:10","order":"0"},{"layout_media_id":"1847","media_type":"Slideshow","media_path":"3b.jpg","media_scri pt":"Random:10","order":"1"},{"layout_media_id":"1848","media_type":"Slideshow","media_path":"3c.jpg","media_ script":"Random:10","order":"2"}]},{"region_id":"994","width":"1834","height":"50","top":"1013","left":"24","media":[{ "layout_media_id":"1849","media_type":"Text","media_path":"JL Abdul Gani Atas, Ngaglik, Batu","media_script":"22:Arial, Arial, Helvetica, sansserif:#c9afaf:","order":"0"}]}]},{"durasi":"20","layout_id":"102","name":"Sample Templates Bank","width":"1920","height":"1080","background":"160530041330_banking.jpg","schedule":"Everyday","region":[ {"region_id":"1739","width":"1006","height":"458","top":"184","left":"824","media":[{"layout_media_id":"3020","medi a_type":"Slideshow","media_path":"160530041349_1.jpg","media_script":"Random:10","order":"0"},{"layout_medi a_id":"3021","media_type":"Slideshow","media_path":"160530041349_2.jpg","media_script":"Random:10","order" :"1"},{"layout_media_id":"3022","media_type":"Slideshow","media_path":"160530041349_3.jpg","media_script":"R andom:10","order":"2"},{"layout_media_id":"3023","media_type":"Slideshow","media_path":"160530041349_banki ng_03.jpg","media_script":"Random:10","order":"3"}]},{"region_id":"1740","width":"1918","height":"67","top":"996"," left":"0","media":[{"layout_media_id":"3024","media_type":"Text","media_path":"SELAMAT DATANG DI BANK SYARIAH ","media_script":"35:Verdana, Verdana, Geneva, sansserif:#ffffff:3","order":"0"}]},{"region_id":"1741","width":"653","height":"794","top":"185","left":"98","media":[{"layout_ media_id":"3025","media_type":"Dataset","media_path":"datagrid_33.html ","media_script":"body { height:inherit!important; background-color:#ffffff;}\/* Pengaturan tabel *\/table { width:100%; height:100%; fontsize: 31pt; font-family: arial, sans-serif;} table thead th { background-color:#008d28; color:#ffffff; padding:5px;}table tbody td{ color:#000000; height:auto;}\/* Pengaturan kolom 2 *\/table td:nth-child(2){ textalign:center !important} ","order":"0"}]}]},{"durasi":"30","layout_id":"103","name":"Sample Templates - Toko HP","width":"1920","height":"1080","background":"160530045021_hape.jpg","schedule":"Everyday","region":[{"reg ion_id":"1436","width":"863","height":"619","top":"313","left":"1025","media":[{"layout_media_id":"2478","media_ty pe":"Slideshow","media_path":"160530043050_1.jpg","media_script":"Random:10","order":"0"},{"layout_media_id ":"2479","media_type":"Slideshow","media_path":"160530043050_2.jpg","media_script":"Random:10","order":"1"} ,{"layout_media_id":"2480","media_type":"Slideshow","media_path":"160530043050_3.jpg","media_script":"Rand om:10","order":"2"}]},{"region_id":"1437","width":"1423","height":"65","top":"984","left":"180","media":[{"layout_med ia_id":"2481","media_type":"Text","media_path":"SELAMAT DATANG DI HALIO PHONE - SELAMAT BERBELANJA","media_script":"40:Verdana, Verdana, Geneva, sansserif:#ffffff:3","order":"0"}]},{"region_id":"1438","width":"929","height":"509","top":"372","left":"50","media":[{"layout_ media_id":"2482","media_type":"Video","media_path":"160530044220_Wireless_Charging.mp4","media_script":"" ,"order":"0"}]}]}]},{"kode_group":"27","nama_group":"playlist2","durasi":"200","layout":[{"durasi":"30","layout_id":"1 11","name":"Sample Templates Kampus","width":"1920","height":"1080","background":"160602044331_begron.jpg","schedule":"Everyday","regio n":[{"region_id":"1766","width":"932","height":"338","top":"300","left":"65","media":[{"layout_media_id":"3070","med ia_type":"Slideshow","media_path":"160602044259_2.jpg","media_script":"Random:10","order":"0"},{"layout_medi
a_id":"3071","media_type":"Slideshow","media_path":"160602044259_3.jpg","media_script":"Random:10","order" :"1"},{"layout_media_id":"3072","media_type":"Slideshow","media_path":"160602044259_1.jpg","media_script":"R andom:10","order":"2"}]},{"region_id":"1767","width":"836","height":"390","top":"665","left":"1026","media":[{"layout _media_id":"3073","media_type":"Video","media_path":"160603033755_Iklan_Universitas_Negeri_Malang__Ujia n_Akhir_Semester_.mp4","media_script":"","order":"0"}]},{"region_id":"1768","width":"932","height":"390","top":"66 5","left":"65","media":[{"layout_media_id":"3074","media_type":"WebHTML","media_path":"http:\/\/pkbi.ac.id\/","m edia_script":"","order":"0"}]},{"region_id":"1769","width":"233","height":"254","top":"48","left":"1560","media":[{"layo ut_media_id":"3075","media_type":"Flash","media_path":"1606023_biru.swf","media_script":"","order":"0"}]}]}]},{"k ode_group":"28","nama_group":"playlist sabtu","durasi":"145","layout":[{"durasi":"30","layout_id":"60","name":"Sample Templates Agrokusuma","width":"1920","height":"1080","background":"BACKGROUND.jpg","schedule":"2016-09-10 10:00:00","region":[{"region_id":"990","width":"1920","height":"365","top":"0","left":"0","media":[{"layout_media_id": "1837","media_type":"Slideshow","media_path":"a.jpg","media_script":"Random:10","order":"0"},{"layout_media_i d":"1838","media_type":"Slideshow","media_path":"b.jpg","media_script":"Random:10","order":"1"},{"layout_medi a_id":"1839","media_type":"Slideshow","media_path":"c.jpg","media_script":"Random:10","order":"2"}]},{"region_i d":"991","width":"552","height":"494","top":"470","left":"34","media":[{"layout_media_id":"1840","media_type":"Slid eshow","media_path":"1a.jpg","media_script":"Random:10","order":"0"},{"layout_media_id":"1841","media_type":" Slideshow","media_path":"1b.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1842","media_typ e":"Slideshow","media_path":"1c.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"992","width":"552"," height":"494","top":"470","left":"682","media":[{"layout_media_id":"1843","media_type":"Slideshow","media_path":" 2a.jpg","media_script":"Random:10","order":"0"},{"layout_media_id":"1844","media_type":"Slideshow","media_pat h":"2b.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1845","media_type":"Slideshow","media_ path":"2c.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"993","width":"552","height":"494","top":"470" ,"left":"1332","media":[{"layout_media_id":"1846","media_type":"Slideshow","media_path":"3a.jpg","media_script": "Random:10","order":"0"},{"layout_media_id":"1847","media_type":"Slideshow","media_path":"3b.jpg","media_scri pt":"Random:10","order":"1"},{"layout_media_id":"1848","media_type":"Slideshow","media_path":"3c.jpg","media_ script":"Random:10","order":"2"}]},{"region_id":"994","width":"1834","height":"50","top":"1013","left":"24","media":[{ "layout_media_id":"1849","media_type":"Text","media_path":"JL Abdul Gani Atas, Ngaglik, Batu","media_script":"22:Arial, Arial, Helvetica, sansserif:#c9afaf:","order":"0"}]}]},{"durasi":"35","layout_id":"62","name":"Sample Templates - Hotel Santika","width":"1920","height":"1080","background":"34a1939bfe18275dce62f4932922121a.jpg","schedule":"20 16-09-10 12:00:00","region":[{"region_id":"1107","width":"552","height":"497","top":"468","left":"34","media":[{"layout_media _id":"1993","media_type":"Slideshow","media_path":"70062649e0d8694b6f4b0470ed6a13e9.jpg","media_script": "Random:10","order":"0"},{"layout_media_id":"1994","media_type":"Slideshow","media_path":"0225acd019133f61 5e2150805952fc43.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1995","media_type":"Slides how","media_path":"5b785d4d844a55e86a2cf0fafefdb0a3.jpg","media_script":"Random:10","order":"2"}]},{"region _id":"1108","width":"552","height":"497","top":"468","left":"682","media":[{"layout_media_id":"1996","media_type":" Slideshow","media_path":"94926e895c0fcb38406426ccbed82fa5.jpg","media_script":"Random:10","order":"0"},{"l ayout_media_id":"1997","media_type":"Slideshow","media_path":"8570c59e73d21a2107162c783144f51a.jpg","m edia_script":"Random:10","order":"1"},{"layout_media_id":"1998","media_type":"Slideshow","media_path":"69767 a3ce291b3827fba2a60a006650f.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"1109","width":"1891 ","height":"53","top":"1020","left":"0","media":[{"layout_media_id":"1999","media_type":"Text","media_path":"Jl Letjen Sutoyo No 79, Purwantoro, Malang (0341-405405)","media_script":"26:Arial Black, Arial Black, Gadget, sansserif:#dbd3be:","order":"0"}]},{"region_id":"1110","width":"1920","height":"358","top":"0","left":"0","media":[{"layout_ media_id":"2000","media_type":"Slideshow","media_path":"4d37b7b0f0614c5f6d8d6493fee35137.jpg","media_sc ript":"Random:10","order":"0"},{"layout_media_id":"2001","media_type":"Slideshow","media_path":"b8dc8d8bb1b4 485e9ca271a9d22d2c41.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"2002","media_type":" Slideshow","media_path":"1f3a637d70a073b5d4eff85083bb3325.jpg","media_script":"Random:10","order":"2"}]},{ "region_id":"1111","width":"552","height":"497","top":"468","left":"1332","media":[{"layout_media_id":"2003","medi a_type":"Slideshow","media_path":"5d0d8c07f7ecece63584bf07ec610cb7.jpg","media_script":"Random:10","ord er":"0"},{"layout_media_id":"2004","media_type":"Slideshow","media_path":"6ba7f2ac52ac0f93b786d851bb0b4da 6.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"2005","media_type":"Slideshow","media_path ":"0c1e46878f443626055ebc05ade2209a.jpg","media_script":"Random:10","order":"2"}]}]},{"durasi":"40","layout_i d":"64","name":"Sample Templates - Best Western Hotel","width":"1920","height":"1080","background":"160429035815_template1.jpg","schedule":"2016-09-10 13:15:00","region":[{"region_id":"998","width":"1934","height":"373","top":"0","left":"0","media":[{"layout_media_id": "1853","media_type":"Slideshow","media_path":"160429035755_1.jpg","media_script":"Random:10","order":"0"},{ "layout_media_id":"1854","media_type":"Slideshow","media_path":"160429035755_2.jpg","media_script":"Rando m:10","order":"1"},{"layout_media_id":"1855","media_type":"Slideshow","media_path":"160429035755_3.jpg","me dia_script":"Random:10","order":"2"}]},{"region_id":"999","width":"566","height":"510","top":"469","left":"34","media ":[{"layout_media_id":"1856","media_type":"Slideshow","media_path":"160429035701_1.jpg","media_script":"Ran dom:10","order":"0"},{"layout_media_id":"1857","media_type":"Slideshow","media_path":"160429035701_2.jpg"," media_script":"Random:10","order":"1"},{"layout_media_id":"1858","media_type":"Slideshow","media_path":"1604 29035701_3.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"1000","width":"566","height":"510","top": "469","left":"682","media":[{"layout_media_id":"1859","media_type":"Slideshow","media_path":"160429035719_1.j pg","media_script":"Random:10","order":"0"},{"layout_media_id":"1860","media_type":"Slideshow","media_path":" 160429035719_2.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"1861","media_type":"Slidesh ow","media_path":"160429035719_3.jpg","media_script":"Random:10","order":"2"}]},{"region_id":"1001","width":"5 66","height":"510","top":"469","left":"1331","media":[{"layout_media_id":"1862","media_type":"Slideshow","media_ path":"160429035737_1.jpg","media_script":"Random:10","order":"0"},{"layout_media_id":"1863","media_type":"S
lideshow","media_path":"160429035737_2.jpg","media_script":"Random:10","order":"1"},{"layout_media_id":"186 4","media_type":"Slideshow","media_path":"160429035737_3.jpg","media_script":"Random:10","order":"2"}]},{"re gion_id":"1002","width":"1910","height":"91","top":"996","left":"0","media":[{"layout_media_id":"1865","media_type" :"Text","media_path":"JL Dr. Cipto No 11 Malang, (0341-368888)","media_script":"25:Arial, Arial, Helvetica, sansserif:#fdfdfd:","order":"0"}]}]},{"durasi":"40","layout_id":"103","name":"Sample Templates - Toko HP","width":"1920","height":"1080","background":"160530045021_hape.jpg","schedule":"2016-09-10 14:15:00","region":[{"region_id":"1436","width":"863","height":"619","top":"313","left":"1025","media":[{"layout_med ia_id":"2478","media_type":"Slideshow","media_path":"160530043050_1.jpg","media_script":"Random:10","order ":"0"},{"layout_media_id":"2479","media_type":"Slideshow","media_path":"160530043050_2.jpg","media_script":" Random:10","order":"1"},{"layout_media_id":"2480","media_type":"Slideshow","media_path":"160530043050_3.jp g","media_script":"Random:10","order":"2"}]},{"region_id":"1437","width":"1423","height":"65","top":"984","left":"18 0","media":[{"layout_media_id":"2481","media_type":"Text","media_path":"SELAMAT DATANG DI HALIO PHONE - SELAMAT BERBELANJA","media_script":"40:Verdana, Verdana, Geneva, sansserif:#ffffff:3","order":"0"}]},{"region_id":"1438","width":"929","height":"509","top":"372","left":"50","media":[{"layout_ media_id":"2482","media_type":"Video","media_path":"160530044220_Wireless_Charging.mp4","media_script":"" ,"order":"0"}]}]}]}]}}
(keterangan : media_path == f_media_desc) URL Server aslinya akan diberikan setelah deal