Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8008107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:02:16+00:00 2026-06-04T18:02:16+00:00

I am making a video playback website and I need to use a html5

  • 0

I am making a video playback website and I need to use a html5 video player to play local videos and youtube api and vimeo api to play vimeo videos. THE problem is I want to filter the link entered by the user for all 3 conditions. I tried some regex as I never used it before but was not successful. Can anyone help me giving a example showing how to separate those links for making 3 conditions

  1. taking out the word “youtube” out of a youtube link so that i could make a condition statement

  2. same way taking out .mp4 and .ogg extension from the local video so that it can be used to be played in a html5 video player

  3. same way extract the word “vimeo” from a vimeo link so that I can use a vimeo api to play vimeo videos.

Can anyone help?

For example we input a youtube link

http://www.youtube.com/watch?v=example

Then how to get the word “youtube” out of this link?

And I uploaded a local video with file name

example.mp4

Then how can I get the extensoon mp4 from that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:02:17+00:00Added an answer on June 4, 2026 at 6:02 pm

    This is adapated from a php class I wrote some times ago :

    <?php
    
    function identifyService ( $url )
    {
        $url = preg_replace('#\#.*$#', '', trim($url));
    
        $services_regexp = array(
            "#^\w+\.(?P<format>[a-zA-Z0-9]{2,5})#"                     => 'local',
            '#vimeo\.com\/(?P<id>[0-9]*)[\/\?]?#i'                     => 'vimeo',
            '#youtube\.[a-z]{0,5}/.*[\?&]?v(?:\/|=)?(?P<id>[^&]*)#i'   => 'youtube'
        );
    
        foreach ( $services_regexp as $pattern => $service ) {
            if ( preg_match ( $pattern, $url, $matches ) ) {
                return ( $service === 'local' ) ? $matches['format']  : $service;
            }
        }
    
        return false;
    
    }
    
    
    $url = "foo.ogg";
    // $url = "bar.mp4";
    // $url = "http://www.youtube.com/watch?v=_rqR8_mOp_A";
    // $url = "http://vimeo.com/39044814";
    $service  = identifyService( $url );
    var_dump( $service );
    
    
    ?>
    

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a HTML5 video player. I want it so that when the movie
I am making an application in HTML5 that lets you choose a local video
I'm making a video player in AS3 and was wondering how to find out
I am making an app in which I have to play video file. .flv
I'm making a Android app that basically plays video from a website on the
All the current tutorials on making your own youtube video downloader are outdated. The
I am making a videos website where categories will be nested: e.g. Programming-> C
I am basically making a video library where you download videos and I then
I am working on a project that is about making a video player with
Here is the problem, lets say we are making a video game and want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.