Giter VIP home page Giter VIP logo

Comments (1)

mpratt avatar mpratt commented on June 2, 2024

Hi,

Well it depends on the oembed provider, but most of the times its saddly not possible. Lets look at youtube for example - The full oembed response (using Embera) looks like this:

$embera = new \Embera\Embera();
print_r($embera->getUrlInfo('http://www.youtube.com/watch?v=3T2FpCDlyNg'));

/*Array(
    [http://www.youtube.com/watch?v=3T2FpCDlyNg] => Array(
            [embera_using_fake] => 0
            [author_url] => http://www.youtube.com/user/latenight
            [height] => 270
            [provider_url] => http://www.youtube.com/
            [type] => video
            [width] => 480
            [thumbnail_url] => http://i1.ytimg.com/vi/3T2FpCDlyNg/hqdefault.jpg
            [author_name] => The Tonight Show Starring Jimmy Fallon
            [html] => <iframe width="480" height="270" src="http://www.youtube.com/embed/3T2FpCDlyNg?feature=oembed" frameborder="0" allowfullscreen></iframe>
            [title] => Kevin Bacon's Footloose Entrance
            [thumbnail_width] => 480
            [thumbnail_height] => 360
            [version] => 1.0
            [provider_name] => YouTube
        )
)*/

As you can see, Youtube does not provide the length of the video on their oembed response. I also tried on dailymotion and the response doesnt have a length attribute either...

You would have to come up with another way of finding the length of the video, perhaps using another available API. As an example (for youtube) you can use http://gdata.youtube.com/feeds/api/videos/3T2FpCDlyNg and look at the "duration" attribute.

Since Embera focuses only on Oembed, the only way to get the length of a video using this library is if the oembed provider gives such information, there is no other way around.

from embera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.