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


Java MediaRoute类代码示例

本文整理汇总了Java中org.chromium.chrome.browser.media.router.MediaRoute的典型用法代码示例。如果您正苦于以下问题:Java MediaRoute类的具体用法?Java MediaRoute怎么用?Java MediaRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MediaRoute类属于org.chromium.chrome.browser.media.router包,在下文中一共展示了MediaRoute类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchSession

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
private void launchSession(CreateRouteRequest request) {
    MediaSink sink = request.getSink();
    MediaSource source = request.getSource();

    MediaRoute route = new MediaRoute(
            sink.getId(), source.getUrn(), request.getPresentationId());
    addRoute(route, request.getOrigin(), request.getTabId());
    mManager.onRouteCreated(route.id, route.sinkId, request.getNativeRequestId(), this, true);

    if (source.getClientId() != null) {
        ClientRecord clientRecord = mClientRecords.get(source.getClientId());
        if (clientRecord != null) {
            sendReceiverAction(clientRecord.routeId, sink, source.getClientId(), "cast");
        }
    }
    request.start(mApplicationContext);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:CastMediaRouteProvider.java

示例2: joinRoute

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
@Override
public void joinRoute(String sourceId, String presentationId, String origin, int tabId,
        int nativeRequestId) {
    MediaSource source = MediaSource.from(sourceId);
    if (source == null || source.getClientId() == null) {
        mManager.onRouteRequestError("Unsupported presentation URL", nativeRequestId);
        return;
    }

    if (mSession == null) {
        mManager.onRouteRequestError("No presentation", nativeRequestId);
        return;
    }

    if (!canJoinExistingSession(presentationId, origin, tabId, source)) {
        mManager.onRouteRequestError("No matching route", nativeRequestId);
        return;
    }

    MediaRoute route = new MediaRoute(mSession.getSinkId(), sourceId, presentationId);
    addRoute(route, origin, tabId);
    mManager.onRouteCreated(route.id, route.sinkId, nativeRequestId, this, false);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:CastMediaRouteProvider.java

示例3: closeRoute

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
@Override
public void closeRoute(String routeId) {
    MediaRoute route = mRoutes.get(routeId);

    if (route == null) return;

    if (mSession == null) {
        mRoutes.remove(routeId);
        return;
    }

    ClientRecord client = getClientRecordByRouteId(routeId);
    if (client != null) {
        MediaSink sink = MediaSink.fromSinkId(mSession.getSinkId(), mAndroidMediaRouter);
        if (sink != null) sendReceiverAction(routeId, sink, client.clientId, "stop");
    }

    mSession.stopApplication();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:CastMediaRouteProvider.java

示例4: addRoute

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
private void addRoute(MediaRoute route, String origin, int tabId) {
    mRoutes.put(route.id, route);

    MediaSource source = MediaSource.from(route.sourceId);
    final String clientId = source.getClientId();

    if (clientId == null || mClientRecords.get(clientId) != null) return;

    mClientRecords.put(clientId,
            new ClientRecord(
                    route.id,
                    clientId,
                    source.getApplicationId(),
                    source.getAutoJoinPolicy(),
                    origin,
                    tabId));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:CastMediaRouteProvider.java

示例5: launchSession

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
private void launchSession(CreateRouteRequest request) {
    MediaSink sink = request.getSink();
    MediaSource source = request.getSource();

    MediaRoute route = new MediaRoute(
            sink.getId(), source.getUrn(), request.getPresentationId());
    addRoute(route, request.getOrigin(), request.getTabId());
    mManager.onRouteCreated(route.id, route.sinkId, request.getNativeRequestId(), this, true);

    if (source.getClientId() != null) {
        ClientRecord clientRecord = mClientRecords.get(source.getClientId());
        if (clientRecord != null) {
            sendReceiverAction(clientRecord.routeId, sink, source.getClientId(), "cast");
        }
    }
    request.start();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:CastMediaRouteProvider.java

示例6: closeRoute

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
@Override
public void closeRoute(String routeId) {
    MediaRoute route = mRoutes.get(routeId);
    if (route == null) return;

    if (mSession == null) {
        mRoutes.remove(routeId);
        mManager.onRouteClosed(routeId);
        return;
    }

    ClientRecord client = getClientRecordByRouteId(routeId);
    if (client != null && mAndroidMediaRouter != null) {
        MediaSink sink = MediaSink.fromSinkId(mSession.getSinkId(), mAndroidMediaRouter);
        if (sink != null) sendReceiverAction(routeId, sink, client.clientId, "stop");
    }

    mSession.stopApplication();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:CastMediaRouteProvider.java

示例7: addRoute

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
@VisibleForTesting
void addRoute(MediaRoute route, String origin, int tabId) {
    mRoutes.put(route.id, route);

    MediaSource source = MediaSource.from(route.sourceId);
    final String clientId = source.getClientId();

    if (clientId == null || mClientRecords.get(clientId) != null) return;

    mClientRecords.put(clientId,
            new ClientRecord(
                    route.id,
                    clientId,
                    source.getApplicationId(),
                    source.getAutoJoinPolicy(),
                    origin,
                    tabId));
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:CastMediaRouteProvider.java

示例8: canJoinExistingSession

import org.chromium.chrome.browser.media.router.MediaRoute; //导入依赖的package包/类
private boolean canJoinExistingSession(String presentationId, String origin, int tabId,
        MediaSource source) {
    if (AUTO_JOIN_PRESENTATION_ID.equals(presentationId)) {
        return canAutoJoin(source, origin, tabId);
    } else if (presentationId.startsWith(PRESENTATION_ID_SESSION_ID_PREFIX)) {
        String sessionId = presentationId.substring(PRESENTATION_ID_SESSION_ID_PREFIX.length());

        if (mSession.getSessionId().equals(sessionId)) return true;
    } else {
        for (MediaRoute route : mRoutes.values()) {
            if (route.presentationId.equals(presentationId)) return true;
        }
    }
    return false;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:CastMediaRouteProvider.java


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