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


Java VideoTrack类代码示例

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


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

示例1: gotRemoteStream

import org.webrtc.VideoTrack; //导入依赖的package包/类
private void gotRemoteStream(MediaStream stream) {
    //we have remote video stream. add to the renderer.
    final VideoTrack videoTrack = stream.videoTracks.getFirst();
    AudioTrack audioTrack = stream.audioTracks.getFirst();
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                remoteRenderer = new VideoRenderer(remoteVideoView);
                remoteVideoView.setVisibility(View.VISIBLE);
                videoTrack.addRenderer(remoteRenderer);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

}
 
开发者ID:vivek1794,项目名称:webrtc-android-codelab,代码行数:19,代码来源:MainActivity.java

示例2: setVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
/**
 * Sets the {@code VideoTrack} to be rendered by this {@code WebRTCView}.
 *
 * @param videoTrack The {@code VideoTrack} to be rendered by this
 * {@code WebRTCView} or {@code null}.
 */
private void setVideoTrack(VideoTrack videoTrack) {
    VideoTrack oldValue = this.videoTrack;

    if (oldValue != videoTrack) {
        if (oldValue != null) {
            removeRendererFromVideoTrack();
        }

        this.videoTrack = videoTrack;

        if (videoTrack != null) {
            tryAddRendererToVideoTrack();
        }
    }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:22,代码来源:WebRTCView.java

示例3: createCapturerVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createCapturerVideoTrack(VideoCapturerAndroid capturer) {
    videoSource = factory.createVideoSource(capturer, videoConstraints);
    localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
    localVideoTrack.setEnabled(renderVideo);
    localVideoTrack.addRenderer(new VideoRenderer(localRender));
    return localVideoTrack;
}
 
开发者ID:nubomedia-vtt,项目名称:webrtcpeer-android,代码行数:8,代码来源:MediaResourceManager.java

示例4: addLocalStreams

import org.webrtc.VideoTrack; //导入依赖的package包/类
private void addLocalStreams(Context context) {
    AudioManager audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
    // TODO(fischman): figure out how to do this Right(tm) and remove the suppression.
    @SuppressWarnings("deprecation")
    boolean isWiredHeadsetOn = audioManager.isWiredHeadsetOn();
    audioManager.setMode(isWiredHeadsetOn ? AudioManager.MODE_IN_CALL : AudioManager.MODE_IN_COMMUNICATION);
    audioManager.setSpeakerphoneOn(!isWiredHeadsetOn);

    localStream = peerConnectionFactory.createLocalMediaStream("ARDAMS");

    if (!audioOnly) {
        VideoCapturer capturer = getVideoCapturer();
        MediaConstraints videoConstraints = new MediaConstraints();
        videoSource = peerConnectionFactory.createVideoSource(capturer, videoConstraints);
        VideoTrack videoTrack = peerConnectionFactory.createVideoTrack("ARDAMSv0", videoSource);
        videoTrack.addRenderer(new VideoRenderer(localRender));
        localStream.addTrack(videoTrack);
    }

    localStream.addTrack(peerConnectionFactory.createAudioTrack("ARDAMSa0", peerConnectionFactory.createAudioSource(new MediaConstraints())));

    peerConnection.addStream(localStream);
}
 
开发者ID:respoke,项目名称:respoke-sdk-android,代码行数:24,代码来源:RespokeCall.java

示例5: setVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
/**
 * Sets the {@code VideoTrack} to be rendered by this {@code WebRTCView}.
 *
 * @param videoTrack The {@code VideoTrack} to be rendered by this
 *                   {@code WebRTCView} or {@code null}.
 */
private void setVideoTrack(VideoTrack videoTrack) {
    VideoTrack oldValue = this.videoTrack;

    if (oldValue != videoTrack) {
        if (oldValue != null) {
            removeRendererFromVideoTrack();
        }

        this.videoTrack = videoTrack;

        if (videoTrack != null) {
            tryAddRendererToVideoTrack();
        }
    }
}
 
开发者ID:matrix-org,项目名称:matrix-android-sdk,代码行数:22,代码来源:MXWebRtcView.java

示例6: setStream

import org.webrtc.VideoTrack; //导入依赖的package包/类
/**
 * Sets the {@code MediaStream} to be rendered by this {@code WebRTCView}.
 * The implementation renders the first {@link VideoTrack}, if any, of the
 * specified {@code mediaStream}.
 *
 * @param mediaStream The {@code MediaStream} to be rendered by this
 * {@code WebRTCView} or {@code null}.
 */
public void setStream(MediaStream mediaStream) {
    VideoTrack videoTrack;

    if (mediaStream == null) {
        videoTrack = null;
    } else {
        List<VideoTrack> videoTracks = mediaStream.videoTracks;

        videoTrack = videoTracks.isEmpty() ? null : videoTracks.get(0);
    }

    setVideoTrack(videoTrack);
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:22,代码来源:WebRTCView.java

示例7: onAddStream

import org.webrtc.VideoTrack; //导入依赖的package包/类
@Override
public void onAddStream(MediaStream stream) {
  Log.w(TAG, "onAddStream:" + stream);

  for (AudioTrack audioTrack : stream.audioTracks) {
    audioTrack.setEnabled(true);
  }

  if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
    VideoTrack videoTrack = stream.videoTracks.getFirst();
    videoTrack.setEnabled(true);
    videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
  }

}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:WebRtcCallService.java

示例8: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
    videoSource = factory.createVideoSource(capturer);
    capturer.startCapture(videoWidth, videoHeight, videoFps);

    localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
    if (localRender != null) {
        localVideoTrack.setEnabled(renderVideo);
        localVideoTrack.addRenderer(new VideoRenderer(localRender));
    }

    return localVideoTrack;
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:13,代码来源:PeerConnectionClient.java

示例9: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer videoCapturer) {
    mVideoSource = mPeerConnectionFactory.createVideoSource(videoCapturer);
    videoCapturer.startCapture(videoWidth, videoHeight, videoHeight);

    mLocalVideoTrack = mPeerConnectionFactory.createVideoTrack(VIDEO_TRACK_ID, mVideoSource);
    mLocalVideoTrack.setEnabled(true);
    mLocalVideoTrack.addRenderer(new VideoRenderer(localProxyRenderer));
    return mLocalVideoTrack;
}
 
开发者ID:crazytaxii,项目名称:Achilles_Android,代码行数:10,代码来源:MainActivity.java

示例10: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
  videoSource = factory.createVideoSource(capturer);
  capturer.startCapture(videoWidth, videoHeight, videoFps);

  localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
  localVideoTrack.setEnabled(renderVideo);
  localVideoTrack.addSink(localRender);
  return localVideoTrack;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:10,代码来源:PeerConnectionClient.java

示例11: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
    videoSource = factory.createVideoSource(capturer);
    capturer.startCapture(videoWidth, videoHeight, videoFps);

    localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
    localVideoTrack.setEnabled(renderVideo);
    localVideoTrack.addRenderer(new VideoRenderer(localRender));
    return localVideoTrack;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:10,代码来源:PeerConnectionClient.java

示例12: onAddStream

import org.webrtc.VideoTrack; //导入依赖的package包/类
@Override
public void onAddStream(MediaStream stream) {
  Log.w(TAG, "onAddStream:" + stream);

  for (AudioTrack audioTrack : stream.audioTracks) {
    audioTrack.setEnabled(true);
  }

  if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
    VideoTrack videoTrack = stream.videoTracks.getFirst();
    videoTrack.setEnabled(true);
    videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:15,代码来源:WebRtcCallService.java

示例13: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturerAndroid capturer) {
	videoSource = factory.createVideoSource(capturer, videoConstraints);

	localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
	localVideoTrack.setEnabled(renderVideo);
	localVideoTrack.addRenderer(new VideoRenderer(localRender));
	return localVideoTrack;
}
 
开发者ID:ardnezar,项目名称:webrtc-android,代码行数:9,代码来源:PeerConnectionClient.java

示例14: createVideoTrack

import org.webrtc.VideoTrack; //导入依赖的package包/类
/**
 * Creates a instance of VideoTrack to used in a VideoCapturerAndroid.
 * @param capturer Instance of VideoCapturerAndroid
 * @return VideoTrack
 */
private VideoTrack createVideoTrack(final VideoCapturerAndroid capturer) {
    mVideoRender = mOption.getRender();
    mVideoSource = mFactory.createVideoSource(capturer, mVideoConstraints);
    mVideoTrack = mFactory.createVideoTrack(VIDEO_TRACK_ID, mVideoSource);
    mVideoTrack.setEnabled(mEnableVideo);
    mVideoTrack.addRenderer(new VideoRenderer(mVideoRender));
    return mVideoTrack;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:14,代码来源:MediaStream.java

示例15: run

import org.webrtc.VideoTrack; //导入依赖的package包/类
public void run() {
    Log.d(TAG, "Attaching VideoRenderer to remote stream (" + remoteStream + ")");

    // Check if the remote stream has a video track
    if (remoteStream.videoTracks.size() == 1) {
        // Get the video track
        VideoTrack remoteVideoTrack = remoteStream.videoTracks.get(0);
        // Set video track enabled if we have enabled video rendering
        remoteVideoTrack.setEnabled(renderVideo);

        VideoRenderer videoRenderer = remoteVideoRenderers.get(remoteRender);
        if (videoRenderer != null) {
            MediaStream mediaStream = remoteVideoMediaStreams.get(videoRenderer);
            if (mediaStream != null) {
                VideoTrack videoTrack = remoteVideoTracks.get(mediaStream);
                if (videoTrack != null) {
                    videoTrack.removeRenderer(videoRenderer);
                }
            }
        }

        VideoRenderer newVideoRenderer = new VideoRenderer(remoteRender);
        remoteVideoTrack.addRenderer(newVideoRenderer);
        remoteVideoRenderers.put(remoteRender, newVideoRenderer);
        remoteVideoMediaStreams.put(newVideoRenderer, remoteStream);
        remoteVideoTracks.put(remoteStream, remoteVideoTrack);
        Log.d(TAG, "Attached.");
    }
}
 
开发者ID:nubomedia-vtt,项目名称:webrtcpeer-android,代码行数:30,代码来源:MediaResourceManager.java


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