web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Control HTML5 Video - ...
Power Automate
Answered

Control HTML5 Video - Unable to get js to execute

(0) ShareShare
ReportReport
Posted on by 9

I'm new to PAD, I'm trying to control an html5 video using javascript. The end goal is to save a screenshot of the video at each second. Every other part of the flow is working, but I just can't get the javascript to execute.

 

I'm starting by opening a new browser (I've tried both Edge & Chrome). Here's an example of the videos I'm using: https://cdn.jwplayer.com/videos/CX8bzdPa.mp4

 

I'm waiting for the video element to load, then running the following javascript:

 

 

function ExecuteScript() {
	$('video').removeAttribute("controls");
	$('video').pause();
	
	return $('video').duration;
}

 

 

 

This should remove the visible controls, pause the video and then return the duration. I'll then be looping through the number of seconds, scrubbing to the correct part of the video (also using js), and taking a screenshot.

 

All of the javascript works fine when run in the console directly, but when I try running in PAD, it just has no effect and the result comes out as undefined. I've been able to get alert("Hello World") working, but not much else.

 

What am I missing?

I have the same question (0)
  • Verified answer
    tfrewin Profile Picture
    9 on at

    I'm being an idiot, it looks like the use of jquery is the problem. Works fine with vanilla js

     

    function ExecuteScript() {	
    	var vid = document.getElementsByTagName("video")[0];
    	
    	vid.removeAttribute("controls");
    	vid.pause();
    	
    	return vid.duration;
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 450

#2
Haque Profile Picture

Haque 366

#3
Valantis Profile Picture

Valantis 349

Last 30 days Overall leaderboard