本文整理了Java中com.brightcove.player.model.Video
类的一些代码示例,展示了Video
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Video
类的具体详情如下:
包路径:com.brightcove.player.model.Video
类名称:Video
暂无
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDateSelected(@NonNull Date expiryDate) {
long playDuration = video.getDuration();
if (playDuration == 0) {
playDuration = DEFAULT_RENTAL_PLAY_DURATION;
}
catalog.requestRentalLicense(video, expiryDate, playDuration, licenseEventListener);
}
})
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void buyVideo(@NonNull final Video video) {
// Fetch the video object again to avoid using the given video that may have been
// changed by previous download.
catalog.findVideoByID(video.getId(), new FindVideoListener(video) {
@Override
public void onVideo(Video newVideo) {
catalog.requestPurchaseLicense(video, licenseEventListener);
}
});
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onError(String error) {
String message = showToast(
"Cannot find '%s' video: %s", video.getName(), error);
Log.e(TAG, message);
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
private void handleViewState(final ViewHolder holder, Video video, DownloadStatus status) {
if (video.isOfflinePlaybackAllowed()) {
holder.estimatedSizeText.setVisibility(View.VISIBLE);
catalog.estimateSize(video, new MediaDownloadable.OnVideoSizeCallback() {
if (video.isClearContent()) {
if (video.isOfflineCopy()) {
holder.videoStatusText.setText(R.string.video_download_clear_offline_copy);
holder.pauseButton.setVisibility(View.GONE);
final Date expiryDate = video.getLicenseExpiryDate();
if (expiryDate == null) {
holder.videoLicenseText.setText(R.string.video_download_purchase_or_rent);
holder.resumeButton.setVisibility(View.GONE);
} else {
if (video.isOwned() || video.isRented()) {
holder.rentButton.setVisibility(View.GONE);
holder.buyButton.setVisibility(View.GONE);
if (video.isOwned()) {
holder.videoLicenseText.setText(R.string.video_download_purchased);
} else {
holder.videoTitleText.setText(video.getName());
URI imageUri = video.getStillImageUri();
if (imageUri == null) {
holder.videoThumbnailImage.setImageResource(R.drawable.movie);
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
final Video video = videoList.get(position);
holder.videoTitleText.setText(video.getName());
Object descriptionObj = video.getProperties().get(PROPS_SHORT_DESCRIPTION);
if (descriptionObj instanceof String) {
holder.videoDescriptionText.setText((String) descriptionObj);
}
int duration = video.getDuration();
if (duration > 0) {
holder.videoDurationText.setText(millisecondsToString(duration));
holder.videoDurationText.setVisibility(View.VISIBLE);
} else {
holder.videoDurationText.setText(null);
holder.videoDurationText.setVisibility(View.GONE);
}
URI imageUri = video.getStillImageUri();
if (imageUri == null) {
holder.videoThumbnailImage.setImageResource(R.drawable.movie);
} else {
Picasso.with(holder.itemView.getContext()).load(imageUri.toASCIIString()).into(holder.videoThumbnailImage);
}
holder.videoThumbnailImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickListener.itemClicked(view, video, position);
}
});
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
protected void onCreate(Bundle savedInstanceState) {
// When extending the BrightcovePlayer, we must assign the brightcoveVideoView before
// entering the superclass. This allows for some stock video player lifecycle
// management. Establish the video object and use it's event emitter to get important
// notifications and to control logging.
setContentView(R.layout.activity_main);
brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
super.onCreate(savedInstanceState);
Video video = Video.createVideo("YOUR_LIVE_HLS_STREAM", DeliveryType.HLS);
video.getProperties().put(Video.Fields.PUBLISHER_ID, "YOUR_VIDEOCLOUD_PUBLISHER_ID");
brightcoveVideoView.add(video);
brightcoveVideoView.start();
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onVideo(Video video) {
String title = video.getName();
if (!TextUtils.isEmpty(title)) {
TextView textView = findViewById(R.id.video_title_text);
textView.setText(title);
}
Object descriptionObj = video.getProperties().get(PROPS_LONG_DESCRIPTION);
if (descriptionObj instanceof String) {
TextView longDesc = findViewById(R.id.video_description_text);
longDesc.setText((String) descriptionObj);
}
baseVideoView.add(video);
}
});
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View result = inflater.inflate(R.layout.fragment_main, container, false);
baseVideoView = (BaseVideoView) result.findViewById(R.id.brightcove_video_view);
super.onCreateView(inflater, container, savedInstanceState);
Video video = Video.createVideo("http://media.w3.org/2010/05/sintel/trailer.mp4", DeliveryType.MP4);
baseVideoView.add(video);
baseVideoView.getAnalytics().setAccount("1760897681001");
baseVideoView.start();
return result;
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
void getVideo(final OfflineCallback<Video> callback) {
final Video result = video;
if (video.isOfflinePlaybackAllowed()) {
catalog.findOfflineVideoById(video.getId(), new OfflineCallback<Video>() {
@Override
public void onSuccess(Video offlineVideo) {
if (offlineVideo != null) {
callback.onSuccess(offlineVideo);
} else {
callback.onSuccess(video);
}
}
@Override
public void onFailure(Throwable throwable) {
callback.onSuccess(result);
}
});
} else {
callback.onSuccess(result);
}
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
Video video = Video.createVideo("https://s3.amazonaws.com/as-zencoder/hls-timed-metadata/test.m3u8", DeliveryType.HLS);
video.getProperties().put(Video.Fields.PUBLISHER_ID, "5420904993001");
brightcoveVideoView.add(video);
brightcoveVideoView.start();
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Video video = Video.createVideo("http://media.w3.org/2010/05/sintel/trailer.mp4", DeliveryType.MP4);
baseVideoView.add(video);
baseVideoView.getAnalytics().setAccount("1760897681001");
baseVideoView.start();
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDownloadDeleted(@NonNull final Video video) {
//No need to update UI here because it will be handled by the deleteVideo method.
String message = showToast(
"Offline copy of '%s' video removed", video.getName());
Log.i(TAG, message);
onDownloadRemoved(video);
}
代码示例来源:origin: BrightcoveOS/android-player-samples
/**
* Build the index map.
*/
private void buildIndexMap() {
indexMap.clear();
if (videoList != null) {
int index = 0;
for (Video video : videoList) {
indexMap.put(video.getId(), index++);
}
}
notifyDataSetChanged();
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDownloadCanceled(@NonNull final Video video) {
//No need to update UI here because it will be handled by the deleteVideo method.
String message = showToast(
"Cancelled download of '%s' video removed", video.getName());
Log.i(TAG, message);
onDownloadRemoved(video);
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void rentVideo(@NonNull final Video video) {
// Fetch the video object again to avoid using the given video that may have been
// changed by previous download.
catalog.findVideoByID(video.getId(), new FindVideoListener(video) {
@Override
public void onVideo(Video newVideo) {
MainActivity.this.rentVideo(newVideo);
}
});
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDownloadCompleted(@NonNull final Video video, @NonNull final DownloadStatus status) {
videoListAdapter.notifyVideoChanged(video, status);
String message = showToast(
"Successfully saved '%s' video", video.getName());
Log.i(TAG, message);
}
代码示例来源:origin: BrightcoveOS/android-player-samples
/**
* Removes a video from the list.
*
* @param video the video to be removed.
*/
void removeVideo(Video video) {
String videoId = video.getId();
if (indexMap.containsKey(videoId)) {
int index = indexMap.remove(videoId);
videoList.remove(index);
buildIndexMap();
}
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDownloadRequested(@NonNull final Video video) {
Log.i(TAG, String.format(
"Starting to process '%s' video download request", video.getName()));
videoListAdapter.notifyVideoChanged(video);
}
代码示例来源:origin: BrightcoveOS/android-player-samples
/**
* Build the index map.
*/
private void buildIndexMap() {
indexMap.clear();
if (videoList != null) {
int index = 0;
for (Video video : videoList) {
indexMap.put(video.getId(), index++);
}
}
notifyDataSetChanged();
}
代码示例来源:origin: BrightcoveOS/android-player-samples
@Override
public void onDownloadStarted(@NonNull Video video, long estimatedSize, @NonNull Map<String, Serializable> mediaProperties) {
videoListAdapter.notifyVideoChanged(video);
String message = showToast(
"Started to download '%s' video. Estimated = %s, width = %s, height = %s, mimeType = %s",
video.getName(),
Formatter.formatFileSize(MainActivity.this, estimatedSize),
mediaProperties.get(Event.RENDITION_WIDTH),
mediaProperties.get(Event.RENDITION_HEIGHT),
mediaProperties.get(Event.RENDITION_MIME_TYPE)
);
Log.i(TAG, message);
}
内容来源于网络,如有侵权,请联系作者删除!