use of com.brightcove.cast.GoogleCastComponent in project android-player-samples by BrightcoveOS.
the class GoogleCastSampleFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Initialize the Cast Companion Library's VideCastManager, so
// the MiniController can find it when it's inflated.
String applicationId = getResources().getString(R.string.application_id);
GoogleCastComponent.initializeVideoCastManager(getActivity(), applicationId, null);
// Perform the internal wiring to be able to make use of the BrightcovePlayerFragment.
View view = inflater.inflate(R.layout.basic_cast_fragment, container, false);
brightcoveVideoView = (BrightcoveVideoView) view.findViewById(R.id.brightcove_video_view);
eventEmitter = brightcoveVideoView.getEventEmitter();
super.onCreateView(inflater, container, savedInstanceState);
// Initialize the android_cast_plugin which requires the application id of your Cast
// receiver application.
googleCastComponent = new GoogleCastComponent(eventEmitter, applicationId, getActivity());
// Initialize the MiniController widget which will allow control of remote media playback.
miniController = (MiniController) view.findViewById(R.id.miniController1);
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(GoogleCastComponent.CAST_MINICONTROLLER, miniController);
eventEmitter.emit(GoogleCastEventType.SET_MINI_CONTROLLER, properties);
// Send the location of the media (url) and its metadata information for remote playback.
Resources resources = getResources();
String title = resources.getString(R.string.media_title);
String studio = resources.getString(R.string.media_studio);
String url = resources.getString(R.string.media_url);
String thumbnailUrl = resources.getString(R.string.media_thumbnail);
String imageUrl = resources.getString(R.string.media_image);
eventEmitter.emit(GoogleCastEventType.SET_MEDIA_METADATA, buildMetadataProperties("subTitle", title, studio, thumbnailUrl, imageUrl, url));
brightcoveVideoView.setVideoPath(url);
return view;
}
Aggregations