Пример #1
0
LocalMediaStream::LocalMediaStream(const talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>& pStream)
    : FB::JSAPIAuto("MediaStream")
    , m_label(pStream->label())
    , m_videoTracks(FB::variant_list_of())
    , m_audioTracks(FB::variant_list_of())
{
    registerProperty("label", make_property(this, &LocalMediaStream::get_label));
    registerProperty("videoTracks", make_property(this,&LocalMediaStream::get_videoTracks));
    registerProperty("audioTracks", make_property(this, &LocalMediaStream::get_audioTracks));

    for(int i=0; i<pStream->video_tracks()->count(); i++)
    {
        talk_base::scoped_refptr<webrtc::VideoTrackInterface> pTrack(pStream->video_tracks()->at(i));
        talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> pTrack_(
            static_cast<webrtc::LocalVideoTrackInterface*>(pTrack.get())
        );

        AddTrack(LocalVideoTrack::Create(pTrack_));
    }

    for(int i=0; i<pStream->audio_tracks()->count(); i++)
    {
        talk_base::scoped_refptr<webrtc::AudioTrackInterface> pTrack(pStream->audio_tracks()->at(i));
        talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> pTrack_(
            static_cast<webrtc::LocalAudioTrackInterface*>(pTrack.get())
        );

        AddTrack(LocalAudioTrack::Create(pTrack_));
    }
}
Пример #2
0
LocalAudioTrack::LocalAudioTrack(const talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>& pTrack)
    : LocalMediaStreamTrack(pTrack->kind(), pTrack->label(), pTrack->enabled())
{

}
Пример #3
0
RemoteAudioTrack::RemoteAudioTrack(const talk_base::scoped_refptr<webrtc::AudioTrackInterface>& pTrack)
    : MediaStreamTrack(pTrack->kind(), pTrack->label())
{

}
Пример #4
0
LocalVideoTrack::LocalVideoTrack(const talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>& pTrack)
    : LocalMediaStreamTrack(pTrack->kind(), pTrack->label(), pTrack->enabled())
{
    registerProperty("effect", make_property(this, &LocalVideoTrack::get_effect,
                     &LocalVideoTrack::set_effect));
}