PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label video. Show all posts
Showing posts with label video. Show all posts

Thursday, November 3, 2022

[FIXED] How can I download a video from Facebook using GraphAPI?

 November 03, 2022     facebook, facebook-graph-api, video     No comments   

Issue

I want to download a video from facebook to the clients local drive. I saw a few browser plugins and Facebook apps that are able to that and I was wondering how it can be done using the GraphAPI or in any other way.


Solution

First, you get the Graph API object. If the object is public, it's simple, just get https://graph.facebook.com/10151651550011063. (Where the number is the object's ID, equal to the ?v=OBJECTID in the facebook video URL.)

If the object is not public, you need a valid access_token, and the Graph API url becomes something like https://graph.facebook.com/10151651550011063?access_token=DFSDSGSFDGFGDSblabla

Then, in the Graph API object, you'll find the video download link under source.



Answered By - knutole
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, September 29, 2022

[FIXED] How do you display closed caption format of HLS video stream from an m3u8 URL

 September 29, 2022     closed-captions, ffmpeg, tvos, video, video-streaming     No comments   

Issue

I'm working on a Roku and TVOS app that is going to play HLS videos (VOD and live) as well as MP4. According to the Roku docs EIA-608 is supported on both and should also work on TVOS.

My question is, given URL to the m3u8 how can I tell what specific format (EIA-608,WebVTT etc) of closed captioning is being used in each stream?

Contents of the main m3u8 (note 1st stream says no CC, but it really does have it):

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=380000,RESOLUTION=400x228,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_0_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=750000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_1_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1044000,RESOLUTION=1280x720,CODECS="avc1.64001f, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_2_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2127000,RESOLUTION=1280x720,CODECS="avc1.64001f, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_3_av.m3u8

Contents of the 1st stream's m3u8

#EXTM3U
#EXT-X-TARGETDURATION:4
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:4.000,
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/segment1_0_av.ts
...

I can use ffprobe -hide_banner to show the 1st program's stream has closed captioning. Ex:

Duration: 00:02:36.76, start: 0.100511, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 380000
    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 400x228 [SAR 1:1 DAR 100:57], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 380000
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 48 kb/s
    Metadata:
      variant_bitrate : 380000

However, as you can see, Program 0 > Stream 0 just says that is has Closed captions - it does not list the type/spec of closed captioning technology being used.

How do I display the format of the Closed Captions?


Solution

WebVTT is what is know as a 'side car', or 'out of band' format. Meaning captions are in a separate file that you must download. You can see the URL for this file in the m3u8. Here the caption are part of the video stream itself. The only supported format in this case is EIA-608. ffmpeg support for 608 is pretty limited. The best tool I know of to for dealing with 608 is libcaption (full disclosure, I wrote it). I recently added a ts2srt example program. Fair warning its still sorta betaish.



Answered By - szatmary
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I make my video loop in swift with playerViewController?

 September 29, 2022     avplayerviewcontroller, swift, tvos, video, xcode     No comments   

Issue

I am trying to loop a video with playerViewController on Swift for TVOS. I have the video playing fine, but I want to loop the video. Here is my code so far:

override func viewDidAppear(_ animated: Bool) {
    let videoURL = URL(string: "https://url-to-video.com/video.mp4")
    let player = AVPlayer(url: videoURL!)
    let playerViewController = AVPlayerViewController()
    playerViewController.player = player        self.present(playerViewController, animated: true) {
        playerViewController.player!.play()
    }
}

Any help is appreciated. Thanks


Solution

The quickest way to do this is to use an AVQueuePlayer with an AVPlayerLooper. You can set the player on your player view controller the same as you would with an ordinary AVPlayer, but you need to keep a persistent reference around to the looper so it’ll keep working. In other words, add this to your view controller’s interface:

var looper: AVPlayerLooper?

…and in your viewDidAppear, replace this:

let player = AVPlayer(url: videoURL!)

with this:

let player = AVQueuePlayer()
looper = AVPlayerLooper(player: player, templateItem: AVPlayerItem(asset: AVAsset(url: videoURL!)))

Then, once you start the player playing, its video will loop indefinitely.



Answered By - Noah Witherspoon
Answer Checked By - Pedro (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, September 28, 2022

[FIXED] How to loop video with AVPlayerLooper

 September 28, 2022     ios, swift, tvos, video     No comments   

Issue

I try to loop a video in a TV OS app with the AVPlayerLooper because this should get rid of the pause/hicup when playing the video again. I watched the WWDC2016 video https://developer.apple.com/videos/play/wwdc2016/503/ and try to implement the code but it doesn't loop. I have one PlayerViewController which inherits AVPlayerViewController. I put the code to let the video loop. If I have the following code, it shows nothing. If I change the second line to self.queuePlayer = AVQueuePlayer(playerItem:playerItem), it only plays once.

  let playerItem = AVPlayerItem(url: url as URL)
  self.queuePlayer = AVQueuePlayer()   //I declared this as a variable in the view controller
  self.playerLayer = AVPlayerLayer(player: self.queuePlayer) //I declared this as a variable in the view controller
  let playerLooper = AVPlayerLooper(player:  self.queuePlayer!, templateItem: playerItem)
  self.view.layer.addSublayer(self.playerLayer!)
  self.playerLayer?.frame = self.view.frame
  self.queuePlayer?.play()

Have any of you succeeded in playing looped video with the latest AVPlayerLooper?


Solution

I fixed the problem myself.

The playerLooper must be a member variable in the class otherwise it doesn't work because a local variable is gone after the method has been called. So I put this line at the beginning of the class to declare it. I didn't declare it as an AVPlayerLooper because this is only for tvos10.0 and newer versions. I want my class to be adaptive to tvos9.0. This is my working code.

var playerLooper: NSObject?
var playerLayer:AVPlayerLayer!
var queuePlayer: AVQueuePlayer?


func playVideo(_ filmName: String){
    if let path = Bundle.main.path(forResource: filmName, ofType: "mov") {
        let url =  URL(fileURLWithPath: path)

        if #available(tvOS 10.0, *) {

            // Use a new player looper with the queue player and template item
            let playerItem = AVPlayerItem(url: url as URL)
            self.player = AVQueuePlayer(items: [playerItem])
            self.playerLayer = AVPlayerLayer(player: self.player)
            self.playerLooper = AVPlayerLooper(player: self.player! as! AVQueuePlayer, templateItem: playerItem)
            self.view.layer.addSublayer(self.playerLayer!)
            self.playerLayer?.frame = self.view.frame
            self.player?.play()


        } else {
            // Fallback on earlier versions, this solution has hicup at end
            player = AVPlayer(url: url)
            player?.play()
            loopVideo(player!)
        }

    }
}

func loopVideo(_ videoPlayer: AVPlayer) {
    NotificationCenter.default.addObserver(forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil, queue: nil) { notification in
        if(!self.isStopped){

            videoPlayer.seek(to: kCMTimeZero)
            videoPlayer.play()

        }
    }
}


Answered By - flame3
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, July 27, 2022

[FIXED] How to make a square video?

 July 27, 2022     crop, square, swift, video     No comments   

Issue

Trying to make a square video through animationTool. See code below. The video is enlarged (https://i.stack.imgur.com/HscTk.jpg), how can i fix it?

let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality)
        let strFilePath: String = generateMergedVideoFilePath()
        try? FileManager.default.removeItem(atPath: strFilePath)
        exportSession?.outputURL = URL(fileURLWithPath: strFilePath)
        exportSession?.outputFileType = .mp4
        exportSession?.shouldOptimizeForNetworkUse = true
        let mutableVideoComposition = AVMutableVideoComposition(propertiesOf: composition)
        mutableVideoComposition.instructions = instructions
        mutableVideoComposition.frameDuration = CMTimeMake(value: 1, timescale: 30)
        mutableVideoComposition.renderSize = CGSize(width: 1080, height: 1080)

        let parentLayer = CALayer()
        parentLayer.frame = CGRect(x: 0, y: 0, width: 1080, height: 1080)
        let videoLayer = CALayer()
        videoLayer.frame.size = videoSize
        videoLayer.position = parentLayer.position
        videoLayer.contentsGravity = .resizeAspectFill
        parentLayer.addSublayer(videoLayer)


        mutableVideoComposition.animationTool = AVVideoCompositionCoreAnimationTool(postProcessingAsVideoLayer: videoLayer, in: parentLayer)




Solution

mutableVideoComposition.renderSize = CGSize (width: 1080, height: 1080)

With this resolution, it takes the image relative to the top point, so I moved transform up

let coeConst = videoAssetWidth/videoAssetHeight
transform.translatedBy(x: -(videoAssetHeight-videoAssetHeight*coeConst)/2, y: 0)


Answered By - Saveliy Veprev
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, July 26, 2022

[FIXED] How does crop video by touch in android?

 July 26, 2022     android, android-videoview, crop, touch, video     No comments   

Issue

I need to crop(not trim) the video in my app.The crop can be square or rectangular form.


Solution

https://github.com/crust87/Android-VideoCropView

Using this library we can crop video



Answered By - mob_web_dev
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, July 18, 2022

[FIXED] How do I Add A GIF/Video To Landing Screen Background In Xcode 6 using swift?

 July 18, 2022     gif, ios, swift, video, xcode6     No comments   

Issue

what is the most efficient way to add a GIF/Video to the background of the landing screen ( home screen or first view controller) of my app in Xcode? i.e apps like spotify, uber, insagram etc. Being that my app is universal, how would i make it fit accordingly?


Solution

Do you mean the first screen that is displayed after your app is launched? If so: unfortunately you can't have dynamic content; you won't be able to use a gif/video.

That said, what you can do if you have some app-setup on background threads that will take some time anyway, or if you simply want the user to wait longer before interaction so that you can display the gif/video, you can make the static image match the first frame of the gif/video, and have your your entry point be a ViewController that displays the actual gif/video. Because this would delay the time to interaction, though, this would never be recommended.

As for making it fit: as of iOS 8 Apple recommends using LaunchScreen.xib. With it you can use Auto Layout to achieve universality.

To add a video you can use MPMoviePlayerController, AVPlayer, or if you're using SPritekit you can use an SKVideoNode.

EDIT (in response to follow-up comments):

An NSURL is a reference to a local or remote file. This link will give you a decent overview. Just copy the movie in and follow that guide.

In addition to the MPMoviePlayerController solution Saqib Omer suggested, here's an alternative method that uses a UIView with an AVPlayerLayer. It has a button on top of the video as an example, since that's what you're looking for.

import AVKit
import AVFoundation
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Start with a generic UIView and add it to the ViewController view
        let myPlayerView = UIView(frame: self.view.bounds)
        myPlayerView.backgroundColor = UIColor.blackColor()
        view.addSubview(myPlayerView)

        // Use a local or remote URL
        let url = NSURL(string: "http://eoimages.gsfc.nasa.gov/images/imagerecords/76000/76740/iss030-e-6082_sdtv.mov") // See the note on NSURL above.

        // Make a player
        let myPlayer = AVPlayer(URL: url)
        myPlayer.play()

        // Make the AVPlayerLayer and add it to myPlayerView's layer
        let avLayer = AVPlayerLayer(player: myPlayer)
        avLayer.frame = myPlayerView.bounds
        myPlayerView.layer.addSublayer(avLayer)

        // Make a button and add it to myPlayerView (you'd need to add an action, of course)
        let myButtonOrigin = CGPoint(x: myPlayerView.bounds.size.width / 3, y: myPlayerView.bounds.size.height / 2)
        let myButtonSize = CGSize(width: myPlayerView.bounds.size.width / 3, height: myPlayerView.bounds.size.height / 10)
        let myButton = UIButton(frame: CGRect(origin: myButtonOrigin, size: myButtonSize))
        myButton.setTitle("Press Me!", forState: .Normal)
        myButton.setTitleColor(UIColor.whiteColor(), forState: .Normal)
        myPlayerView.addSubview(myButton)
    }
}


Answered By - Ian McKay
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, July 17, 2022

[FIXED] How to create a gif from an image sequence without dither with FFMPEG?

 July 17, 2022     ffmpeg, gif, image-processing, video     No comments   

Issue

I'm able to create a gif from the image sequence, but I'm struggling to remove the dither from it.

This is the command I'm using to create the gif:

ffmpeg -f image2 -framerate 24 -y -i image_%d.png -loop -1 "C:\Users\agetr\Documents\_tmp\__giuf.gif"

And I've tried to use the paletteuse=dither=none filter in different ways with no luck.

P.S.: I'm very new to the ffmpeg cli


Solution

You need to use -sws_dither none (after the -i $file argument, and before the output file). I've tried this on current git/master of FFmpeg and it works as expected, but on older builds (e.g. 4.4.1) this doesn't work. I don't know why exactly, so use a recent (5.0 or any version from 2022, if possible) version/build.



Answered By - Ronald S. Bultje
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, May 16, 2022

[FIXED] How to get video duration, dimension and size in PHP?

 May 16, 2022     duration, ffmpeg, php, video     No comments   

Issue

I want to know how to get the duration, dimension and size of uploaded video file in PHP. The file can be in any video format.


Solution

getID3 supports video formats. See: http://getid3.sourceforge.net/

Edit: So, in code format, that'd be like:

include_once('pathto/getid3.php');
$getID3 = new getID3;
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");

Note: You must include the getID3 classes before this will work! See the above link.

Edit: If you have the ability to modify the PHP installation on your server, a PHP extension for this purpose is ffmpeg-php. See: http://ffmpeg-php.sourceforge.net/



Answered By - aendra
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, May 13, 2022

[FIXED] How to Append two videos in Android Programmatically

 May 13, 2022     android, android-mediarecorder, append, mediarecorder, video     No comments   

Issue

I am using this code. I need to merge two videos. It saved all videos in temp folder but not in merged condition. Append and DoAppend are my functions which I want for merging the videos.

public String append(ArrayList<String> trimVideos) {

        for (int i = 0; i < trimVideos.size() - 1; i++) {

      String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
     if (i == 0) {                      
            String OutPutFileName = Constants.STORAGE_VIDEO_TEMP_PATH +                           
            File.separator + "APPEND" + "_" + timeStamp + ".mp4";
            doAppend(trimVideos.get(0), trimVideos.get(i + 1),OutPutFileName);
            Log.e(Constants.TAG, "In First: " + i + " " +   OutPutFileName);

                  } else {

        String OutPutFileName = Constants.STORAGE_VIDEO_TEMP_PATH
    + File.separator + "APPEND" + i + "_" + timeStamp + ".mp4";
                    doAppend(lastAppendOut, trimVideos.get(i + 1), OutPutFileName);
                    Log.e(Constants.TAG, "In Second: " + i + " " + OutPutFileName);
                }
            }
            Log.e(Constants.TAG, "In End: "  + " " + lastAppendOut);
            return lastAppendOut;
        }

This Method Crashed my application on add track.

private String doAppend(String _firstVideo, String _secondVideo,String _newName) {
        try {

            Log.e("test", "Stage1");
            FileInputStream fis1 = new FileInputStream(_firstVideo);
            FileInputStream fis2 = new FileInputStream(_secondVideo);

            Movie[] inMovies = new Movie[] {
                    MovieCreator.build(fis1.getChannel()),MovieCreator.build(fis2.getChannel()) };

            List<Track> videoTracks = new LinkedList<Track>();
            List<Track> audioTracks = new LinkedList<Track>();
    //It returns one item of video and 2 item of video.

            for (Movie m : inMovies) {
                for (Track t : m.getTracks()) {
                    if (t.getHandler().equals("soun")) {
                        audioTracks.add(t);
                    }
                    if (t.getHandler().equals("vide")) {
                        videoTracks.add(t);
                    }
                }
            }
            Log.e("test", "Stage2");
            Movie result = new Movie();


            if (audioTracks.size() > 0) {
                result.addTrack(new AppendTrack(audioTracks.toArray(new Track[audioTracks.size()])));
            }
            if (videoTracks.size() > 0) {

            result.addTrack(new AppendTrack(videoTracks.toArray(new Track[videoTracks.size()])));
            }

            IsoFile out = new DefaultMp4Builder().build(result);
            Log.e("test", "Stage3");
            String filename = _newName;
            lastAppendOut = filename;
            Log.e(Constants.TAG, "In Append: "  + " " + lastAppendOut);

            FileOutputStream fos = new FileOutputStream(filename);
            FileChannel fco = fos.getChannel();

            fco.position(0);
            out.getBox(fco);
            fco.close();
            fos.close();
            fis1.close();
            fis2.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
            Log.e("check", e.getMessage());
        }
        return _newName;
    }

Solution

Code For Merging Multiple Video

Gradle Dependency

implementation 'com.googlecode.mp4parser:isoparser:1.1.9'

Code

private String appendTwoVideos(String firstVideoPath, String secondVideoPath)
{
    try {
        Movie[] inMovies = new Movie[2];

        inMovies[0] = MovieCreator.build(firstVideoPath);
        inMovies[1] = MovieCreator.build(secondVideoPath);

        List<Track> videoTracks = new LinkedList<>();
        List<Track> audioTracks = new LinkedList<>();

        for (Movie m : inMovies) {
            for (Track t : m.getTracks()) {
                if (t.getHandler().equals("soun")) {
                    audioTracks.add(t);
                }
                if (t.getHandler().equals("vide")) {
                    videoTracks.add(t);
                }
            }
        }

        Movie result = new Movie();

        if (audioTracks.size() > 0) {
            result.addTrack(new AppendTrack(audioTracks
                    .toArray(new Track[audioTracks.size()])));
        }
        if (videoTracks.size() > 0) {
            result.addTrack(new AppendTrack(videoTracks
                    .toArray(new Track[videoTracks.size()])));
        }

        BasicContainer out = (BasicContainer) new DefaultMp4Builder().build(result);

        @SuppressWarnings("resource")
        FileChannel fc = new RandomAccessFile(Environment.getExternalStorageDirectory() + "/wishbyvideo.mp4", "rw").getChannel();
        out.writeContainer(fc);
        fc.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    String mFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
    mFileName += "/wishbyvideo.mp4";
    return mFileName;
}

You might wanna call this function from a background thread.



Answered By - Aly
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, May 5, 2022

[FIXED] Why is my photo overlapped by my video's player when hovered?

 May 05, 2022     css, html, image, overlap, video     No comments   

Issue

Basically when hovered, my image is *2 scaled and it overlaps my video as I expect it to, the problem is that it only overlaps my video, not the player with the timer and the play button of my video. I've tried to add a z-index: 2 in .voyage-image:hover but it seems like it has no effect. So, what i'd like is when hovered, the image overlaps the video AND the player... Thanks for your help :)

Also, I'm a MacOS user and using Brave!

.fiche-voyage {
  width: 100vw;
}
.voyage-image-row {
    width: 50%;
    display: flex;
    margin: 0 auto;
    justify-content: space-around;
  }
.voyage-media-container {
    width: 50%;
    padding: 15px;
    text-align: center;
    display: flex;
    align-items: center;
  }
.voyage-image,
  .voyage-video {
    width: 100%;
  }
  .voyage-image:hover {
    transform: scale(2);
    transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
    z-index: 2;
  }
    <div class="fiche-voyage">
        <div class=" voyage-image-row">
            <div class="voyage-media-container">
                <div class="voyage-media-align">
                    <img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
                    <p>caption</p>
                </div>
            </div>
            <div class="voyage-media-container">
                <div class="voyage-media-align">
                    <video controls="controls" class="voyage-video">
                        <source src="video1.mp4">
                    </video>
                    <p>caption</p>
                </div>
            </div>
        </div>
    </div>
    


Solution

Try this one!

.fiche-voyage {
    width: 100vw;
}
.voyage-image-row {
    width: 50%;
    display: flex;
    margin: 0 auto;
    justify-content: space-around;
}
.voyage-media-container {
    width: 50%;
    padding: 15px;
    text-align: center;
    display: flex;
    align-items: center;
}
.voyage-image,
.voyage-video {
    width: 100%;
}
.voyage-image:hover {
    transform: scale(2);
    transition: cubic-bezier(0.165, 0.84, 0.44, 1) 0.25s;
    z-index: 2;
}
.top{
    z-index: 1;
}
<div class="fiche-voyage">
    <div class=" voyage-image-row">
        <div class="voyage-media-container top">
            <div class="voyage-media-align">
                <img src="https://i.discogs.com/1pfWOq9PLZlhgHWipY4dcKuFEh-0JQiSrG8Fvo79j60/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTM3/MTI2LTE1MjkwNDM2/MTMtMzQ4NS5wbmc.jpeg" class="voyage-image">
                <p>caption</p>
            </div>
        </div>
        <div class="voyage-media-container">
            <div class="voyage-media-align">
                <video controls="controls" class="voyage-video">
                    <source src="video1.mp4">
                </video>
                <p>caption</p>
            </div>
        </div>
    </div>
</div>

In here I have add another class to the third div and set its z-index to 1.

Thanks and best regards!



Answered By - Vishal Kalansooriya
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I place a embedded video on-top of an image in HTML/CSS?

 May 05, 2022     css, html, image, video     No comments   

Issue

So I'm trying to create a simple layering technique, by putting an image behind a video in html/css. To give the video section some meaning and background style.

Heres a photoshop mockup of what I'm trying to achieve.

http://s8.postimg.org/tl749vxvp/example.jpg

HTML

 div id= "background">
 img src="images/imgc.jpg" class="stretch" alt="image"
 *Video embedding goes here*   

CSS

.stretch {
    width : 100%;
    height: auto;%;
}

#background {
    position: relative ;
}

#wrapper {
   background-size: 100% auto;
}

Solution

You need to center the video player div over the image(or preferably, a div with a background image). Here's some html:

<html>
    <head>
        <!-- Flowplayer js and css -->
    </head>
    <body>
        <div style="width:100%; height:100%; background-image:url('path/to/your/image.png');">
            <div id="player" style="width:600px; height:400px; position:absolute; left:50%; margin-left:-300px; top:50%; margin-top:-200px"></div>
        </div>
    </body>
</html>

Note: that this css:

width:600px;
height:400px;
position:absolute;
left:50%;
margin-left:-300px;
top:50%;
margin-top:-200px

makes a div of 600px x 400px and centers it within the parent div. If you need to change the height to 800px for example, change margin-top to 1/2 of the amount, in this case -400px

I should mention that there are various css options for the background image of the main div, read about them here: http://www.w3schools.com/cssref/css3_pr_background.asp. You may want to look at background-size:contain

After you have the div centered over the image as desired, just follow the instructions here (http://flash.flowplayer.org/documentation/installation/index.html) to get your video playing with flowplayer.



Answered By - Tom G
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, April 15, 2022

[FIXED] How do I hide related videos at the end of a YouTube playlist embed code?

 April 15, 2022     embed, iframe, playlist, video, youtube     No comments   

Issue

I am using this code to embed a playlist:

<iframe width="816" height="459"     
  src="https://www.youtube.com/embed/videoseries?list=xxx" 
  frameborder="0" allowfullscreen="">

To hide the related videos, normally I add ?rel=0 (that's in the case of a single video embed), but if I try it here:

<iframe width="816" height="459" src="https://www.youtube.com/embed/videoseries?list=PL4Zkb_7gMrOzZlVy7jIeCjwScavYp6ssm?rel=0" 
 frameborder="0" allowfullscreen="">
 </iframe>

I get the "bad video" fuzzy YouTube screen (sorry, I don't know the technical term for this)!

There is no "hide related" option in the YouTube "SHOW MORE" settings for the playlist.


Solution

You have to use the '&' when adding more parameters to the url. Update the src field with following.

"https://www.youtube.com/embed/videoseries?list=PL4Zkb_7gMrOzZlVy7jIeCjwScavYp6ssm&rel=0"


Answered By - Saumini Navaratnam
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, March 13, 2022

[FIXED] Facebook Graph API: How can I retrieve the number of views of a video I shared from another profile using the Facebook Graph API?

 March 13, 2022     analytics, facebook, facebook-graph-api, facebook-php-sdk, video     No comments   

Issue

I have a business manager account for my Facebook profile and I re-shared a video from another profile. How can I retrieve the number of views that my re-share accounted for through the Facebook Graph API?

If the video were posted directly to my profile rather than re-shared, I'd be able to use the /v2.8/{video-id}/video_insights method to retrieve the video stats, but that does not appear to be available for re-shares. The only insights that I can find for re-shares appears to be /v2.8/{post-id}/insights, but that does not include video views.

For example, here is a Facebook post by The Dodo where they are re-sharing a video by Discovery News.


Solution

This information can be retrieved by making a call to /v2.8/{post-id}/insights/post_video_views



Answered By - Evan Appleby
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, March 1, 2022

[FIXED] Decent Video Chat API?

 March 01, 2022     api, lamp, video, video-streaming     No comments   

Issue

Just wondering. I'm looking to build a small web application with a single page. It will essentially be a video chat page so I'm looking for an API I can use or any other solutions?

This would be run on a LAMP stack.


Solution

A SO search reveals lots of similar questions which are worth checking/contributing to.

It depends if you want something free or are prepared to pay but some things that come up are (mind I havent used any of these myself):

  • http://www.tokbox.com/
  • http://code.google.com/apis/talk/open_communications.html#developer
  • http://www.process-one.net/en/blogs/article/oneteam_media_server_by_processone
  • https://sites.google.com/site/webrtc/ (Now at: https://webrtc.org/ )
  • https://www.skype.com/en/developer/
  • http://farsight.freedesktop.org/wiki/
  • https://www.twilio.com/docs/api/video
  • Some MS libraries are mentioned here: Developing a Video Chat Application with high quality video streaming
  • Apple had promised to open up FaceTime but so far nothing has happened

To get up and running quickly it seems tokbox would be most suitable.



Answered By - dgorissen
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing