<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Play Video</title>
	<atom:link href="http://www.androidcompetencycenter.com/2009/08/play-video/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.androidcompetencycenter.com/2009/08/play-video/</link>
	<description>Tutorials, Tips and tricks, Tools for Android development</description>
	<lastBuildDate>Mon, 30 Jan 2012 19:28:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ragummrsa</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-633</link>
		<dc:creator>Ragummrsa</dc:creator>
		<pubDate>Thu, 15 Sep 2011 07:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-633</guid>
		<description>Hi 

Can u tell how to find video orientation. like if the video was taken from landscape mode means it will play automatically landscape mode same as portrait mode.  </description>
		<content:encoded><![CDATA[<p>Hi </p>
<p>Can u tell how to find video orientation. like if the video was taken from landscape mode means it will play automatically landscape mode same as portrait mode. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Milind</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-616</link>
		<dc:creator>Milind</dc:creator>
		<pubDate>Fri, 08 Jul 2011 11:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-616</guid>
		<description>Thank YOu so mch for helping me HOW TO LOAD A FILE ON SD-CARD IN ANDROID</description>
		<content:encoded><![CDATA[<p>Thank YOu so mch for helping me HOW TO LOAD A FILE ON SD-CARD IN ANDROID</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaushik101in</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-613</link>
		<dc:creator>Kaushik101in</dc:creator>
		<pubDate>Thu, 30 Jun 2011 05:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-613</guid>
		<description>I think you have to try for increasing the device size by right clicking on your 
project -&gt; RunAs -&gt; RunConfiguration -&gt; Choose Target Tab 

in target tab you can see &quot;Additonal Emulator Command Line Option&quot; and write there a simple command line i.e. &quot;-partition-size 1024&quot; and apply it. through this you can able to put a higher size of videos. And dont forget to put your video file into the res directory b&#039;coz I have seen the error i.e. address family not supported. This kind of error happens when the project haven&#039;t the compiled info about adding file or folder into the R.java file of the project.


Tell me if it will work for you, I am also the begineer of Android and share some more experience and problems to grow along with........


Thanks
Amit</description>
		<content:encoded><![CDATA[<p>I think you have to try for increasing the device size by right clicking on your<br />
project -&gt; RunAs -&gt; RunConfiguration -&gt; Choose Target Tab </p>
<p>in target tab you can see &#8220;Additonal Emulator Command Line Option&#8221; and write there a simple command line i.e. &#8220;-partition-size 1024&#8243; and apply it. through this you can able to put a higher size of videos. And dont forget to put your video file into the res directory b&#8217;coz I have seen the error i.e. address family not supported. This kind of error happens when the project haven&#8217;t the compiled info about adding file or folder into the R.java file of the project.</p>
<p>Tell me if it will work for you, I am also the begineer of Android and share some more experience and problems to grow along with&#8230;&#8230;..</p>
<p>Thanks<br />
Amit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Suresh Sharma</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-612</link>
		<dc:creator>Suresh Sharma</dc:creator>
		<pubDate>Tue, 28 Jun 2011 07:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-612</guid>
		<description>This is Okay demo of Vedio.challenge is now to play vedio file from sdcard.it sounds easy.But Obstacle is that File is &gt;300 MB (like 1 GB). Android sdcard accessing doesn&#039;t support &gt;300 MB. So I decided to derive the Vedio in Smaller Chunks. My code is Followed.But Error is Vedio can&#039;t be played.please have a look.see also DDMS LogCat.
if Any Solution ?
**CODE:** 
    
    
    private void getBytesFromFile(File file) throws IOException {
        FileInputStream is = new FileInputStream(file); //videorecorder stores video to file

        java.nio.channels.FileChannel fc = is.getChannel();
        java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocate(10485760);

        int chunkCount = 0;

        byte[] bytes;

        while(fc.read(bb) &gt;= 0){
            bb.flip();
            //save the part of the file into a chunk
            bytes = bb.array();
            storeByteArrayToFile(bytes, &quot;/sdcard/&quot;+mRecordingFile + &quot;.&quot; + chunkCount);//mRecordingFile is the (String)path to file
            chunkCount++;
            bb.clear();
        }
    }

    private void storeByteArrayToFile(byte[] bytesToSave, String path) throws IOException {
        FileOutputStream fOut = new FileOutputStream(path);
        try {
            fOut.write(bytesToSave);
        }
        catch (Exception ex) {
            Log.e(&quot;ERROR&quot;, ex.getMessage());
        }
        finally {
            fOut.close();
        }
    }

}




**DDMS CatLog is** 


06-28 12:31:55.450: DEBUG/dalvikvm(2174): GC_EXPLICIT freed 170 objects / 11992 bytes in 126ms
06-28 12:32:05.200: DEBUG/dalvikvm(2189): GC_EXPLICIT freed 700 objects / 38792 bytes in 126ms
06-28 12:32:10.281: DEBUG/dalvikvm(2199): GC_EXPLICIT freed 44 objects / 2088 bytes in 162ms
06-28 12:32:25.452: WARN/InputManagerService(79): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45107dd8
06-28 12:35:34.713: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol
06-28 12:40:34.779: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol
06-28 12:45:34.803: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol

 </description>
		<content:encoded><![CDATA[<p>This is Okay demo of Vedio.challenge is now to play vedio file from sdcard.it sounds easy.But Obstacle is that File is &gt;300 MB (like 1 GB). Android sdcard accessing doesn&#8217;t support &gt;300 MB. So I decided to derive the Vedio in Smaller Chunks. My code is Followed.But Error is Vedio can&#8217;t be played.please have a look.see also DDMS LogCat.<br />
if Any Solution ?<br />
**CODE:**<br />
   <br />
   <br />
    private void getBytesFromFile(File file) throws IOException {<br />
        FileInputStream is = new FileInputStream(file); //videorecorder stores video to file</p>
<p>        java.nio.channels.FileChannel fc = is.getChannel();<br />
        java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocate(10485760);</p>
<p>        int chunkCount = 0;</p>
<p>        byte[] bytes;</p>
<p>        while(fc.read(bb) &gt;= 0){<br />
            bb.flip();<br />
            //save the part of the file into a chunk<br />
            bytes = bb.array();<br />
            storeByteArrayToFile(bytes, &#8220;/sdcard/&#8221;+mRecordingFile + &#8220;.&#8221; + chunkCount);//mRecordingFile is the (String)path to file<br />
            chunkCount++;<br />
            bb.clear();<br />
        }<br />
    }</p>
<p>    private void storeByteArrayToFile(byte[] bytesToSave, String path) throws IOException {<br />
        FileOutputStream fOut = new FileOutputStream(path);<br />
        try {<br />
            fOut.write(bytesToSave);<br />
        }<br />
        catch (Exception ex) {<br />
            Log.e(&#8220;ERROR&#8221;, ex.getMessage());<br />
        }<br />
        finally {<br />
            fOut.close();<br />
        }<br />
    }</p>
<p>}</p>
<p>**DDMS CatLog is** </p>
<p>06-28 12:31:55.450: DEBUG/dalvikvm(2174): GC_EXPLICIT freed 170 objects / 11992 bytes in 126ms<br />
06-28 12:32:05.200: DEBUG/dalvikvm(2189): GC_EXPLICIT freed 700 objects / 38792 bytes in 126ms<br />
06-28 12:32:10.281: DEBUG/dalvikvm(2199): GC_EXPLICIT freed 44 objects / 2088 bytes in 162ms<br />
06-28 12:32:25.452: WARN/InputManagerService(79): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45107dd8<br />
06-28 12:35:34.713: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol<br />
06-28 12:40:34.779: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol<br />
06-28 12:45:34.803: DEBUG/SntpClient(79): request time failed: java.net.SocketException: Address family not supported by protocol</p>
<p> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaushik101in</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-611</link>
		<dc:creator>Kaushik101in</dc:creator>
		<pubDate>Wed, 22 Jun 2011 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-611</guid>
		<description>this will not working I have tried it
for the last two days...</description>
		<content:encoded><![CDATA[<p>this will not working I have tried it<br />
for the last two days&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chauhan</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-564</link>
		<dc:creator>chauhan</dc:creator>
		<pubDate>Tue, 18 Jan 2011 07:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-564</guid>
		<description>This code not worked</description>
		<content:encoded><![CDATA[<p>This code not worked</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sushrut Bidwai</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-558</link>
		<dc:creator>Sushrut Bidwai</dc:creator>
		<pubDate>Wed, 05 Jan 2011 10:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-558</guid>
		<description>Thanks Nirali for helping out users of the site! If you are interested in writing for the blog, please contact me.</description>
		<content:encoded><![CDATA[<p>Thanks Nirali for helping out users of the site! If you are interested in writing for the blog, please contact me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ankitadavra</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-557</link>
		<dc:creator>Ankitadavra</dc:creator>
		<pubDate>Wed, 05 Jan 2011 10:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-557</guid>
		<description>
getWindow().setFormat(PixelFormat.TRANSLUCENT);
        VideoView v=(VideoView)findViewById(R.id.video1);
        v.setVideoPath(&quot;android.resource://com.example.PlayVideo/&quot;+R.raw.cat);
        v.requestFocus();
        v.start();


i write this code that run but picture can  not display. plz tell me about this problem.</description>
		<content:encoded><![CDATA[<p>getWindow().setFormat(PixelFormat.TRANSLUCENT);<br />
        VideoView v=(VideoView)findViewById(R.id.video1);<br />
        v.setVideoPath(&#8220;android.resource://com.example.PlayVideo/&#8221;+R.raw.cat);<br />
        v.requestFocus();<br />
        v.start();</p>
<p>i write this code that run but picture can  not display. plz tell me about this problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nirali Gaudani</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-556</link>
		<dc:creator>Nirali Gaudani</dc:creator>
		<pubDate>Wed, 05 Jan 2011 10:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-556</guid>
		<description>public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.main);
         
        	getWindow().setFormat(PixelFormat.TRANSLUCENT);
        	VideoView v = new VideoView(this);
        	setContentView(v);
        	v.setVideoPath(&quot;android.resource://com.example.playvideo/&quot;+R.raw.beach);
        	v.start();
    	   
       }
       
    }


try this code it is run perfect...</description>
		<content:encoded><![CDATA[<p>public void onCreate(Bundle savedInstanceState) {<br />
        super.onCreate(savedInstanceState);<br />
        setContentView(R.layout.main);</p>
<p>        	getWindow().setFormat(PixelFormat.TRANSLUCENT);<br />
        	VideoView v = new VideoView(this);<br />
        	setContentView(v);<br />
        	v.setVideoPath(&#8220;android.resource://com.example.playvideo/&#8221;+R.raw.beach);<br />
        	v.start();</p>
<p>       }</p>
<p>    }</p>
<p>try this code it is run perfect&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nirali Gaudani</title>
		<link>http://www.androidcompetencycenter.com/2009/08/play-video/comment-page-1/#comment-555</link>
		<dc:creator>Nirali Gaudani</dc:creator>
		<pubDate>Wed, 05 Jan 2011 04:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435#comment-555</guid>
		<description>getWindow().setFormat(PixelFormat.TRANSLUCENT);
       
       VideoView videoView = (VideoView)findViewById(R.id.viewvideo); 
       videoView.setMediaController(new MediaController(this));
      
       MediaController mc = new MediaController(this);
       MediaPlayer mp = MediaPlayer.create(this, R.raw.wildlife);
      
       mp.start();


I hv tried to play video using given above code.but i got error like &quot;This Video Can&#039;t Play&quot;..so plz give me solution..
      </description>
		<content:encoded><![CDATA[<p>getWindow().setFormat(PixelFormat.TRANSLUCENT);</p>
<p>       VideoView videoView = (VideoView)findViewById(R.id.viewvideo);<br />
       videoView.setMediaController(new MediaController(this));</p>
<p>       MediaController mc = new MediaController(this);<br />
       MediaPlayer mp = MediaPlayer.create(this, R.raw.wildlife);</p>
<p>       mp.start();</p>
<p>I hv tried to play video using given above code.but i got error like &#8220;This Video Can&#8217;t Play&#8221;..so plz give me solution..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

