4. Implementation
We implemented an Android application as the client of our system. Figure 10 shows the major activities of the application. HomeActivy, NVodActivity, VodActivity, InformationActivity and SettingActivity are invoked when the button Home, NVOD, VOD, LBS, and Setting are clicked. All these activities inherit UiController that inherits Activity. initMenuListener() designates OnClickListener() as the click-event handler for the menu buttons. OnClickListener() uses view.getId() in order to identify the clicked button. Then it invokes onClickMenuButton with the activity associated with the clicked button as a parameter so that the activity starts running. Similarly, initBannerListener() handles click events occurring on the banner. onClickBannerInfo() has a local array variable in which pairs of (bannerID, URL) are stored. Referring to this array, onClickBannerInfo() invokes intentBanner() with the URL associated with the clicked banner.
initWebView() allows JavaScript to run, specifies that EUC-KR is the text encoding type, and specifies the size of the WebView is the size of the web page. UiController also inherits MyWebView that inherits WebViewClient. We redefined shouldOverrideUrlLoading() so that the host application takes over the control when a url prefixed with RTSP is about to be loaded in the WebView. We also redefined onPageStarted() in order to display a Progress Bar while the web page is loaded. We redefined onPageFinished() so that the Progress Bar is removed as soon as loading is completed. onReceivedError() is also redefined so that an error message pops up when loading the web page fails.
Figure 10. The Main Activities for the Application
Our MainActivity makes use of DataManager to retrieve channel information from Channel DB (refer to Figure 4) and ThumbnailManager to obtain thumbnails that are to be displayed on Channels (refer to Figure 6) as shown in Figure 11. DataManager.DownloadDataThread() downloads an XML file from the web server using HTTP Client. We create a new thread in which the HTTP Client is created so that downloading the file can be processed independently from the main process. In the XML file, channel and schedule information is written. downloadChannelData() parses channel ID, channel name, stream URI and schedule URI from the XML file whereas downloadChannelSchedule() parses video titles, duration times and orders of broadcast.
ThumbnailManager uses FFmpegMediaMetadataRetriever.getFrameAtTime() in order to capture the video frame that is streamed at the moment. DownloadThumbnailThread() repeats capturing frame every 60 seconds until MainActivity is destroyed.
A flowchart describing the process of MainActivity is shown in Figure 12. This activity creates two threads at the beginning. One process accesses the Channel DB (refer to Figure 4) in order to retrieve channel and schedule information. After 5 minute sleep, the other thread forks into two processes. One of the two processes repeats extracting thumbnails from the streams of the channels every 60 seconds. NVodActivity displays these thumbnails on its Channel list. Therefore, the thumbnails shown on Channel list always represent the current frames of the programs that are being broadcasted on Internet at the moment. The other process checks if WiFi is available. If WiFi is not available, then the process pops up a message saying "WiFi is not available. Do you want to use data network?"
Figure 11. Classes to Retrieve Data for our Application
Figure 12. A Flowchart Describing the Process of MainActivity
A flowchart describing the process of HomeActivity is shown in Figure 13. After displaying the layout, it runs the banner animation with the start() method in AnimationDrawable class. Then, it enrolls the event listeners for the buttons, thumbnails and banners.
Figure 13. A Fowchart for MainActivity
Figure 14. Screenshots of MainActvity and HomeActivity
4. การดำเนินการ
เราดำเนินการประยุกต์ใช้ Android เป็นลูกค้าของระบบของเรา รูปที่ 10 แสดงให้เห็นว่ากิจกรรมที่สำคัญของโปรแกรม HomeActivy, NVodActivity, VodActivity, InformationActivity และ SettingActivity จะเรียกเมื่อหน้าแรกปุ่ม NVOD, VOD, LBS และการตั้งค่าจะคลิก กิจกรรมทั้งหมดเหล่านี้ได้รับมรดกที่สืบทอด UiController กิจกรรม initMenuListener () กำหนด OnClickListener () เป็นตัวจัดการคลิกเหตุการณ์สำหรับปุ่มเมนู OnClickListener () ใช้ view.getId () เพื่อระบุปุ่มคลิก จากนั้นมันจะเรียก onClickMenuButton ด้วยกิจกรรมที่เกี่ยวข้องกับปุ่มคลิกเป็นพารามิเตอร์เพื่อให้กิจกรรมเริ่มทำงาน ในทำนองเดียวกัน initBannerListener () จัดการกับเหตุการณ์ที่เกิดขึ้นคลิกที่แบนเนอร์ onClickBannerInfo () มีตัวแปรอาร์เรย์ท้องถิ่นในการที่คู่ของ (bannerID, URL) จะถูกเก็บไว้ หมายถึงอาร์เรย์นี้ onClickBannerInfo () เรียก intentBanner () มี URL ที่เกี่ยวข้องกับแบนเนอร์คลิก
initWebView () ช่วยให้ JavaScript เพื่อให้ทำงาน, ระบุว่า EUC-KR คือข้อความชนิดของการเข้ารหัสและระบุขนาดของ WebView คือขนาด ของหน้าเว็บ UiController ยังสืบทอด MyWebView ที่สืบทอด WebViewClient เรานิยามใหม่ shouldOverrideUrlLoading () เพื่อให้โปรแกรมประยุกต์โฮสต์ใช้เวลามากกว่าการควบคุมเมื่อ url นำหน้าด้วย RTSP กำลังจะถูกโหลดใน WebView นอกจากนี้เรายังสูงสุด onPageStarted () เพื่อแสดงความคืบหน้าบาร์ในขณะที่หน้าเว็บจะโหลด เรานิยามใหม่ onPageFinished () เพื่อให้ความคืบหน้าบาร์จะถูกลบออกทันทีที่โหลดเสร็จสมบูรณ์ onReceivedError () นอกจากนี้ยังมีเป้าหมายสูงสุดเพื่อให้เกิดข้อผิดพลาดปรากฏขึ้นเมื่อโหลดหน้าเว็บที่ล้มเหลวในรูปที่ 10 กิจกรรมหลักสำหรับแอพลิเคชันของเรา MainActivity ทำให้การใช้ DataManager เพื่อดึงข้อมูลจากช่องทางช่องทาง DB (โปรดดูรูปที่ 4) และ ThumbnailManager เพื่อให้ได้ภาพที่จะปรากฏบนช่อง (โปรดดูรูปที่ 6) ตามที่แสดงในรูปที่ 11 DataManager.DownloadDataThread () ดาวน์โหลดไฟล์ XML จากเว็บเซิร์ฟเวอร์โดยใช้ HTTP ลูกค้า เราสร้างหัวข้อใหม่ในการที่ลูกค้า HTTP จะถูกสร้างขึ้นเพื่อให้ดาวน์โหลดไฟล์สามารถดำเนินการเป็นอิสระจากกระบวนการหลัก ในไฟล์ XML, ช่องทางและตารางข้อมูลเป็นลายลักษณ์อักษร downloadChannelData () แยกช่อง ID, ชื่อช่องทางสตรีม URI และกำหนดเวลา URI จากไฟล์ XML ในขณะที่ downloadChannelSchedule () แยกวิเคราะห์ชื่อวิดีโอครั้งระยะเวลาและคำสั่งของการออกอากาศThumbnailManager ใช้ FFmpegMediaMetadataRetriever.getFrameAtTime () เพื่อจับภาพเฟรมวิดีโอที่เป็น สตรีมในขณะนี้ DownloadThumbnailThread () ซ้ำจับกรอบทุก 60 วินาทีจนกระทั่ง MainActivity ถูกทำลายผังอธิบายกระบวนการของการ MainActivity จะแสดงในรูปที่ 12 กิจกรรมนี้จะสร้างสองกระทู้ที่จุดเริ่มต้น กระบวนการหนึ่งที่เข้าถึงช่อง DB (โปรดดูรูปที่ 4) เพื่อที่จะดึงช่องและตารางข้อมูล การนอนหลับหลังจาก 5 นาทีส้อมหัวข้ออื่น ๆ ออกเป็นสองขั้นตอน หนึ่งในสองกระบวนการสกัดซ้ำภาพจากกระแสของช่องทางทุก 60 วินาที NVodActivity แสดงภาพขนาดเล็กเหล่านี้ในรายการของช่อง ดังนั้นภาพที่แสดงในรายการช่องมักจะเป็นตัวแทนของเฟรมปัจจุบันของโปรแกรมที่มีการออกอากาศในอินเทอร์เน็ตในขณะนี้ กระบวนการอื่น ๆ ตรวจสอบว่าอินเตอร์เน็ตไร้สายสามารถใช้ได้ หากอินเตอร์เน็ตไร้สายไม่สามารถใช้ได้แล้วกระบวนการปรากฏขึ้นข้อความว่า "อินเตอร์เน็ตไร้สายจะไม่สามารถใช้ได้. คุณต้องการที่จะใช้เครือข่ายข้อมูล?" รูปที่ 11 การเรียนการดึงข้อมูลสำหรับแอพลิเคชันของเรารูปที่ 12 ผังการอธิบายขั้นตอนการ MainActivity ผังการอธิบายขั้นตอนของการ HomeActivity จะแสดงในรูปที่ 13 หลังจากที่การแสดงรูปแบบจะทำงานเคลื่อนไหวแบนเนอร์กับการเริ่มต้น () วิธีการในชั้นเรียน AnimationDrawable จากนั้นมันโรคฟังเหตุการณ์สำหรับปุ่มภาพขนาดเล็กและป้ายรูปที่ 13. Fowchart สำหรับ MainActivity รูป 14. ภาพหน้าจอของ MainActvity และ HomeActivity
การแปล กรุณารอสักครู่..

4 . การใช้โปรแกรม Android
เราเป็นลูกค้าของระบบของเรา รูปที่ 10 แสดงให้เห็นถึงกิจกรรมหลักของโปรแกรม homeactivy nvodactivity vodactivity , , , และ informationactivity settingactivity จะเรียกเมื่อปุ่มบ้าน nvod VOD , ปอนด์ , และการตั้งค่าคลิก กิจกรรมทั้งหมดนี้เป็นมรดกที่สืบทอด uicontroller กิจกรรมinitmenulistener() กำหนด onclicklistener() เป็นผู้ดูแลคลิกเหตุการณ์สำหรับปุ่มเมนู onclicklistener() ใช้มุมมอง getid() เพื่อระบุการคลิกปุ่ม แล้วจะเรียก onclickmenubutton กับกิจกรรมที่เกี่ยวข้องกับการคลิกปุ่มเป็นพารามิเตอร์เพื่อที่กิจกรรมจะเริ่มเดิน ในทํานองเดียวกัน initbannerlistener() ที่จับเหตุการณ์ที่เกิดขึ้นบนคลิกที่แบนเนอร์onclickbannerinfo() มีตัวแปรอาร์เรย์ถิ่นที่คู่ ( bannerid URL ) จะถูกเก็บไว้ หมายถึงอาร์เรย์ นี้ จะเรียก onclickbannerinfo() intentbanner() กับ URL ที่เกี่ยวข้องกับการคลิกแบนเนอร์
initwebview() ช่วยให้จาวาสคริปต์เพื่อวิ่ง ระบุว่า euc-kr เป็นข้อความประเภทการเข้ารหัส และระบุขนาดของ webview คือขนาดของหน้าเว็บ .uicontroller ยังสืบทอด mywebview ที่สืบทอด webviewclient . เราขาย shouldoverrideurlloading() ดังนั้นโฮสต์โปรแกรมจะใช้เวลามากกว่าการควบคุมเมื่อ URL แล้วนำหน้าด้วย RTSP จะถูกโหลดใน webview . นอกจากนี้เรายังขาย onpagestarted() เพื่อแสดงแถบความคืบหน้าในขณะที่หน้าเว็บถูกโหลดเราขาย onpagefinished() เพื่อให้แถบความคืบหน้าจะถูกลบออกทันทีที่โหลดเสร็จ onreceivederror() ยังนิยามใหม่เพื่อให้ข้อความแสดงข้อผิดพลาดปรากฏขึ้นเมื่อโหลดหน้าเว็บล้มเหลว .
รูปที่ 10 กิจกรรมหลักสำหรับโปรแกรม
mainactivity ของเราทำให้การใช้ datamanager เพื่อดึงข้อมูลจาก DB ช่องช่อง ( ดูรูปที่ 4 ) และ thumbnailmanager เพื่อให้ได้ภาพที่จะแสดงในช่อง ( ดูรูปที่ 6 ) ดังแสดงในรูปที่ 11 datamanager . downloaddatathread() ดาวน์โหลดไฟล์ XML จากเซิร์ฟเวอร์เว็บโดยใช้ HTTP ลูกค้าเราสร้างหัวข้อใหม่ที่ถูกสร้างขึ้นเพื่อให้ลูกค้า HTTP ดาวน์โหลดไฟล์ที่สามารถประมวลผลได้อย่างอิสระจากกระบวนการหลัก ในไฟล์ XML , ช่องทางและตารางข้อมูลเป็นลายลักษณ์อักษร downloadchanneldata() วิเคราะห์ช่อง ID , ชื่อช่องธาร URI และตารางเวลา URI จากไฟล์ XML และ downloadchannelschedule() วิเคราะห์ชื่อวิดีโอเวลาเวลาและคำสั่งของการออกอากาศ .
thumbnailmanager ใช้ ffmpegmediametadataretriever . getframeattime() เพื่อจับภาพวิดีโอเฟรมที่จะสตรีมในขณะนี้ downloadthumbnailthread() ซ้ำรอยจับเฟรมทุก 60 วินาทีจนกว่า mainactivity ถูกทำลาย
ผังอธิบายกระบวนการของ mainactivity จะแสดงในรูปที่ 12กิจกรรมนี้สร้างสองหัวข้อที่เริ่มต้น หนึ่งในกระบวนการเข้าถึงช่อง DB ( ดูรูปที่ 4 ) เพื่อที่จะดึงช่องทางและข้อมูลตาราง หลังจากนอน 5 นาที หัวข้ออื่น ๆส้อมในกระบวนการที่สอง หนึ่งในสองกระบวนการซ้ำแยกภาพจากกระแสช่องทุก 60 วินาที nvodactivity แสดงภาพเหล่านี้ในช่องรายการของดังนั้น ภาพที่แสดงในช่องรายการมักจะเป็นตัวแทนของเฟรมปัจจุบันของโปรแกรมที่กำลังออกอากาศบนอินเทอร์เน็ตในขณะนี้ อื่น ๆกระบวนการ ตรวจสอบ ถ้า เป็นใช้ได้ ถ้าไร้สายไม่สามารถใช้ได้ แล้วกระบวนการจะปรากฏขึ้นข้อความว่า " WiFi จะใช้ไม่ได้ คุณต้องการที่จะใช้เครือข่ายข้อมูล ?
รูปที่ 11 ชั้นเรียนเพื่อดึงข้อมูลสำหรับโปรแกรม
รูปที่ 12 ผังที่อธิบายกระบวนการของ mainactivity
ผังอธิบายกระบวนการของ homeactivity จะแสดงในรูปที่ 13 หลังจากแสดงเค้าโครง มันวิ่งแบนเนอร์ภาพเคลื่อนไหวด้วยวิธี animationdrawable start() ในชั้นเรียน แล้วการศึกษา เหตุการณ์ผู้ฟังสำหรับปุ่มขนาดเล็กและแบนเนอร์
รูปที่ 13 เป็น fowchart สำหรับ mainactivity
รูปที่ 14ภาพหน้าจอของ mainactvity homeactivity
และ
การแปล กรุณารอสักครู่..
