Home » Source Code » TextureVIew displays local video

TextureVIew displays local video

心晴c
2015-06-12 04:04:40
The author
View(s):
Download(s): 0
Point (s): 1 
Category Category:
视频处理视频处理 JavaJava

Description

Application background

Before using surfaceView to do the view show, but surfaceView can not achieve some of the operation, you find a textureView to do the view shows, a simple player to play local video examples

Key Technology

Class MainActivity extends Activity implements SurfaceTextureListener public, OnBufferingUpdateListener, OnCompletionListener, OnPreparedListener, OnVideoSizeChangedListener{TextureView TextureView;MediaPlayer mMediaPlayer private;@OverrideVoid onCreate protected (savedInstanceState Bundle) {Super.onCreate (savedInstanceState);SetContentView (R.layout.activity_main);TextureView= (TextureView) findViewById (R.id.textureview);TextureView.setSurfaceTextureListener (this);TextureView=new / TextureView (this);/ / textureView.setSurfaceTextureListener (this);/ / setContentView (textureView);}@OverrideVoid onSurfaceTextureAvailable SurfaceTexture (surface int, width public,Height int) {System.out.println ("onSurfaceTextureAvailable onSurfaceTextureAvailable");S new = Surface Surface (surface);{tryMMediaPlayer=; new MediaPlayer   ();  mMediaPlayer.setDataSource (Environment.getExternalStorageDirectory () + "/videoname.mp4");  MMediaPlayer.setSurface;   (s);MMediaPlayer.prepare ( );MMediaPlayer.setOnBufferingUpdateListener;   (this);MMediaPlayer.setOnCompletionListener;   (this);MMediaPlayer.setOnPreparedListener;   (this);MMediaPlayer.setOnVideoSizeChangedListener;   (this);MMediaPlayer.setAudioStreamType;   (AudioManager.STREAM_MUSIC);MMediaPlayer.start ( ); } catch (E IllegalArgumentException) { E.printStackTrace ( );} catch (E SecurityException) {E.printStackTrace ( );} catch (E IllegalStateException) {  e.printStackTrace ();    } catch (E IOException) {E.printStackTrace ( );} }@OverrideVoid onSurfaceTextureSizeChanged SurfaceTexture (surface int, width public,Height int) {System.out.println ("onSurfaceTextureSizeChanged onSurfaceTextureSizeChanged");}@OverrideBoolean onSurfaceTextureDestroyed public (surface SurfaceTexture) {System.out.println ("onSurfaceTextureDestroyed onSurfaceTextureDestroyed");MMediaPlayer.stop ();True return;}@OverrideVoid onSurfaceTextureUpdated public (surface SurfaceTexture) {/ / System.out.println ("onSurfaceTextureUpdated onSurfaceTextureUpdated");}@OverrideVoid onBufferingUpdate public (MP int, percent MediaPlayer) {}@OverrideVoid onCompletion public (MP MediaPlayer) {}@OverrideVoid onPrepared public (MP MediaPlayer) {}@OverrideVoid onVideoSizeChanged public (MP int, width int, height MediaPlayer) {}
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.97 kB
.classpath475.00 B2015-01-27 09:59
.project852.00 B2015-01-27 09:58
01.97 kB
org.eclipse.jdt.core.prefs177.00 B2015-01-27 09:58
AndroidManifest.xml898.00 B2015-01-27 09:58
01.97 kB
01.97 kB
AndroidManifest.xml898.00 B2015-02-26 09:46
01.97 kB
classes.dex614.20 kB2015-02-26 09:56
01.97 kB
01.97 kB
01.97 kB
BuildConfig.class365.00 B2015-02-26 09:46
CopyOfMainActivity.class4.45 kB2015-02-26 09:46
Copy_2_of_MainActivity.class2.86 kB2015-02-26 09:46
Copy_3_of_MainActivity$1.class989.00 B2015-02-26 09:46
Copy_3_of_MainActivity.class3.89 kB2015-02-26 09:46
MainActivity.class4.34 kB2015-02-26 09:46
R$attr.class370.00 B2015-02-26 09:48
R$dimen.class491.00 B2015-02-26 09:48
R$drawable.class437.00 B2015-02-26 09:48
R$id.class458.00 B2015-02-26 09:48
R$layout.class433.00 B2015-02-26 09:48
R$menu.class418.00 B2015-02-26 09:48
R$string.class502.00 B2015-02-26 09:48
R$style.class461.00 B2015-02-26 09:48
R.class773.00 B2015-02-26 09:48
01.97 kB
android-support-v4-194539e0f107fba97191cb61b6e58a05.jar206.37 kB2015-02-13 16:26
jarlist.cache120.00 B2015-02-26 09:33
01.97 kB
resources.ap_39.82 kB2015-02-26 09:56
01.97 kB
ic_launcher.png5.82 kB2015-02-13 16:26
01.97 kB
ic_launcher.png3.04 kB2015-02-13 16:26
01.97 kB
ic_launcher.png9.14 kB2015-02-13 16:26
01.97 kB
ic_launcher.png17.47 kB2015-02-13 16:26
TextureViewVideo.apk252.31 kB2015-02-26 09:56
01.97 kB
01.97 kB
01.97 kB
01.97 kB
BuildConfig.java170.00 B2015-02-26 09:46
R.java2.50 kB2015-02-26 09:48
ic_launcher-web.png50.19 kB2015-01-27 09:58
01.97 kB
android-support-v4.jar543.16 kB2015-01-27 09:58
lint.xml97.00 B2015-01-27 10:08
proguard-project.txt781.00 B2015-01-27 09:58
project.properties563.00 B2015-01-27 09:58
01.97 kB
01.97 kB
ic_launcher.png7.48 kB2015-01-27 09:58
01.97 kB
01.97 kB
ic_launcher.png3.69 kB2015-01-27 09:58
01.97 kB
ic_launcher.png12.22 kB2015-01-27 09:58
01.97 kB
ic_launcher.png24.20 kB2015-01-27 09:58
01.97 kB
activity_main.xml387.00 B2015-01-27 10:07
01.97 kB
main.xml263.00 B2015-01-27 09:58
01.97 kB
01.97 kB
dimens.xml203.00 B2015-01-27 09:58
01.97 kB
dimens.xml277.00 B2015-01-27 09:58
01.97 kB
styles.xml334.00 B2015-01-27 09:58
01.97 kB
styles.xml391.00 B2015-01-27 09:58
dimens.xml220.00 B2015-01-27 09:58
strings.xml233.00 B2015-01-27 09:58
styles.xml697.00 B2015-01-27 09:58
01.97 kB
01.97 kB
01.97 kB
01.97 kB
testVideo.java3.38 kB2015-01-27 10:48
MainActivity.java3.04 kB2015-01-27 13:57
...
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
  • 1
  • Page 1
  • Total 1

TextureVIew displays local video (1.31 MB)

Need 1 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D