use of org.videolan.medialibrary.media.MediaWrapper in project vlc-android by GeoffreyMetais.
the class PlaybackService method showWithoutParse.
/**
* Use this function to show an URI in the audio interface WITHOUT
* interrupting the stream.
*
* Mainly used by VideoPlayerActivity in response to loss of video track.
*/
@MainThread
public void showWithoutParse(int index) {
playlistManager.setVideoTrackEnabled(false);
final MediaWrapper media = playlistManager.getMedia(index);
if (media == null || !isPlaying())
return;
// Show an URI without interrupting/losing the current stream
if (BuildConfig.DEBUG)
Log.v(TAG, "Showing index " + index + " with playing URI " + media.getUri());
playlistManager.setCurrentIndex(index);
notifyTrackChanged();
showNotification();
}
use of org.videolan.medialibrary.media.MediaWrapper in project vlc-android by GeoffreyMetais.
the class PlaybackService method updateWidgetCover.
private void updateWidgetCover() {
final MediaWrapper mw = playlistManager.getCurrentMedia();
final String newWidgetCover = mw != null ? mw.getArtworkMrl() : null;
if (!TextUtils.equals(mCurrentWidgetCover, newWidgetCover)) {
mCurrentWidgetCover = newWidgetCover;
sendWidgetBroadcast(new Intent(VLCAppWidgetProvider.ACTION_WIDGET_UPDATE_COVER).putExtra("artworkMrl", newWidgetCover));
}
}
use of org.videolan.medialibrary.media.MediaWrapper in project vlc-android by GeoffreyMetais.
the class PlaybackService method broadcastMetadata.
private void broadcastMetadata() {
final MediaWrapper media = playlistManager.getCurrentMedia();
if (media == null || isVideoPlaying())
return;
sendBroadcast(new Intent("com.android.music.metachanged").putExtra("track", media.getTitle()).putExtra("artist", media.getArtist()).putExtra("album", media.getAlbum()).putExtra("duration", media.getLength()).putExtra("playing", isPlaying()).putExtra("package", "org.videolan.vlc"));
}
use of org.videolan.medialibrary.media.MediaWrapper in project vlc-android by GeoffreyMetais.
the class PlaybackService method updateWidgetPosition.
private void updateWidgetPosition(final float pos) {
final MediaWrapper mw = playlistManager.getCurrentMedia();
if (mw == null || mWidget == 0 || isVideoPlaying())
return;
// no more than one widget mUpdateMeta for each 1/50 of the song
long timestamp = System.currentTimeMillis();
if (!playlistManager.hasCurrentMedia() || timestamp - mWidgetPositionTimestamp < mw.getLength() / 50)
return;
mWidgetPositionTimestamp = timestamp;
sendWidgetBroadcast(new Intent(VLCAppWidgetProvider.ACTION_WIDGET_UPDATE_POSITION).putExtra("position", pos));
}
use of org.videolan.medialibrary.media.MediaWrapper in project vlc-android by GeoffreyMetais.
the class Medialibrary method findMedia.
// If media is not in ML, find it with its path
public MediaWrapper findMedia(MediaWrapper mw) {
if (mIsInitiated && mw != null && mw.getId() == 0L) {
Uri uri = mw.getUri();
MediaWrapper libraryMedia = getMedia(uri);
if (libraryMedia == null && TextUtils.equals("file", uri.getScheme()) && uri.getPath() != null && uri.getPath().startsWith("/sdcard")) {
uri = Tools.convertLocalUri(uri);
libraryMedia = getMedia(uri);
}
if (libraryMedia != null)
return libraryMedia;
}
return mw;
}
Aggregations