在Android应用中从受保护的目录中流式传输mp3

时间:2016-02-13 17:06:12

标签: android .htaccess streaming uri android-mediaplayer

我在服务器上的受保护目录中传输mp3文件时遇到问题。为了保护目录,我使用简单的.htaccess

#include <stdlib.h>

#define MAX_RESPONDANTS 20;
#define MIN_RESPONSE_VALUE 0; 
#define MAX_RESPONSE_VALUE 10;
#define TERMINATOR -1;
int main(void)
{
const int RESPONSE_VALUES = MAX_RESPONSE_VALUE - MIN_RESPONSE_VALUE
int value;
int loopCount;

// enter rating 1-10

    printf ("Please enter a value between %d and %d. Use %d to end input: \n    ", MIN_RESPONSE_VALUE, MAX_RESPONSE_VALUE, TERMINATOR);
//printf("Please enter a value between %d and %d. Use %d to end input: ",      "%d", MIN_RESPONSE_VALUE);

int ratingCounters[RESPONSE_VALUES] = { 0 };

// loopCount, responses[MAX_RESPONDANTS]; value;

for (loopCount = 0; loopCount < MAX_RESPONDANTS)
{
    scanf("%d", &value);
    ratingCounters[loopCount] = value;    
}

if (value > MIN_RESPONSE_VALUE && value <= MAX_RESPONSE_VALUE)
{
    printf("response is","%d" ,RESPONSE_VALUES);
}
else if (value = TERMINATOR)    
{
   printf("Outside valid range. Please input another number.\n");
}

printf("\n\nRating Number of Responses\n");
printf("------ --------------------\n");

}

return 0;
}

要播放mp3,我尝试使用这样的:

AuthType Basic
AuthUserFile /home/domains/.htpasswd
require valid-user
AuthName "Protected directory"

当然,当我在浏览器中使用此URL时,一切正常。任何想法如何解决这一问题?

0 个答案:

没有答案