IWMPMediaCollection::getByAttribute 메서드

[이 페이지와 연결된 기능인 Windows 미디어 플레이어 SDK는 레거시 기능입니다. MediaPlayer로 대체되었습니다. MediaPlayer는 Windows 10 및 Windows 11 최적화되었습니다. 가능한 경우 새 코드에서 Windows 미디어 플레이어 SDK 대신 MediaPlayer를 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]

getByAttribute 메서드는 지정된 값이 있는 지정된 특성에 해당하는 IWMPPlaylist 인터페이스를 반환합니다.

구문

public IWMPPlaylist getByAttribute(
  System.String bstrAttribute,
  System.String bstrValue
);

Public Function getByAttribute( _
  ByVal bstrAttribute As System.String, _
  ByVal bstrValue As System.String _
) As IWMPPlaylist
Implements IWMPMediaCollection.getByAttribute

매개 변수

bstrAttribute [in]

지정된 특성인 System.String 입니다.

bstrValue [in]

지정된 값인 System.String 입니다.

반환 값

검색된 미디어 항목에 대한 WMPLib.IWMPPlaylist 인터페이스입니다.

설명

이 메서드는 라이브러리의 특성 값과 일치하는 미디어 항목에 대한 일반 쿼리를 만드는 데 사용할 수 있습니다. 이는 사용자 정의 특성의 경우 유용합니다. 특성이 없으면 오류가 발생합니다.

이 메서드를 사용하여 특정 형식의 모든 미디어 항목을 검색할 수 있습니다. 특성 이름 MediaType 및 다음 값 중 하나를 사용합니다.

설명
오디오 음악 및 기타 오디오 전용 항목
other .asf 파일 또는 스트림의 URL과 같은 기타 항목입니다.
사진 사진 항목. Windows 미디어 플레이어 10이 필요합니다.
재생 미디어 항목으로 표시되는 재생 목록입니다.
radio 라디오 방송국 항목. Windows 미디어 플레이어 10에서 사용되지 않습니다.
비디오 비디오 항목.

이 메서드를 호출하기 전에 라이브러리에 대한 읽기 권한이 있어야 합니다. 자세한 내용은 라이브러리 액세스를 참조하세요.

Windows 미디어 플레이어 지원하는 특성에 대한 자세한 내용은 특성 참조를 참조하세요.

IWMPMediaCollection 인터페이스를 검색하는 방법에는 두 가지가 있으며 getByAttribute 메서드의 동작은 사용하는 두 가지 방법에 따라 달라집니다. AxWindowsMediaPlayer.mediaCollection을 호출하여 인터페이스를 검색하는 경우 getByAttribute 메서드는 라이브러리의 모든 미디어 항목을 반환합니다. 그러나 IWMPLibrary.mediaCollection을 호출하여 인터페이스를 검색하는 경우 getByAttribute 메서드는 지정된 특성과 값이 있는 라이브러리의 오디오 항목만 반환합니다.

예제

다음 코드 예제에서는 getByAttribute 를 사용하여 Triode 48이라는 아티스트가 라이브러리의 모든 콘텐츠를 재생합니다. AxWMPLib.AxWindowsMediaPlayer 개체는 player라는 변수로 표시됩니다.

// Get an interface to a playlist that contains media items by a particular artist.
WMPLib.IWMPPlaylist pl = player.mediaCollection.getByAttribute("Artist", "Triode 48");

// Make the new playlist the current one.
player.currentPlaylist = pl;

// Play the media items in the current playlist. 
player.Ctlcontrols.play();

' Get an interface to a playlist that contains media items by a particular artist.
Dim pl As WMPLib.IWMPPlaylist = player.mediaCollection.getByAttribute("Artist", "Triode 48")

' Make the new playlist the current one.
player.currentPlaylist = pl

' Play the media items in the current playlist. 
player.Ctlcontrols.play()

요구 사항

요구 사항
버전
Windows 미디어 플레이어 9 시리즈 이상
네임스페이스
WMPLib
어셈블리
Interop.WMPLib.dll(Interop.WMPLib.dll.dll)

추가 정보

IWMPMediaCollection 인터페이스(VB 및 C#)

IWMPPlaylist 인터페이스(VB 및 C#)

IWMPPlaylistCollection.getAll(VB 및 C#)