├── README.md └── VLCPlayerSample ├── .gitignore ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── windylabs │ │ └── com │ │ └── vlcplayersample │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── windylabs │ │ └── com │ │ └── vlcplayersample │ │ ├── MainActivity.java │ │ └── VideoVLCActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_main.xml │ └── activity_video_vlc.xml │ ├── menu │ ├── menu_main.xml │ └── menu_video_vlc.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /README.md: -------------------------------------------------------------------------------- 1 | # VLCPlayer 2 | A simple sample app that plays video using the LibVLC 3 | -------------------------------------------------------------------------------- /VLCPlayerSample/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "windylabs.com.vlcplayersample" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.0.0' 25 | compile "de.mrmaffen:vlc-android-sdk:1.0.6" 26 | } 27 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Gareoke/Downloads/adt-bundle-mac-x86_64-20140702/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/androidTest/java/windylabs/com/vlcplayersample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package windylabs.com.vlcplayersample; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gareoke/VLCPlayer/b55f99abcddacccbac0f316860f1a6cafb9d7db4/VLCPlayerSample/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/java/windylabs/com/vlcplayersample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package windylabs.com.vlcplayersample; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.ActionBarActivity; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | 12 | 13 | public class MainActivity extends ActionBarActivity { 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | 20 | Button b = (Button) findViewById(R.id.play_video); 21 | b.setOnClickListener(new View.OnClickListener() { 22 | @Override 23 | public void onClick(View view) { 24 | EditText e = (EditText) findViewById(R.id.video_url); 25 | String url = e.getText().toString(); 26 | 27 | Intent intent = new Intent(getApplicationContext(), windylabs.com.vlcplayersample.VideoVLCActivity.class); 28 | intent.putExtra("videoUrl", url); 29 | startActivity(intent); 30 | } 31 | }); 32 | } 33 | 34 | 35 | @Override 36 | public boolean onCreateOptionsMenu(Menu menu) { 37 | // Inflate the menu; this adds items to the action bar if it is present. 38 | getMenuInflater().inflate(R.menu.menu_main, menu); 39 | return true; 40 | } 41 | 42 | @Override 43 | public boolean onOptionsItemSelected(MenuItem item) { 44 | // Handle action bar item clicks here. The action bar will 45 | // automatically handle clicks on the Home/Up button, so long 46 | // as you specify a parent activity in AndroidManifest.xml. 47 | int id = item.getItemId(); 48 | 49 | //noinspection SimplifiableIfStatement 50 | if (id == R.id.action_settings) { 51 | return true; 52 | } 53 | 54 | return super.onOptionsItemSelected(item); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/java/windylabs/com/vlcplayersample/VideoVLCActivity.java: -------------------------------------------------------------------------------- 1 | package windylabs.com.vlcplayersample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.Surface; 9 | import android.view.SurfaceHolder; 10 | import android.view.SurfaceView; 11 | import android.widget.FrameLayout; 12 | 13 | import org.videolan.libvlc.IVideoPlayer; 14 | import org.videolan.libvlc.LibVLC; 15 | import org.videolan.libvlc.LibVlcException; 16 | 17 | public class VideoVLCActivity extends Activity implements IVideoPlayer { 18 | private static final String TAG = VideoVLCActivity.class.getSimpleName(); 19 | 20 | // size of the video 21 | private int mVideoHeight; 22 | private int mVideoWidth; 23 | private int mVideoVisibleHeight; 24 | private int mVideoVisibleWidth; 25 | private int mSarNum; 26 | private int mSarDen; 27 | 28 | private SurfaceView mSurfaceView; 29 | private FrameLayout mSurfaceFrame; 30 | private SurfaceHolder mSurfaceHolder; 31 | private Surface mSurface = null; 32 | 33 | private LibVLC mLibVLC; 34 | 35 | private String mMediaUrl; 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | Log.d(TAG, "VideoVLC -- onCreate -- START ------------"); 41 | setContentView(R.layout.activity_video_vlc); 42 | 43 | mSurfaceView = (SurfaceView) findViewById(R.id.player_surface); 44 | mSurfaceHolder = mSurfaceView.getHolder(); 45 | 46 | mSurfaceFrame = (FrameLayout) findViewById(R.id.player_surface_frame); 47 | mMediaUrl = getIntent().getExtras().getString("videoUrl"); 48 | 49 | try { 50 | mLibVLC = new LibVLC(); 51 | mLibVLC.setAout(mLibVLC.AOUT_AUDIOTRACK); 52 | mLibVLC.setVout(mLibVLC.VOUT_ANDROID_SURFACE); 53 | mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL); 54 | 55 | mLibVLC.init(getApplicationContext()); 56 | } catch (LibVlcException e){ 57 | Log.e(TAG, e.toString()); 58 | } 59 | 60 | mSurface = mSurfaceHolder.getSurface(); 61 | 62 | mLibVLC.attachSurface(mSurface, VideoVLCActivity.this); 63 | mLibVLC.playMRL(mMediaUrl); 64 | } 65 | 66 | @Override 67 | protected void onDestroy() { 68 | super.onDestroy(); 69 | 70 | // MediaCodec opaque direct rendering should not be used anymore since there is no surface to attach. 71 | mLibVLC.stop(); 72 | } 73 | 74 | @Override 75 | public boolean onCreateOptionsMenu(Menu menu) { 76 | // Inflate the menu; this adds items to the action bar if it is present. 77 | getMenuInflater().inflate(R.menu.menu_video_vlc, menu); 78 | return true; 79 | } 80 | 81 | @Override 82 | public boolean onOptionsItemSelected(MenuItem item) { 83 | int id = item.getItemId(); 84 | 85 | //noinspection SimplifiableIfStatement 86 | if (id == R.id.action_settings) { 87 | return true; 88 | } 89 | 90 | return super.onOptionsItemSelected(item); 91 | } 92 | 93 | public void eventHardwareAccelerationError() { 94 | Log.e(TAG, "eventHardwareAccelerationError()!"); 95 | return; 96 | } 97 | 98 | @Override 99 | public void setSurfaceLayout(final int width, final int height, int visible_width, int visible_height, final int sar_num, int sar_den){ 100 | Log.d(TAG, "setSurfaceSize -- START"); 101 | if (width * height == 0) 102 | return; 103 | 104 | // store video size 105 | mVideoHeight = height; 106 | mVideoWidth = width; 107 | mVideoVisibleHeight = visible_height; 108 | mVideoVisibleWidth = visible_width; 109 | mSarNum = sar_num; 110 | mSarDen = sar_den; 111 | 112 | Log.d(TAG, "setSurfaceSize -- mMediaUrl: " + mMediaUrl + " mVideoHeight: " + mVideoHeight + " mVideoWidth: " + mVideoWidth + " mVideoVisibleHeight: " + mVideoVisibleHeight + " mVideoVisibleWidth: " + mVideoVisibleWidth + " mSarNum: " + mSarNum + " mSarDen: " + mSarDen); 113 | } 114 | 115 | @Override 116 | public int configureSurface(android.view.Surface surface, int i, int i1, int i2){ 117 | return -1; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gareoke/VLCPlayer/b55f99abcddacccbac0f316860f1a6cafb9d7db4/VLCPlayerSample/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gareoke/VLCPlayer/b55f99abcddacccbac0f316860f1a6cafb9d7db4/VLCPlayerSample/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gareoke/VLCPlayer/b55f99abcddacccbac0f316860f1a6cafb9d7db4/VLCPlayerSample/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gareoke/VLCPlayer/b55f99abcddacccbac0f316860f1a6cafb9d7db4/VLCPlayerSample/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /VLCPlayerSample/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 |