2017-12-13 32 views
0

저는 Blob on Azure에 MP4 비디오 저장소를 가지고 있으며 GZIP 형식으로 압축했습니다.MediaPlayerElement (UWP)로 GZIPped 비디오를 직접 재생하는 중 오류가 발생했습니다.

비디오가 압축되지 않은 경우, 나는 그것이 바로 UWP 응용 프로그램에서이 코드를 사용하여 읽을 수 있습니다 : 비디오가 압축 된 경우

<MediaPlayerElement x:Name="_mediaPlayerElement" /> 

this._mediaPlayerElement.Source = MediaSource.CreateFromUri(uri); 
this._mediaPlayerElement.MediaPlayer.Play(); 

지금, 내가 가진 다음 오류 "오류 : 지원되지 않는 비디오 유형 또는 잘못된 파일 경로"입니다.

그런 다음 HttpClient을 사용하여 압축을 풀고 스트림을 mediaPlayerElement에 전달합니다. 나는 MediaPlayerElementWithHttpClient (here) 또는 내 사용자 정의 클래스의 구현을 테스트했습니다. 그러나 그것도 작동하지 않습니다. (원본 비디오는 작동하지만 GZIP는 작동하지 않습니다.)

물론 HttpClientAutomationDecompression을 활성화 시켰습니다.

var handler = new HttpClientHandler 
{  
    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate 
}; 

HttpClient client = new HttpClient(handler); 

UWP에서 GZIP 비디오를 스트리밍 할 수 있습니까?

이 웹 사이트 http://v4e.thewikies.com/ (HTML 비디오 코드 생성기)을 사용하여 브라우저 (Firefox, Chrome이 작동하지 않음)에서 직접 GZIP 비디오를 재생할 수 있습니다. 내가 할 수 있다고 가정하지만 UWP에서 어떻게?

는 (아니 직접 관련이 있지만, 내 UWP 응용 프로그램에서 GZIP으로 압축 된 이미지를 표시하는 경우가 일하고있어.)

감사합니다.

답변

0

.mp4.gz 파일을 로컬 폴더에 다운로드 할 수 있습니다. 내 측면에서 테스트하면 .mp4 파일로 올바르게 다운로드 할 수 있습니다. 그런 다음 파일에서 MediaSource을로드하십시오. 예 :

using Windows.Web.Http; 

HttpClient httpclient = new HttpClient(); 
IBuffer buffers = await httpclient.GetBufferAsync(uri); 
StorageFolder localfolder = ApplicationData.Current.LocalFolder; 
StorageFile tempfile = await ApplicationData.Current.LocalFolder.CreateFileAsync("temp.mp4", CreationCollisionOption.ReplaceExisting); 
await FileIO.WriteBufferAsync(tempfile, buffers); 
this._mediaPlayerElement.Source = MediaSource.CreateFromUri(new Uri("ms-appdata:///local/temp.mp4")); 
this._mediaPlayerElement.MediaPlayer.Play(); 
+0

이 방법은 쉽지만 내가하려는 것은 아닙니다. 전체 파일을 캐시에 다운로드하고 싶지 않습니다 (파일이 1GB보다 큰 경우). MediaPlayerElement에 내용을 "스트리밍"하고 싶습니다. 이 비디오가 GZIP 압축되지 않은 경우 (하늘빛에서) 비디오를 MediaPlayerElement로 스트리밍 할 수 있습니다. – pellea