本文整理汇总了C++中DOMMediaStream::GetDOMTrackFor方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMMediaStream::GetDOMTrackFor方法的具体用法?C++ DOMMediaStream::GetDOMTrackFor怎么用?C++ DOMMediaStream::GetDOMTrackFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMMediaStream
的用法示例。
在下文中一共展示了DOMMediaStream::GetDOMTrackFor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
NS_IMETHOD Run()
{
NS_ASSERTION(NS_IsMainThread(), "main thread only");
DOMMediaStream* stream = mListener->GetStream();
if (!stream) {
return NS_OK;
}
nsRefPtr<MediaStreamTrack> track;
if (mEvents & MediaStreamListener::TRACK_EVENT_CREATED) {
track = stream->BindDOMTrack(mID, mType);
if (!track) {
stream->CreateDOMTrack(mID, mType);
track = stream->BindDOMTrack(mID, mType);
}
stream->NotifyMediaStreamTrackCreated(track);
} else {
track = stream->GetDOMTrackFor(mID);
}
if (mEvents & MediaStreamListener::TRACK_EVENT_ENDED) {
if (track) {
track->NotifyEnded();
stream->NotifyMediaStreamTrackEnded(track);
} else {
NS_ERROR("track ended but not found");
}
}
return NS_OK;
}
示例2: Run
NS_IMETHOD Run()
{
NS_ASSERTION(NS_IsMainThread(), "main thread only");
DOMMediaStream* stream = mListener->GetStream();
if (!stream) {
return NS_OK;
}
nsRefPtr<MediaStreamTrack> track;
if (mEvents & MediaStreamListener::TRACK_EVENT_CREATED) {
track = stream->CreateDOMTrack(mID, mType);
} else {
track = stream->GetDOMTrackFor(mID);
}
if (mEvents & MediaStreamListener::TRACK_EVENT_ENDED) {
track->NotifyEnded();
}
return NS_OK;
}