当前位置: 首页>>代码示例>>Java>>正文


Java MediaLaunchObject类代码示例

本文整理汇总了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);
        }
    };
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:38,代码来源:JSCommand.java

示例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;
}
 
开发者ID:ConnectSDK,项目名称:Simple-Photo-Share-Android,代码行数:9,代码来源:MainActivity.java

示例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;
        }
    });
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:37,代码来源:MediaPlayerFragment.java

示例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;
        }
    });
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:35,代码来源:MediaPlayerFragment.java

示例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;
        }
    });
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:36,代码来源:MediaPlayerFragment.java

示例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;
        }
    });
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:39,代码来源:MediaPlayerFragment.java


注:本文中的com.connectsdk.service.capability.MediaPlayer.MediaLaunchObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。