클라이언트에 mp3 파일을 보낼 수있는 WCF 서비스를 작성하려고합니다. 클라이언트가 안드로이드 앱이고 가능한 한 빨리 재생되기를 원하기 때문에 점진적 다운로드를 사용하여 mp3 파일을 전송해야합니다. WCF를 사용하여 점진적으로 다운로드하려면 어떻게해야합니까? 가능한가?wcf 점진적 다운로드
여기까지 제가 지금까지 가지고 있습니다. 이것은 작동하는 것으로 보이지만 점진적으로 다운로드하지는 않습니다. 안드로이드 앱에서 재생되지만 전체 파일을 다운로드 한 후에 만 재생됩니다.
서비스 계약 :
[OperationContract, WebGet(UriTemplate = "/GetFileStream/?filepath={virtualPath}")]
Stream GetFileStream(string virtualPath);
서비스 구성 : 당신이 점진적 다운로드에 대한 소스에 대한 링크를 제공 할 수있는 경우
<bindings>
<webHttpBinding>
<binding name="streamedHttpBinding" transferMode="StreamedResponse"
maxReceivedMessageSize="1000000000">
</binding>
</webHttpBinding>
</bindings>
<service name="...">
<endpoint address="" behaviorConfiguration="restful" binding="webHttpBinding"
bindingConfiguration="streamedHttpBinding"
contract="..." />
</service>
<behaviors>
<endpointBehaviors>
<behavior name="restful">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
, 그뿐만 아니라 도움이 될 것입니다. 내 인터넷 검색은 프로그레시브 다운로드 + wcf를 위해 많이 나타나지 않았습니다. 당신의 도움을 주셔서 감사합니다.
안드로이드 코드 :
player.reset();
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource(path);
player.prepare();
player.start();
플레이어는 MediaPlayer 개체입니다. 경로의 URL에 데이터 소스를 설정하고 있습니다.
@nithin : Android 앱이 어떻게 mp3 파일에 액세스하려고합니까? 어떤 코드를 사용하고 있습니까? – Squonk
@MisterSquonk 안드로이드 클라이언트가 제대로 작동하고 있다고 생각합니다. 업데이트 된 질문의 코드를 참조하십시오. – Nithin
@nithin : 좋아, 왜 '서비스'가 WCF로 작성되었는지 특별한 이유가 있습니까? 간단한 HTTP 서비스로 원하는 효과를 얻을 수 있습니다. – Squonk