如何在桌面和iOS设备上播放具有开始和结束时间的YouTube视频


How to play the youtube videos with start and end times in both desktop and ios devices

我正在尝试在桌面和移动设备上播放具有开始和结束时间的YouTube视频(必须在Safari浏览器iOS中)。我正在像这样获得 youtube 网址表单数据库。

$video_location='http://www.youtube.com/watch?v=2Tvy_Pbe5NA&start=10&end=29';

我正在使用下面的代码来播放视频。

   if (strpos($video_location,'youtube') !== false)
      {
       $parsedurl = parse_url("$video_location");
       $queryvars = explode("&",$parsedurl["query"]);
       $string1 = str_replace("=","/",$queryvars[0]);
       $string2 = $queryvars[1]."&".$queryvars[2];
       $cleanurl = "http://www.youtube.com/".$string1."&".$string2."&".'version=3';
       $videodata = "<embed width='"100%'" height='"400px'" src='"$cleanurl'"
       type='"application/x-shockwave-flash'">
    </embed>";
      }
      else
      { 
       another condition
      }
    above code is working only in desktops with start and end times but in mobile devices start and end times not working properly.thanks!

版本使其成为Flash播放器又名AS3,iOS可以播放的是html5播放器。摆脱版本= 3,看看我在使用YouTube API播放YouTube视频的开始和结束时间上的答案

developers.google.com/youtube/player_parameters#end End 参数仅在 AS3(闪存)播放器中受支持,因此在 iOS 的 HTML5 播放器中不可用。