當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。