Currently the youtube URI parsing only keeps the ID of the video. There is an issue for reusing videos #1213184: Allow YouTube videos to be re-used which would prevent an error from being generated on the same video, but the additional parameters like time offset (ie. t=7s) are still lost.

We can add something like the following to MediaInternetYouTubeHandler::parse($embedCode):

        $uri = $matches[1];
        if ($parts = drupal_parse_url($embedCode)) {
          if (isset($parts['query']['t'])) {
            $uri .= '/t/' . $parts['query']['t'];
          }
        }

It's formatted this way to support how MediaReadOnlyStreamWrapper::_parse_url($url) operates when encoding parameters. One of the big issues is that the visible 'filename' shown is no longer the video ID, but rather the last parameter value. Otherwise, it looks to be just a matter of modifying theme_media_youtube_video() to deal with the time offset properly.

Thoughts?

Comments

RobW’s picture

Status: Active » Closed (duplicate)