在objective-c中如何一个接一个地播放多个视频url并进行中间缓冲

时间:2015-12-29 12:20:11

标签: ios objective-c media-player mpmovieplayercontroller

在我的项目中,我必须从服务器一个接一个地播放多个视频,并且我已完成以下代码。我的视频播放效果不错但问题是,当一个视频播放完毕后,我正在播放下一个视频 - (void)aMoviePlaybackComplete方法,黑屏出现1或2秒。我不想要那个,也想播放没有缓冲的视频。有没有更好的方法来做到这一点?如果可能,请分享有价值的代码或相关链接。

提前致谢。

$xml = '<?xml version="1.0" encoding=“UTF-8"?>'."\n".'
    <command name="loginXIQS">'."\n".'
        <param type="string">USERNAME</param>'."\n".'
        <param type="string">PASSWORD</param>'."\n".'
    </command>'."\n";

echo "<h2>TCP/IP Connection</h2>\n";

$address = '217.108.104.101';
$service_port = 8000;

/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} 
else {
    echo "OK.\n";
}

echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
    echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
} 
else {
    echo "OK.\n";
}

$in = "HEAD / HTTP/1.1\r\n";
$in .= "Content-Type: text/xmlrn";
//$in.= "Host: www.example.com\r\n";
$in.= "Connection: keep-alive\r\n\r\n";
$in.= "rn";
$in.= $xml;

$out = '';

echo "Sending HTTP HEAD request...";
socket_write($socket, $in, strlen($in));
echo "OK.\n";

echo "Reading response:\n\n";
while ($out = socket_read($socket, 2048)) {
    echo $out;
}

echo "Closing socket...";
socket_close($socket);
echo "OK.\n\n";

0 个答案:

没有答案