本文整理汇总了Java中com.connectsdk.core.MediaInfo类的典型用法代码示例。如果您正苦于以下问题:Java MediaInfo类的具体用法?Java MediaInfo怎么用?Java MediaInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaInfo类属于com.connectsdk.core包,在下文中一共展示了MediaInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: displayImage
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void displayImage(String url, String mimeType, String title,
String description, String iconSrc, LaunchListener listener) {
MediaMetadata mMediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_PHOTO);
mMediaMetadata.putString(MediaMetadata.KEY_TITLE, title);
mMediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, description);
if (iconSrc != null) {
Uri iconUri = Uri.parse(iconSrc);
WebImage image = new WebImage(iconUri, 100, 100);
mMediaMetadata.addImage(image);
}
com.google.android.gms.cast.MediaInfo mediaInformation = new com.google.android.gms.cast.MediaInfo.Builder(url)
.setContentType(mimeType)
.setStreamType(com.google.android.gms.cast.MediaInfo.STREAM_TYPE_NONE)
.setMetadata(mMediaMetadata)
.setStreamDuration(0)
.setCustomData(null)
.build();
playMedia(mediaInformation, applicationID, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:CastService.java
示例2: loadMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
private void loadMedia(com.google.android.gms.cast.MediaInfo mediaInformation,
final WebAppSession webAppSession, final LaunchListener listener) {
try {
mMediaPlayer.load(mApiClient, mediaInformation, true).setResultCallback(new ResultCallback<MediaChannelResult>() {
@Override
public void onResult(MediaChannelResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
webAppSession.launchSession.setSessionType(LaunchSessionType.Media);
mMediaPlayer.setActiveMediaTracks(mApiClient, new long[] { MEDIA_TRACK_ID });
Util.postSuccess(listener, new MediaLaunchObject(webAppSession.launchSession, CastService.this));
}
else {
Util.postError(listener, new ServiceCommandError(status.getStatusCode(), status.getStatusMessage(), status));
}
}
});
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "Unable to load", null));
}
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:CastService.java
示例3: testPlayMediaWithSubtitles
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Test
public void testPlayMediaWithSubtitles() throws CastService.CastClientException {
String mediaUrl = "http://media/";
String mediaType = "video/mp4";
String subtitleUrl = "http://subtitle";
MediaInfo mediaInfo = new MediaInfo.Builder(mediaUrl, mediaType)
.setSubtitleInfo(new SubtitleInfo.Builder(subtitleUrl).build())
.build();
com.google.android.gms.cast.MediaInfo media = verifyPlayMedia(mediaInfo);
MediaTrack track = media.getMediaTracks().get(0);
Assert.assertEquals(mediaUrl, media.getContentId());
Assert.assertEquals(mediaType, media.getContentType());
Assert.assertEquals(subtitleUrl, track.getContentId());
Assert.assertNull(track.getContentType());
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:19,代码来源:CastServiceTest.java
示例4: getMediaInfo
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
public static MediaInfo getMediaInfo(String str, String baseUrl) {
String url = DLNAMediaInfoParser.getURL(str);
String title = DLNAMediaInfoParser.getTitle(str);
String mimeType = DLNAMediaInfoParser.getMimeType(str);
String description = DLNAMediaInfoParser.getArtist(str) + "\n" +
DLNAMediaInfoParser.getAlbum(str);
String iconUrl = DLNAMediaInfoParser.getThumbnail(str);
try {
new URL(iconUrl).openConnection().connect();
} catch (Exception e) {
iconUrl = baseUrl + iconUrl;
}
ArrayList<ImageInfo> list = new ArrayList<ImageInfo>();
list.add(new ImageInfo(iconUrl));
return new MediaInfo(url, mimeType, title, description, list);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:19,代码来源:DLNAMediaInfoParser.java
示例5: getMediaInfo
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void getMediaInfo(final MediaInfoListener listener) {
getPositionInfo(new PositionInfoListener() {
@Override
public void onGetPositionInfoSuccess(final String positionInfoXml) {
Util.runInBackground(new Runnable() {
@Override
public void run() {
String baseUrl = "http://" + getServiceDescription().getIpAddress() + ":" + getServiceDescription().getPort();
String trackMetaData = parseData(positionInfoXml, "TrackMetaData");
MediaInfo info = DLNAMediaInfoParser.getMediaInfo(trackMetaData, baseUrl);
Util.postSuccess(listener, info);
}
});
}
@Override
public void onGetPositionInfoFailed(ServiceCommandError error) {
Util.postError(listener, error);
}
});
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:DLNAService.java
示例6: displayImage
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void displayImage(MediaInfo mediaInfo, LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayImage(mediaUrl, mimeType, title, desc, iconSrc, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:23,代码来源:DLNAService.java
示例7: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop,
LaunchListener listener) {
String mediaUrl = null;
SubtitleInfo subtitle = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
subtitle = mediaInfo.getSubtitleInfo();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayMedia(mediaUrl, subtitle, mimeType, title, desc, iconSrc, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:26,代码来源:DLNAService.java
示例8: displayImage
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void displayImage(MediaInfo mediaInfo, MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayImage(mediaUrl, mimeType, title, desc, iconSrc, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:23,代码来源:WebOSWebAppSession.java
示例9: displayImage
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void displayImage(MediaInfo mediaInfo,
MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayImage(mediaUrl, mimeType, title, desc, iconSrc, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:RokuService.java
示例10: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop,
MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:RokuService.java
示例11: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:23,代码来源:AirPlayService.java
示例12: testPlayMediaWithSubtitles
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Test
public void testPlayMediaWithSubtitles() throws JSONException {
MediaPlayer.LaunchListener listener = Mockito.mock(MediaPlayer.LaunchListener.class);
final boolean shouldLoop = true;
final SubtitleInfo subtitleInfo = new SubtitleInfo.Builder("subtitleurl")
.setLabel("label")
.setLanguage("en")
.setMimeType("subtitletype")
.build();
final MediaInfo mediaInfo = new MediaInfo.Builder("url", "type")
.setIcon("icon")
.setTitle("title")
.setDescription("description")
.setSubtitleInfo(subtitleInfo)
.build();
session.playMedia(mediaInfo, shouldLoop, listener);
verifyPlayMedia(shouldLoop, subtitleInfo, mediaInfo);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:21,代码来源:WebOSWebAppSessionTest.java
示例13: testPlayMediaDeprecatedWithAllParametersOnTheLatestWebOS
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Test
public void testPlayMediaDeprecatedWithAllParametersOnTheLatestWebOS() {
MediaPlayer.LaunchListener listener = Mockito.mock(MediaPlayer.LaunchListener.class);
WebOSWebAppSession webAppSession = Mockito.mock(WebOSWebAppSession.class);
service.mWebAppSessions.put("MediaPlayer", webAppSession);
MediaInfo mediaInfo = new MediaInfo.Builder("url", "mimetype")
.setTitle("title")
.setDescription("description")
.setIcon("icon")
.build();
boolean shouldLoop = true;
service.playMedia(mediaInfo.getUrl(), mediaInfo.getMimeType(), mediaInfo.getTitle(),
mediaInfo.getDescription(), mediaInfo.getImages().get(0).getUrl(), shouldLoop,
listener);
verifyPlayMediaOnTheLatestWebOS(mediaInfo, shouldLoop, listener, webAppSession);
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:19,代码来源:WebOSTVServiceTest.java
示例14: verifyPlayMediaOnTheWebOSV4WithoutDlna
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
private void verifyPlayMediaOnTheWebOSV4WithoutDlna(MediaInfo mediaInfo, boolean shouldLoop) throws JSONException {
Mockito.when(serviceDescription.getVersion()).thenReturn("4.0.0");
MediaPlayer.LaunchListener listener = Mockito.mock(MediaPlayer.LaunchListener.class);
service.playMedia(mediaInfo, shouldLoop, listener);
ArgumentCaptor<ServiceCommand> argCommand = ArgumentCaptor.forClass(ServiceCommand.class);
Mockito.verify(socket).sendCommand(argCommand.capture());
ServiceCommand command = argCommand.getValue();
JSONObject payload = (JSONObject) command.getPayload();
Assert.assertEquals("ssap://media.viewer/open", command.getTarget());
Assert.assertEquals(mediaInfo.getUrl(), payload.getString("target"));
Assert.assertEquals(mediaInfo.getTitle(), payload.getString("title"));
Assert.assertEquals(mediaInfo.getDescription(), payload.getString("description"));
Assert.assertEquals(mediaInfo.getMimeType(), payload.getString("mimeType"));
Assert.assertEquals(shouldLoop, payload.getBoolean("loop"));
Assert.assertEquals(mediaInfo.getImages().get(0).getUrl(), payload.getString("iconSrc"));
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:22,代码来源:WebOSTVServiceTest.java
示例15: verifyPlayMediaOnTheWebOSV4
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
private void verifyPlayMediaOnTheWebOSV4(MediaInfo mediaInfo, boolean shouldLoop) {
Mockito.when(serviceDescription.getVersion()).thenReturn("4.0.0");
MediaPlayer.LaunchListener listener = Mockito.mock(MediaPlayer.LaunchListener.class);
DLNAService dlnaService = injectDLNAService();
MediaPlayer mediaPlayer = Mockito.mock(MediaPlayer.class);
Mockito.when(dlnaService.getAPI(MediaPlayer.class)).thenReturn(mediaPlayer);
service.playMedia(mediaInfo, shouldLoop, listener);
ArgumentCaptor<MediaInfo> argMediaInfo = ArgumentCaptor.forClass(MediaInfo.class);
ArgumentCaptor<Boolean> argShouldLoop = ArgumentCaptor.forClass(Boolean.class);
Mockito.verify(mediaPlayer).playMedia(argMediaInfo.capture(), argShouldLoop.capture(),
Mockito.same(listener));
MediaInfo capturedMediaInfo = argMediaInfo.getValue();
Assert.assertEquals(mediaInfo.getDescription(), capturedMediaInfo.getDescription());
Assert.assertEquals(mediaInfo.getMimeType(), capturedMediaInfo.getMimeType());
Assert.assertEquals(mediaInfo.getTitle(), capturedMediaInfo.getTitle());
Assert.assertEquals(mediaInfo.getUrl(), capturedMediaInfo.getUrl());
Assert.assertEquals(mediaInfo.getImages(), capturedMediaInfo.getImages());
Assert.assertEquals(mediaInfo.getSubtitleInfo(), capturedMediaInfo.getSubtitleInfo());
Assert.assertEquals(shouldLoop, argShouldLoop.getValue().booleanValue());
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:WebOSTVServiceTest.java
示例16: verifyPlayMediaOnTheLatestWebOS
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
private void verifyPlayMediaOnTheLatestWebOS(MediaInfo mediaInfo, boolean shouldLoop, MediaPlayer.LaunchListener listener, WebOSWebAppSession webAppSession) {
// should try to join to the web app
ArgumentCaptor<ResponseListener> argListener = ArgumentCaptor.forClass(ResponseListener
.class);
Mockito.verify(webAppSession).join(argListener.capture());
// run join success
ResponseListener webAppListener = argListener.getValue();
webAppListener.onSuccess(null);
Robolectric.runUiThreadTasksIncludingDelayedTasks();
// should delegate playing media to the WebAppSession
ArgumentCaptor<MediaInfo> argMediaInfo = ArgumentCaptor.forClass(MediaInfo.class);
ArgumentCaptor<Boolean> argShouldLoop = ArgumentCaptor.forClass(Boolean.class);
Mockito.verify(webAppSession).playMedia(argMediaInfo.capture(), argShouldLoop.capture(),
Mockito.same(listener));
MediaInfo capturedMediaInfo = argMediaInfo.getValue();
Assert.assertEquals(mediaInfo.getDescription(), capturedMediaInfo.getDescription());
Assert.assertEquals(mediaInfo.getMimeType(), capturedMediaInfo.getMimeType());
Assert.assertEquals(mediaInfo.getTitle(), capturedMediaInfo.getTitle());
Assert.assertEquals(mediaInfo.getUrl(), capturedMediaInfo.getUrl());
Assert.assertEquals(mediaInfo.getImages(), capturedMediaInfo.getImages());
Assert.assertEquals(mediaInfo.getSubtitleInfo(), capturedMediaInfo.getSubtitleInfo());
Assert.assertEquals(shouldLoop, argShouldLoop.getValue().booleanValue());
}
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:WebOSTVServiceTest.java
示例17: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, LaunchListener listener) {
String mediaUrl = null;
String subsUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
subsUrl = mediaInfo.getSubsUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, subsUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
开发者ID:PTCE,项目名称:popcorn-android,代码行数:25,代码来源:CastService.java
示例18: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop,
LaunchListener listener) {
String mediaUrl = null;
String subsUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
subsUrl = mediaInfo.getSubsUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayMedia(mediaUrl, subsUrl, mimeType, title, desc, iconSrc, listener);
}
开发者ID:PTCE,项目名称:popcorn-android,代码行数:26,代码来源:DLNAService.java
示例19: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(final MediaInfo mediaInfo,
final boolean shouldLoop, final MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
开发者ID:PTCE,项目名称:popcorn-android,代码行数:24,代码来源:WebOSWebAppSession.java
示例20: playMedia
import com.connectsdk.core.MediaInfo; //导入依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:WebOSTVService.java
注:本文中的com.connectsdk.core.MediaInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论