本文整理汇总了Java中com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject类的典型用法代码示例。如果您正苦于以下问题:Java MediaLaunchObject类的具体用法?Java MediaLaunchObject怎么用?Java MediaLaunchObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaLaunchObject类属于com.connectsdk.service.capability.MediaPlayer包,在下文中一共展示了MediaLaunchObject类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMediaLaunchListener
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
public MediaPlayer.LaunchListener getMediaLaunchListener() {
return new MediaPlayer.LaunchListener() {
@Override
public void onSuccess(MediaLaunchObject object) {
// FIXME include media control
JSONObject launchSessionObj = null;
JSONObject mediaControlObj = null;
JSONObject playlistControlObj = null;
try {
launchSessionObj = object.launchSession.toJSONObject();
launchSessionObj.put("serviceName", object.launchSession.getService().getServiceName());
if (object.mediaControl != null) {
MediaControlWrapper mediaControlWrapper = new MediaControlWrapper(deviceWrapper.plugin, object.mediaControl);
deviceWrapper.plugin.addObjectWrapper(mediaControlWrapper);
mediaControlObj = mediaControlWrapper.toJSONObject();
}
if (object.playlistControl != null) {
PlaylistControlWrapper playlistControlWrapper = new PlaylistControlWrapper(deviceWrapper.plugin, object.playlistControl);
deviceWrapper.plugin.addObjectWrapper(playlistControlWrapper);
playlistControlObj = playlistControlWrapper.toJSONObject();
}
} catch (JSONException e) {
e.printStackTrace();
}
sendSuccessEvent(launchSessionObj, mediaControlObj, playlistControlObj);
}
@Override
public void onError(ServiceCommandError error) {
error(error);
}
};
}
示例2: onSuccess
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
@Override
public void onSuccess(MediaLaunchObject object) {
Log.d("Connect SDK Sample App", "Successfully launched image!");
mDevice.removeListener(mDeviceListener);
mDevice.disconnect();
mDevice = null;
}
示例3: playAudio
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
private void playAudio() {
String mediaURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/audio.mp3";
String iconURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/audioIcon.jpg";
String title = "The Song that Doesn't End";
String description = "Lamb Chop's Play Along";
String mimeType = "audio/mp3";
boolean shouldLoop = loopingButton.isChecked();
MediaInfo mediaInfo = new MediaInfo.Builder(mediaURL, mimeType)
.setTitle(title)
.setDescription(description)
.setIcon(iconURL)
.build();
getMediaPlayer().playMedia(mediaInfo, shouldLoop, new MediaPlayer.LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
Log.d("LG", "Error playing audio", error);
stopMediaSession();
}
@Override
public void onSuccess(MediaLaunchObject object) {
Log.d("LG", "Started playing audio");
launchSession = object.launchSession;
testResponse = new TestResponseObject(true, TestResponseObject.SuccessCode, TestResponseObject.Play_Audio);
mMediaControl = object.mediaControl;
mPlaylistControl = object.playlistControl;
stopUpdating();
enableMedia();
isPlaying = true;
}
});
}
示例4: playM3U
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
private void playM3U() {
String mediaURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/example-m3u-playlist.m3u";
String iconURL = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/audioIcon.jpg";
String title = "Playlist";
String description = "Playlist description";
String mimeType = "application/x-mpegurl";
boolean shouldLoop = loopingButton.isChecked();
MediaInfo mediaInfo = new MediaInfo.Builder(mediaURL, mimeType)
.setTitle(title)
.setDescription(description)
.setIcon(iconURL)
.build();
getMediaPlayer().playMedia(mediaInfo, shouldLoop, new MediaPlayer.LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
Log.d("LG", "Error playing audio", error);
stopMediaSession();
}
@Override
public void onSuccess(MediaLaunchObject object) {
Log.d("LG", "Started playing playlist");
launchSession = object.launchSession;
mMediaControl = object.mediaControl;
mPlaylistControl = object.playlistControl;
stopUpdating();
enableMedia();
isPlaying = true;
}
});
}
示例5: showImage
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
private void showImage() {
disableMedia();
String imagePath = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/photo.jpg";
String mimeType = "image/jpeg";
String title = "Sintel Character Design";
String description = "Blender Open Movie Project";
String icon = "http://ec2-54-201-108-205.us-west-2.compute.amazonaws.com/samples/media/photoIcon.jpg";
MediaInfo mediaInfo = new MediaInfo.Builder(imagePath, mimeType)
.setTitle(title)
.setDescription(description)
.setIcon(icon)
.build();
getMediaPlayer().displayImage(mediaInfo, new MediaPlayer.LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
Log.e("Error", "Error displaying Image", error);
stopMediaSession();
}
@Override
public void onSuccess(MediaLaunchObject object) {
launchSession = object.launchSession;
closeButton.setEnabled(true);
testResponse = new TestResponseObject(true, TestResponseObject.SuccessCode,
TestResponseObject.Display_image);
closeButton.setOnClickListener(closeListener);
stopUpdating();
isPlayingImage = true;
}
});
}
示例6: playVideo
import com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject; //导入依赖的package包/类
private void playVideo() {
boolean shouldLoop = loopingButton.isChecked();
SubtitleInfo.Builder subtitleBuilder = null;
if (subtitlesButton.isChecked()) {
subtitleBuilder = new SubtitleInfo.Builder(
getTv().hasCapability(MediaPlayer.Subtitle_WebVTT) ? URL_SUBTITLES_WEBVTT :
URL_SUBTITLE_SRT);
subtitleBuilder.setLabel("English").setLanguage("en");
}
MediaInfo mediaInfo = new MediaInfo.Builder(URL_VIDEO_MP4, "video/mp4")
.setTitle("Sintel Trailer")
.setDescription("Blender Open Movie Project")
.setIcon(URL_IMAGE_ICON)
.setSubtitleInfo(subtitleBuilder == null ? null : subtitleBuilder.build())
.build();
getMediaPlayer().playMedia(mediaInfo, shouldLoop, new MediaPlayer.LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
Log.e("Error", "Error playing video", error);
stopMediaSession();
}
public void onSuccess(MediaLaunchObject object) {
launchSession = object.launchSession;
testResponse = new TestResponseObject(true, TestResponseObject.SuccessCode,
TestResponseObject.Play_Video);
mMediaControl = object.mediaControl;
mPlaylistControl = object.playlistControl;
stopUpdating();
enableMedia();
isPlaying = true;
}
});
}