AxWindowsMediaPlayer.URL 속성

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

URL 속성은 재생할 미디어 항목의 이름을 가져오거나 설정합니다.

구문

public System.String URL {get; set;}

Public Property URL As System.String

속성 값

미디어 항목의 URL인 System.String입니다.

설명

이 속성은 호출 프로그램 또는 웹 페이지의 보안 영역과 동일하거나 덜 제한적인 보안 영역의 URL로만 설정할 수 있습니다.

방화벽 뒤에서 미디어 항목을 여는 애플리케이션은 IP 주소 대신 DNS(도메인 이름 서버) 이름을 사용하여 주소를 지정하면 성능이 향상됩니다.

이벤트 처리기 코드에서 이 메서드를 호출하지 마세요. 이벤트 처리기에서 URL 을 호출하면 예기치 않은 결과가 발생할 수 있습니다.

예제

다음 예제에서는 사용자가 텍스트 상자에 파일 경로를 입력하여 미디어 파일을 지정할 수 있습니다. 단추를 클릭하면 URL 속성이 지정된 파일로 설정되고 파일이 재생됩니다. AxWMPLib.AxWindowsMediaPlayer 개체는 player라는 변수로 표시됩니다.

private void openMedia_Click(object sender, System.EventArgs e)
{
    // Set the URL property to the file path obtained from the text box. 
    player.URL = inputURL.Text;

    // Play the media file. 
    player.Ctlcontrols.play();
}

Public Sub openMedia_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles openMedia.Click

    ' Set the URL property to the file path obtained from the text box. 
    player.URL = inputURL.Text

    ' Play the media file. 
    player.Ctlcontrols.play()

End Sub

요구 사항

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

추가 정보

AxWindowsMediaPlayer 개체(VB 및 C#)