A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.

Overview

MediaEmbed

CI Minimum PHP Version License Total Downloads Coding Standards

A utility library that generates HTML embed tags for audio or video located on a given URL. It also parses and validates given media URLs.

It currently works with 160+ services, including the most important ones like

  • YouTube
  • Dailymotion
  • MyVideo
  • Vimeo
  • Ustream

etc. With community driven updates this aims to be a complete and up-to-date service wrapper lib.

It uses iframes if possible, and has a fallback on the embed object if necessary.

Demo

https://sandbox.dereuromark.de/sandbox/media-embed

Requirements

Note

Please feel free to join in and help out to further improve or complete it. There are always some providers changing their URLs/API or some new ones which are not yet completed.

Installation

Run

composer require dereuromark/media-embed

This will get the latest tagged version for you.

Documentation

For detailed documentation see /docs.

Credits

Inspired by autoembed.com which already included most of the supported services and laid the foundation of this OOP approach here.

Comments
  • Facebook embed not working

    Facebook embed not working

    Message in the FB player :

    href should represent a valid URL

    function getEmbed( $id, $host ) {  
    
            $MediaEmbed = new MediaEmbed();  
    
            $MediaObject = $MediaEmbed->parseId($id, $host);  
    
            if (!$MediaObject) {  
                return '';  
            }  
            return $MediaObject->getEmbedCode();  
    }
    

    I call the function this way getEmbed($embed->id(), $embed->slug());

    (and I checked, the slug and id are good)

    And this is the embed code I got

    <iframe src="https://www.facebook.com/plugins/video.php?href=$1&show_text=0&amp;wmode=transparent" type="" width="480" height="295" frameborder="0" allowfullscreen class="embed-responsive-item" data-html5-parameter></iframe>

    MediaEmbed->parseUrl is working without a problem with facebook.

    bug 
    opened by 411x 7
  • Attribute and params support for the iframe embed code

    Attribute and params support for the iframe embed code

    Hey, great class here. When I was using your class I realized than the iframe embed code cloud not be customized so I modified the code in order to do so.

    Now you can do something like:

    if ($MediaObject = $this->MediaEmbed->parseUrl('http://www.youtube.com/watch?v=111111')) {
        $MediaObject->setParams(array(
            'autoplay' => 1,
            'loop' => 1
        ));
        $MediaObject->setAttributes(array(
            'type' => null,
            'class' => 'iframe-class',
            'data-html5-parameter' => true
        ));
    
        return $MediaObject->getEmbedCode();
    }
    

    This should return and embed code like:

    <embed src="http:/www.youtube.com/embed/111111?autoplay=1&amp;loop=1" class="iframe-class" data-html5-parameter></iframe>
    

    I updated the main classes, tests, examples and README.md files I hope you found it usefull.

    opened by microstudi 6
  • Composer is not not installing dereuromark/media-embed

    Composer is not not installing dereuromark/media-embed

    When I run the command you suggested "composer require dereuromark/media-embed" it's showing following error.

    _**Your requirements could not be resolved to an installable set of packages.

    Problem 1 - The requested package dereuromark/media-embed No version set (parsed as 1.0.0) is satisfiable by dereuromark/media-embed[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.**_

    How can I resolve this?

    opened by alamgircsejnu 4
  • Add src getter method

    Add src getter method

    Allow developers to retrieve the src.

    $mediaEmbed = new MediaEmbed;
    $object = $mediaEmbed->parseUrl($rl);
    $object->getEmbedSrc(); // https://www.youtube.com/embed/qzBGa0OAbfE
    
    enhancement 
    opened by matthewsuan 3
  • does not grab youtu.be links

    does not grab youtu.be links

    Hi Mark

    Congrats for the wonderful Media Ember Class, had something similar stripped off a wordpress plugin and used it in my code but was getting a bit old. Your seems fairly complete so I grabbed it right away and will be using this one :) my clients mostly use vimeo and youtube but all the other services are welcome in there.

    i have noticed that links such us http://youtu.be/MKlq4gQKtU0 do not work thought. i tried to modify you regular expression for youtube but it was massive so i gave up :) you might need to update it and include the above as well.

    as a workaround just added the below in stubs.php to get it working

        array(
            'name' => 'YouTube Share',
            'website' => 'http://www.youtube.com',
            'url-match' => 'https?://youtu\.be/([0-9a-z-_]{11})',
            'embed-src' => 'https://www.youtube.com/v/$2&rel=0&fs=1&hd=1',
            'embed-width' => '480',
            'embed-height' => '295',
            'image-src' => 'https://img.youtube.com/vi/$2/0.jpg',
            'iframe-player' => 'https://www.youtube.com/embed/$2',
        ),
    
    opened by unitedworx 3
  • Unlisted vimeo urls not recognized correctly.

    Unlisted vimeo urls not recognized correctly.

    Unlisted vimeo videos have an additional "hash" attached to the end of the url. The current implementation of the vimeo url match can't handle this and rather then returning the video ID, it returns the first digits that happen to be at the start of the hash. For example the video URL: http://vimeo.com/245928033/572c32a20d would return 572 as video ID rather then 245928033

    https://stackoverflow.com/a/51425581

    opened by erikfrerejean 2
  • No way to retrieve embed or iframe src

    No way to retrieve embed or iframe src

    The library does not allow you to retrieve the src.

    I was thinking:

    $mediaEmbed = new MediaEmbed;
    $object = $mediaEmbed->parseUrl($rl);
    $object->getEmbedSrc(); // https://www.youtube.com/embed/qzBGa0OAbfE
    
    opened by matthewsuan 2
  • DailyMotion Videos don't work

    DailyMotion Videos don't work

    DailyMotion videos do not work anymore.

    Example Url's:

    https://dai.ly/x6xaldv https://www.dailymotion.com/video/x6x4shm

    How to reproduce: https://sandbox.dereuromark.de/sandbox/media-embed Entering them there gives an error in parsing URL.

    opened by netstyler 2
  • Link check

    Link check

    WIP

    help needed here

    current error list:

    [✖] http://video.adultswim.com → Status: 0
    [✖] http://www.blastro.com → Status: 0
    [✖] http://www.bnqt.com → Status: 0
    [✖] http://www.bofunk.com → Status: 0
    [✖] http://www.collegehumour.com → Status: 0
    [✖] https://www.crunchyroll.com → Status: 403
    [✖] http://www.doubleviking.com → Status: 0
    [✖] http://dv.ouou.com → Status: 0
    [✖] http://www.funmansion.com → Status: 0
    [✖] http://www.gamevideos.1up.com → Status: 0
    [✖] http://www.goear.com → Status: 0
    [✖] http://www.indyarocks.com → Status: 0
    [✖] http://video.mthai.com → Status: 403
    [✖] http://www.motionbox.com → Status: 0
    [✖] http://video.mpora.com → Status: 0
    [✖] http://video.eksenim.mynet.com/ → Status: 0
    [✖] http://myvi.ru → Status: 403
    [✖] http://www.putfile.com → Status: 0
    [✖] http://space.tv.cctv.com → Status: 0
    [✖] http://www.streetfire.net → Status: 0
    [✖] http://www.stupidvideos.com → Status: 0
    [✖] http://www.todaysbigthing.com → Status: 0
    [✖] http://www.trtube.com → Status: 0
    [✖] http://www.twitvid.com/ → Status: 0
    [✖] http://www.u-tube.ru → Status: 0
    [✖] http://videolog.uol.com.br → Status: 0
    [✖] http://www.vidivodo.com → Status: 0
    

    Do we need to remove them? Or do we just need to fix some URLs?

    opened by dereuromark 1
  • facebook require full url in href iframe

    facebook require full url in href iframe

    iframe src for facebook require now the full url :

    https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/CenterforBioDiv/videos/10155664753620460/
    
    opened by Erwane 1
  • Access _stub property OR service name

    Access _stub property OR service name

    Hi, Thanks a lot for this library. What's about access the _stub property with a get() public function on the MediaEmbed object ? We can access some properties like id() but here I need to get the host name service. How to proceed ?

    opened by quaidesbalises 1
  • Add support for Mixcloud

    Add support for Mixcloud

    Mixcloud is a british audio streaming service which is similiar to SoundCloud but specialized on podcasts and DJ stuff and the right to use copyrighted music of other artists.

    https://www.mixcloud.com/

    enhancement 
    opened by derUli 2
  • oEmbed fallback / new major

    oEmbed fallback / new major

    It looks like soundcloud supports oEmbed. I think it makes sense to implement support for generic oEmbed resources instead of implementing a soundcloud specific solution. We could use an oembed php library and try to use oEmbed to get the embed code for all unknown services.

    (from https://github.com/dereuromark/media-embed/issues/43 )

    I think we can start a new 0.x major as develop branch with all the necessary improvements there. What do we want to look out for? I don't know much about this new oEmbed topic yet.

    My main topics for a generic new major would be:

    • [ ] try to have value objects for the providers/services/stubs elements
    • [ ] allow easier custom injection/overwrite per service if needed (inside this provider collection)
    • [ ] more OOP approach then instead of array access and string assoc key arrays.
    • [x] PHP 7.1+ ( https://github.com/dereuromark/media-embed/issues/41 ) with typehinting?

    The specific oEmbed things are maybe something you can outline.

    enhancement 
    opened by dereuromark 2
Releases(0.5.8)
Owner
Mark Sch.
Senior Software Developer
Mark Sch.
This package used to upload files using laravel-media-library before saving model.

Laravel Media Uploader This package used to upload files using laravel-media-library before saving model. In this package all uploaded media will be p

Ahmed Fathy 312 Dec 12, 2022
Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.

Documents ・ Installation ・ Integration ・ Config ・ Customization ・ Events ・ Upgrade ・ Demo ・ FAQ Features File upload and management Uploading validati

UniSharp 1.9k Jan 1, 2023
Analyze content to determine the appropriate Internet media type

Canal Content analysis for the purpose of determining Internet media types. Requirements PHP 5.3+ Installation Through Composer as dflydev/canal. Usag

dflydev 34 Feb 11, 2022
A "Vuejs & Laravel" Media Manager With Tons of Features

Laravel Media Manager Installation Config Features Events Usage Installation composer require ctf0/media-manager publish the package assets with php a

Muah 783 Dec 29, 2022
This project is a demo for Media-Upload package:

??️ Media-Upload-Demo This project is a demo for Media-Upload package: ?? Installation guide As always you need to: composer install Then npm install

Mohamed Hafidi 9 Jan 9, 2023
☁️ Nextcloud server, a safe home for all your data

Nextcloud Server ☁ A safe home for all your data. Why is this so awesome? ?? ?? Access your Data You can store your files, contacts, calendars and mor

Nextcloud 21.1k Dec 31, 2022
PHP library that provides a filesystem abstraction layer − will be a feast for your files!

Gaufrette Gaufrette provides a filesystem abstraction layer. Why use Gaufrette? Imagine you have to manage a lot of medias in a PHP project. Lets see

KNP Labs 2.4k Jan 7, 2023
Upload File Library For PHP ( Simple & Easy User )

Upload File Library For Backend/ServerSide PHP ( Simple & Easy For Use ), Support Multiple Upload

Lamhot Simamora 1 Oct 12, 2021
Gotipath Storage is a file storage library for PHP. It provides one interface to interact with FTP/SFTP.

Gotipath Storage is a file storage library for PHP. It provides one interface to interact with FTP/SFTP. When you use this package, you're protected from vendor lock-in, That mean you can connect to any FTP/SFTP storage. Also it's comes with base URL option to connect Gotipath CDN.

Gotipath 2 Nov 3, 2021
PHPProject is a library written in pure PHP that provides a set of classes to write to different project management file formats

PHPProject PHPProject is a library written in pure PHP that provides a set of classes to write to different project management file formats, i.e. Micr

PHPOffice 192 Dec 17, 2022
The Hoa\Mime library.

Hoa is a modular, extensible and structured set of PHP libraries. Moreover, Hoa aims at being a bridge between industrial and research worlds. Hoa\Mim

Hoa 100 Nov 20, 2022
FileNamingResolver - A lightweight library which helps to resolve a file/directory naming of uploaded files using various naming strategies

FileNamingResolver - A lightweight library which helps to resolve a file/directory naming of uploaded files using various naming strategies

Victor Bocharsky 111 May 19, 2022
A Flysystem proxy adapter that enables compression and encryption of files and streams on the fly

Slam / flysystem-compress-and-encrypt-proxy Compress and Encrypt files and streams before saving them to the final Flysystem destination. Installation

Filippo Tessarotto 27 Jun 4, 2022
Private file storage and share with user build with laravel and vue inspired by google drive

LaravelDrive is a file storage system that allows store private file and share with users build wiht laravel and vue inspired by google drive. Laravel

Shahadat Hossain 70 Dec 22, 2022
Laravel Flysystem was created by, and is maintained by Graham Campbell, and is a Flysystem bridge for Laravel.

Laravel Flysystem Laravel Flysystem was created by, and is maintained by Graham Campbell, and is a Flysystem bridge for Laravel. It utilises my Larave

Graham Campbell 492 Feb 4, 2022
FIle Uploader is a php package to aid fast , easy and safe file upload

FILE UPLOADER FIle Uploader is a php package to aid fast , easy and safe file upload installation composer require codad5/file-helper Features Fast an

Aniezeofor Chibueze Michael 2 Sep 3, 2022
Abstraction for local and remote filesystems

League\Flysystem About Flysystem Flysystem is a file storage library for PHP. It provides one interface to interact with many types of filesystems. Wh

The League of Extraordinary Packages 12.7k Dec 30, 2022