Skip to main content

Android Multimedia

Android Multimedia 

  • Introduction to android multimedia in Hindi 
  • Playing audio with android multimedia in Hindi 
  • Playing video with android multimedia in Hindi 
  • Taking pictures with android in Hindi 

Introduction to Android Multimedia 

आज का एक cell phone सिर्फ बात करने के लिए ही नहीं बल्कि multimedia के लिए भी use किया जाता है। कोई भी ऐसे cell phones  use नहीं करना चाहता जिनमें multimedia support नहीं है। User phone के द्वारा music भी सुनना चाहता है, video भी देखना चाहता है और web surfing भी करना चाहता है। इन सबके लिए आपके cell phone में multimedia support होना बहुत जरुरी है। Android में आपको multimedia system खुद implement करने की आवश्यकता नहीं है। Android में google के द्वारा default multimedia system provide किया गया है जिसे आप use  कर सकते है।

What is Stage Fright?

  • Stage fright एक multimedia system है जो google के द्वारा android devices के लिए provide किया गया है। इससे पहले OpenCORE system use  किया जाता था। Stage fright को android 2.3 के साथ introduce किया गया था। Stage fright ने OpenCORE system को completely replace कर दिया है। लेकिन आप अब भी ऐसी applications बना सकते है जो दोनों systems के साथ work कर सकती है। Stage fright system की कुछ characteristics नीचे दी जा रही है।
  • Stage fright के साथ आप हर तरह के  media को playback, download और live stream में देखा जा सकता है। 
  • Stage fright बहुत से RTSP और HTTP आदि protocols को support करता है। 
  • इस system के द्वारा आप हर तरह के media को record कर सकते है। 
  • Stage fright video call भी support करता है। 
  • ये system दूसरे hardware और input output devices को support करता है। 


Playing Audio in Android 

सभी लोग music सुनना पसंद करते है। सबसे पहला जो multimedia support लोग अपने mobile में चाहते है वो ये है की उनका cell phone music play कर सके। इसके लिए android आपको built in media player provide करता है। इसको यूज़ करना बहुत ही आसान है। Android के media player को यूज़ करते हुए कोई music play करने के लिए आप 3 simple steps follow कर सकते है। 
  • सबसे पहले आप जो MP3 file play करना चाहते है उसे res/raw file में store कीजिये। 
  • इसके बाद आप MediaPlayer class का object create करेंगे और  MP3 file का reference pass करेंगे। ऐसा करने के लिए आप MediaPlayer.create() method कॉल करेंगे और उसमे current activity का context और MP3 file का URL pass करेंगे।      
  • इसके बाद आप इस object पर start() method call करेंगे।    
     

    MediaPlayer mp = new MediaPlayer();
    MediaPlayer mp1;
    mp1= mp.create(Context context, mp3 file id);
    mp1.start();




    Playing Video in Android 

    Android में आप video भी play कर सकते है। Android में video play करना audio के comparison में थोड़ा कठिन है। Video को play होने के लिए आपको view surface provide करनी पड़ती है। Android में VideoView widget होता है जो की इस task को handle करता है। इसे किसी भी layout manager के साथ इस्तेमाल किया जा सकता है। आप इसकी size और color भी change कर सकते है। VideoView को AndroidManifest.xml में define किया जाता है। इसके लिए आप <VideoView> element use करते है। इस element के 3 main attributes होते है जिन्हे आप use कर सकते है।
    • android:id - ये video की resource id होती है। 
    • android:layout_width - इस से आप view की width set करते है। 
    • android:layout_height - इस से view की height set की जाती है। 
    VideoView को आप कैसे define करेंगे इसका उदाहरण नीचे दिया जा रहा है। 


    <VideoView android:id="resource-id-of-video"
    android:layout_width="200px"
    android:layout_height="200" />


    VideoView define करने के बाद सबसे पहले आप activity class में एक window create करते है। इसके बाद VideoView का object create किया जाता है और उसे id से identify किया जाता है। इसके बाद आप एक URL string variable create  करते है जिसमे video का URL pass किया जाता है। इसके बाद आप इस URI को setVideoUri() method के द्वारा set करते है। इसके बाद आप VideoView object पर requestFocus() method call करते है। इसके बाद VideoView object पर start() method call() किया जाता है। इसका उदाहरण नीचे दिया जा रहा है।


    getWindow().setFormat(PixelFormat, UNKNOWN);

    VideoView vv = (VideoView) findViewById(R.id.videoview);

    String videopath = "path of video";

    Uri myUri = Uri.parse(videopath);

    vv.setVideoUri(myUri);
    vv.requestFocus();
    vv.start();

     

    Taking Pictures with Android 

    Android से picture लेने के लिए सबसे पहले आप AndroidManifest.xml file में camera permission लेते है।


    <uses-permission android:name="android.permission.Camera">

       
    Picture लेने के लिए आपको एक intent create करना होगा। ऐसा आप इस तरह कर सकते है।


    Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);


    File को save करने के लिए आप पहले एक variable create करेंगे।


    filepath = getOutputMediaFileUri(MEDIA_TYPE_IMAGE)


    इसके बाद आप cameraIntent पर putExtra() method call करेंगे और उसमे filePath pass करेंगे।


    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, filepath);

    Comments

    Popular posts from this blog

    Android Services

    Android Services Introduction to  android services in Hindi  Declaring  services in Hindi Creating a  android service in Hindi Introduction to Android Services इससे पहले की आप जाने की service क्या होती है आइये जानते है की service क्या नहीं होती है - एक service separate प्रोसेस नहीं होती है। ये आपकी एप्लीकेशन का ही पार्ट होती है।  एक service thread नहीं होती है।  आइये अब देखते है service क्या होती है - Service एक facility होती है जिससे आप android system को बता सकते है की आप कोई काम background में करते रहना चाहते है।  Service एक facility होती है जिससे एक एप्लीकेशन अपनी कुछ functionality दूसरी applications को expose कर सकती है।    हर service क्लास का <service> declaration AndroidManifest.xml file में होना चाहिए। Services को आप context.startService() और context.bindService() मेथड्स से स्टार्ट कर सकते है।            जब service component क्रिएट होता है तो android syst...

    Android Fragments

    Android Fragments Introduction to android fragments in Hindi Android fragments life cycle in Hindi Types of android fragments in Hindi Creating android fragment in Hindi Introduction to Android Fragments एक fragment किसी activity के अंदर एक separate UI (user interface) होता है। Fragments की खुद की life cycle और input events होते है। आप एक fragment को कई activities में use कर सकते है। जब आपकी activity running state में हो तब भी आप fragments को add और remove कर सकते है। Fragments को आप sub activity भी कह सकते है।   Android fragments को android के Honeycomb version में introduce किया गया था।  Android fragments से पहले आप user को एक बार में एक activity ही show कर सकते थे इसलिए आप स्क्रीन को अलग अलग parts में divide नहीं कर सकते थे। Fragments के आने से application design और भी ज्यादा flexible हो गयी क्योंकि आप यूजर को एक साथ एक से ज्यादा interface शो कर सकते है और उन्हें separately manage भी कर सकते है। अब आपके पास activity तो एक ही रहेगी लेकिन आप इसमें ब...

    Android Development Tools

    Android Development Tools  Android SDK in Hindi  Android Debug bridge in Hindi Android gradle in Hindi Android studio in Hindi Android run time and delvik in Hindi  Android SDK  Android SDK (Software Development Kit) -  Android SDK  में वो सभी टूल्स होते है जिनकी आपको एंड्राइड एप्लीकेशन क्रिएट करने में, कम्पाइल करने में और एप्लीकेशन को पैकेज करने के लिए जरुरत पड़ेगी।  Android SDK में आपको सोर्स कोड के साथ सैंपल प्रोजेक्ट्स, डेवलपमेंट टूल्स, एक इमुलेटर और एप्लीकेशन डेवेलप करने के लिए रिक्वायर्ड लाइब्रेरीज मिलती है। सभी एप्लीकेशन java में डेवेलप की जाती है और डेलविक वर्चुअल मशीन पर रन की जाती है। Android debug bridge  ADB  (Android Debug Bridge  ) - ADB android SDK का एक कमांड लाइन  टूल है जिसकी मदद से आप अपनी एप्लीकेशन को वर्चुअल डिवाइस या किसी रियल डिवाइस पर रन करवा सकते है और डिबग कर सकते है। ये एक क्लाइंट सर्वर प्रोग्राम होता है जिसमे एक क्लाइंट होता है, एक सर्वर...