本文整理汇总了Java中org.videolan.vlc.gui.video.VideoPlayerActivity.start方法的典型用法代码示例。如果您正苦于以下问题:Java VideoPlayerActivity.start方法的具体用法?Java VideoPlayerActivity.start怎么用?Java VideoPlayerActivity.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.vlc.gui.video.VideoPlayerActivity
的用法示例。
在下文中一共展示了VideoPlayerActivity.start方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openMediaFile
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
private void openMediaFile(int p) {
AudioServiceController audioController = AudioServiceController.getInstance();
String mediaFile = mDirectoryAdapter.getMediaLocation(p);
try {
if (LibVLC.getExistingInstance() == null
|| !LibVLC.getExistingInstance().hasVideoTrack(mediaFile)) {
List<String> mediaLocations = mDirectoryAdapter.getAllMediaLocations();
audioController.load(mediaLocations, mediaLocations.indexOf(mediaFile));
} else {
VideoPlayerActivity.start(getActivity(), mediaFile);
}
} catch (IOException e) {
/* disk error maybe? */
}
}
示例2: handleVout
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
private void handleVout() {
if (!hasCurrentMedia())
return;
Log.i(TAG, "Obtained video track");
String title = getCurrentMedia().getTitle();
String MRL = mLibVLC.getMediaList().getMRL(mCurrentIndex);
int index = mCurrentIndex;
mCurrentIndex = -1;
mEventHandler.removeHandler(mVlcEventHandler);
// Preserve playback when switching to video
hideNotification(false);
// Don't crash if user stopped the media
if(!mLibVLC.isPlaying()) return;
// Switch to the video player & don't lose the currently playing stream
VideoPlayerActivity.start(VLCApplication.getAppContext(), MRL, title, index, true);
}
示例3: openMedia
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
public static void openMedia(final Context context, final MediaWrapper media){
if (media == null)
return;
if (media.getType() == MediaWrapper.TYPE_VIDEO)
VideoPlayerActivity.start(context, media.getUri(), media.getTitle());
else if (media.getType() == MediaWrapper.TYPE_AUDIO) {
new DialogCallback(context, new DialogCallback.Runnable() {
@Override
public void run(PlaybackService service) {
service.load(media);
}
});
}
}
示例4: onContextItemSelected
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
if(!getUserVisibleHint()) return super.onContextItemSelected(item);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
if(info == null) // info can be null
return super.onContextItemSelected(item);
int id = item.getItemId();
String mediaLocation = mDirectoryAdapter.getMediaLocation(info.position);
if (mediaLocation == null)
return super.onContextItemSelected(item);
if(id == R.id.directory_view_play) {
openMediaFile(info.position);
return true;
} else if(id == R.id.directory_view_append) {
AudioServiceController.getInstance().append(mediaLocation);
return true;
} else if(id == R.id.directory_view_delete) {
AlertDialog alertDialog = CommonDialogs.deleteMedia(getActivity(), mediaLocation,
new VLCRunnable() {
@Override
public void run(Object o) {
refresh();
}
});
alertDialog.show();
} else if(id == R.id.directory_view_play_audio) {
AudioServiceController.getInstance().load(mediaLocation, true);
} else if(id == R.id.directory_view_play_video) {
VideoPlayerActivity.start(getActivity(), mediaLocation);
}
return super.onContextItemSelected(item);
}
示例5: onListItemClick
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (getListAdapter() == mHistoryAdapter) {
String selection = ((TextView) v.findViewById(android.R.id.text1)).getText().toString();
mSearchText.setText(selection);
mSearchText.setSelection(selection.length());
mSearchText.requestFocus();
} else if (getListAdapter() == mResultAdapter) {
// add search text to the database (history)
MediaDatabase db = MediaDatabase.getInstance();
db.addSearchhistoryItem(mSearchText.getText().toString());
// open media in the player
Media item = (Media) getListView().getItemAtPosition(position);
if (item != null) {
if (item.getType() == Media.TYPE_VIDEO) {
VideoPlayerActivity.start(getActivity(), item.getLocation());
} else {
ArrayList<String> arr = new ArrayList<String>();
for (int i = 0; i < getListAdapter().getCount(); i++) {
Media audioItem = (Media) getListAdapter().getItem(i);
if (audioItem.getType() == Media.TYPE_AUDIO)
arr.add(audioItem.getLocation());
}
AudioServiceController.getInstance().load(arr, arr.indexOf(item.getLocation()));
return;
}
}
super.onListItemClick(l, v, position, id);
}
}
示例6: handleVout
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
private void handleVout() {
if (!hasCurrentMedia())
return;
Log.i(TAG, "Obtained video track");
String title = getCurrentMedia().getTitle();
String MRL = mLibVLC.getMediaList().getMRL(mCurrentIndex);
int index = mCurrentIndex;
mCurrentIndex = -1;
mEventHandler.removeHandler(mVlcEventHandler);
// Preserve playback when switching to video
hideNotification(false);
// Switch to the video player & don't lose the currently playing stream
VideoPlayerActivity.start(VLCApplication.getAppContext(), MRL, title, index, true);
}
示例7: onContextItemSelected
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
if(!getUserVisibleHint()) return super.onContextItemSelected(item);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
if(info == null) // info can be null
return super.onContextItemSelected(item);
int id = item.getItemId();
String mediaLocation = mDirectoryAdapter.getMediaLocation(info.position);
if (mediaLocation == null)
return super.onContextItemSelected(item);
if(id == R.id.directory_view_play) {
openMediaFile(info.position);
return true;
} else if(id == R.id.directory_view_append) {
AudioServiceController.getInstance().append(mediaLocation);
return true;
} else if(id == R.id.directory_view_delete) {
AlertDialog alertDialog = CommonDialogs.deleteMedia(getActivity(), mediaLocation,
new VlcRunnable() {
@Override
public void run(Object o) {
refresh();
}
});
alertDialog.show();
} else if(id == R.id.directory_view_play_audio) {
AudioServiceController.getInstance().load(mediaLocation, true);
} else if(id == R.id.directory_view_play_video) {
VideoPlayerActivity.start(getActivity(), mediaLocation);
}
return super.onContextItemSelected(item);
}
示例8: onListItemClick
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
if (getListAdapter() == mHistoryAdapter) {
String selection = ((TextView) v.findViewById(android.R.id.text1)).getText().toString();
mSearchText.setText(selection);
mSearchText.setSelection(selection.length());
mSearchText.requestFocus();
} else if (getListAdapter() == mResultAdapter) {
// add search text to the database (history)
MediaDatabase db = MediaDatabase.getInstance(this);
db.addSearchhistoryItem(mSearchText.getText().toString());
// open media in the player
Media item = (Media) getListAdapter().getItem(position - 1);
if (item.getType() == Media.TYPE_VIDEO) {
VideoPlayerActivity.start(this, item.getLocation());
} else {
ArrayList<String> arr = new ArrayList<String>();
for (int i = 0; i < getListAdapter().getCount(); i++) {
Media audioItem = (Media) getListAdapter().getItem(i);
if (audioItem.getType() == Media.TYPE_AUDIO)
arr.add(audioItem.getLocation());
}
AudioServiceController.getInstance().load(arr, arr.indexOf(item.getLocation()));
finish();
return;
}
super.onListItemClick(l, v, position, id);
}
}
示例9: onOptionsItemSelected
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
/**
* Handle onClick form menu buttons
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Current fragment loaded
Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
// Handle item selection
switch (item.getItemId()) {
case R.id.ml_menu_sortby_name:
case R.id.ml_menu_sortby_length:
case R.id.ml_menu_sortby_date:
if (current == null)
break;
if (current instanceof ISortable) {
int sortBy = VideoListAdapter.SORT_BY_TITLE;
if (item.getItemId() == R.id.ml_menu_sortby_length)
sortBy = VideoListAdapter.SORT_BY_LENGTH;
else if(item.getItemId() == R.id.ml_menu_sortby_date)
sortBy = VideoListAdapter.SORT_BY_DATE;
((ISortable) current).sortBy(sortBy);
supportInvalidateOptionsMenu();
}
break;
case R.id.ml_menu_equalizer:
showSecondaryFragment(SecondaryActivity.EQUALIZER);
break;
// Refresh
case R.id.ml_menu_refresh:
if (!mMediaLibrary.isWorking()) {
if(current != null && current instanceof IRefreshable)
((IRefreshable) current).refresh();
else
mMediaLibrary.loadMediaItems(true);
}
break;
// Restore last playlist
case R.id.ml_menu_last_playlist:
if (current instanceof AudioBrowserFragment) {
Intent i = new Intent(PlaybackService.ACTION_REMOTE_LAST_PLAYLIST);
sendBroadcast(i);
} else if (current instanceof VideoGridFragment) {
final Uri uri = Uri.parse(mSettings.getString(PreferencesActivity.VIDEO_LAST, null));
if (uri != null)
VideoPlayerActivity.start(this, uri);
}
break;
case android.R.id.home:
// Slide down the audio player.
if (slideDownAudioPlayer())
break;
/* Toggle the sidebar */
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
break;
case R.id.ml_menu_clean:
if (getFragment(mCurrentFragment) instanceof MRLPanelFragment)
((MRLPanelFragment)getFragment(mCurrentFragment)).clearHistory();
break;
case R.id.ml_menu_save:
if (current == null)
break;
((NetworkBrowserFragment)current).toggleFavorite();
item.setIcon(R.drawable.ic_menu_bookmark_w);
break;
}
mDrawerLayout.closeDrawer(mListView);
return super.onOptionsItemSelected(item);
}
示例10: handleContextItemSelected
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
protected boolean handleContextItemSelected(MenuItem item, int position) {
int id = item.getItemId();
if (! (mAdapter.getItem(position) instanceof MediaWrapper))
return super.onContextItemSelected(item);
MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
switch (id){
case R.id.directory_view_play:
mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
Util.openMedia(getActivity(), mw);
return true;
case R.id.directory_view_append: {
if (mService != null)
mService.append(mw);
return true;
}
case R.id.directory_view_delete:
AlertDialog alertDialog = CommonDialogs.deleteMedia(
mw.getType(), getActivity(), mw.getLocation(),
new VLCRunnable() {
@Override
public void run(Object o) {
refresh();
}
});
alertDialog.show();
return true;
case R.id.directory_view_info:
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra("fragment", "mediaInfo");
i.putExtra("param", mw.getUri().toString());
startActivity(i);
return true;
case R.id.directory_view_play_audio: {
if (mService != null) {
mw.addFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
mService.load(mw);
}
return true;
}
case R.id.directory_view_play_video:
VideoPlayerActivity.start(getActivity(), mw.getUri());
return true;
case R.id.directory_view_play_folder:
ArrayList<MediaWrapper> mediaList = new ArrayList<MediaWrapper>();
for (MediaWrapper mediaItem : mMediaLists.get(position)){
if (mediaItem.getType() == MediaWrapper.TYPE_AUDIO || mediaItem.getType() == MediaWrapper.TYPE_VIDEO)
mediaList.add(mediaItem);
}
Util.openList(getActivity(), mediaList, 0);
return true;
// case R.id.directory_view_hide_media:
// try {
// if (new File(mw.getLocation()+"/.nomedia").createNewFile())
// updateLib();
// } catch (IOException e) {}
// return true;
// case R.id.directory_view_show_media:
// if (new File(mw.getLocation()+"/.nomedia").delete())
// updateLib();
// return true;
}
return false;
}
示例11: onOptionsItemSelected
import org.videolan.vlc.gui.video.VideoPlayerActivity; //导入方法依赖的package包/类
/**
* Handle onClick form menu buttons
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Current fragment loaded
Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
// Handle item selection
switch (item.getItemId()) {
case R.id.ml_menu_sortby_name:
case R.id.ml_menu_sortby_length:
case R.id.ml_menu_sortby_date:
if (current == null)
break;
if (current instanceof ISortable) {
int sortBy = VideoListAdapter.SORT_BY_TITLE;
if (item.getItemId() == R.id.ml_menu_sortby_length)
sortBy = VideoListAdapter.SORT_BY_LENGTH;
else if(item.getItemId() == R.id.ml_menu_sortby_date)
sortBy = VideoListAdapter.SORT_BY_DATE;
((ISortable) current).sortBy(sortBy);
supportInvalidateOptionsMenu();
}
break;
case R.id.ml_menu_equalizer:
showSecondaryFragment(SecondaryActivity.EQUALIZER);
break;
// Refresh
case R.id.ml_menu_refresh:
if (!mMediaLibrary.isWorking()) {
if(current != null && current instanceof IRefreshable)
((IRefreshable) current).refresh();
else
mMediaLibrary.scanMediaItems(true);
}
break;
// Restore last playlist
case R.id.ml_menu_last_playlist:
if (current instanceof AudioBrowserFragment) {
Intent i = new Intent(PlaybackService.ACTION_REMOTE_LAST_PLAYLIST);
sendBroadcast(i);
} else if (current instanceof VideoGridFragment) {
final Uri uri = Uri.parse(mSettings.getString(PreferencesActivity.VIDEO_LAST, null));
if (uri != null)
VideoPlayerActivity.start(this, uri);
}
break;
case android.R.id.home:
// Slide down the audio player.
if (slideDownAudioPlayer())
break;
/* Toggle the sidebar */
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
break;
case R.id.ml_menu_clean:
if (getFragment(mCurrentFragment) instanceof MRLPanelFragment)
((MRLPanelFragment)getFragment(mCurrentFragment)).clearHistory();
break;
case R.id.ml_menu_save:
if (current == null)
break;
((NetworkBrowserFragment)current).toggleFavorite();
item.setIcon(R.drawable.ic_menu_bookmark_w);
break;
}
mDrawerLayout.closeDrawer(mListView);
return super.onOptionsItemSelected(item);
}