How To Play Video On Google Drive With A Player Object?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
TerryL
Posts: 69
Joined: Sat Nov 23, 2013 8:57 pm

How To Play Video On Google Drive With A Player Object?

Post by TerryL » Sat Feb 24, 2018 9:59 pm

I've been trying to play a video uploaded to Google Drive with a player object. I can't get a valid file path.

Here's the Google Drive shareable link to video "sampleMPG.mpg". It's the default LiveCode sample video. Note the spaces within and at the end of the link.
https://drive.google.com/open?id=1E_Vb9 ... FKgV1FrLkO_

What would be the file path code for an LC player object?
set the fileName of player 1 to "??"
Terry
Beginner Lab (LiveCode tutorial) and StarterKit (my public stacks)
https://tlittle72.neocities.org/info.html#26Anchor

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5084
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How To Play Video On Google Drive With A Player Object?

Post by jacque » Sun Feb 25, 2018 7:00 pm

I don't see spaces, I see underscores (on a mobile device anyway.) The link fails with an error in the browser too. Are you sure you copied the entire link?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

TerryL
Posts: 69
Joined: Sat Nov 23, 2013 8:57 pm

Re: How To Play Video On Google Drive With A Player Object?

Post by TerryL » Mon Feb 26, 2018 8:06 pm

Thanks Jacque for responding. Yes, that's the shareable link, but the LC forum doesn't extend the link underline all the way across to include the last space. That's the code I was assigned. I can't change it. I tried with quotes but no improvement. I didn't add the underscores, that was done by the LC forum too, but it works just fine with the underscores, you just can't click it in the forum. My text-editor extends the link underline correctly and double-clicking opens the default web browser to the the video file.

But my question is how to change that shareable link to a filepath that the LC player object will accept. The address in the browser shows:
"https://drive.google.com/file/d/1E_Vb90 ... rLkO_/view"

An embed option gives:
"https://drive.google.com/file/d/1E_Vb90 ... O_/preview"

Neither work with a player object, neither work with the file name "/sampleMPG.mpg" appended to the link. Terry
Beginner Lab (LiveCode tutorial) and StarterKit (my public stacks)
https://tlittle72.neocities.org/info.html#26Anchor

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5084
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How To Play Video On Google Drive With A Player Object?

Post by jacque » Mon Feb 26, 2018 8:15 pm

I can't get it to work in a player either, I think because it isn't really a link to the actual video but rather to a reference to a file on Drive. It does work in a browser widget though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2088
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How To Play Video On Google Drive With A Player Object?

Post by [-hh] » Tue Feb 27, 2018 7:10 am

The actual link is:
https://doc-14-7o-docs.googleuserconten ... FKgV1FrLkO_

This works. When copying the link above check that the underscore (last char) is not missing.

Assuming you are on Mac:
You can see the actual link after downloading the file in the "where from" - Finder info.
shiftLock happens

TerryL
Posts: 69
Joined: Sat Nov 23, 2013 8:57 pm

Re: How To Play Video On Google Drive With A Player Object?

Post by TerryL » Thu Mar 01, 2018 8:15 pm

Hi Jacque & [-hh]. Thank you for your help. I tried the direct address link but couldn't get it to work. Yes I included the last space. Could Google be creating a temporary file path that expires after a period of time? If you download the video again and with your method check the video's file path is it the same as the previous path you posted? Windows 7 doesn't support your method so I can't check it myself.

After some searching I came across a determined person in Stack Overflow who wrote a java script solution. I know nothing about java script. The Stack Overflow thread is:
https://stackoverflow.com/questions/415 ... g-java-dri

It also mentions Google's file storage method is not hierarchial, probably making the filepath for player object not possible. I think it would be useful to be able to play a video stored on Google Drive with a player object. I see the two workarounds as using a browser widget as Jacque suggested or using launch url and the Google Drive player. Terry

Code: Select all

on mouseUp  --play video file on Google Drive with Google's player
   if url ("https://www.google.com") = empty then  --no internet
      answer "Sorry, no internet connection." with "OK" titled "Error"
      exit to top
   end if
   answer "Launch default web browser to play video stored on Google Drive?" with "Cancel" or "OK" titled "Play Video"
   if it = "Cancel" then exit to top
   put "https://drive.google.com/open?id=1E_Vb900T6Its8cDa4xnycFKgV1FrLkO_" into tPath  --Google Drive shareable link
   replace space with "%20" in tPath  --spaces not allowed in url
   launch url (tPath)  --opens with default browser
end mouseUp
Beginner Lab (LiveCode tutorial) and StarterKit (my public stacks)
https://tlittle72.neocities.org/info.html#26Anchor

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2088
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How To Play Video On Google Drive With A Player Object?

Post by [-hh] » Fri Mar 02, 2018 12:11 am

Yes, the URL changes, probably from security reasons.
Currently it is
https://doc-14-7o-docs.googleuserconten ... FKgV1FrLkO
so you see the changed parts.

Your link above is to java not JavaScript. But there is also a JavaScript API and what you need is "Parents: get" and a call using your API_KEY. For using that JS API (what is not this trivial) you would need a browser widget anyway.
So it's not worth to do that for a player object (may be you have special reasons) because it works always with a browser widget:
For example by simply setting the htmltext of the widget to the embed code.
shiftLock happens

TerryL
Posts: 69
Joined: Sat Nov 23, 2013 8:57 pm

Re: How To Play Video On Google Drive With A Player Object?

Post by TerryL » Sat Mar 03, 2018 8:01 pm

[-hh]: Thank you for further testing. I understand and will focus on the browser widget. This forum is great and the skill set of the users here is amazing. Terry
Beginner Lab (LiveCode tutorial) and StarterKit (my public stacks)
https://tlittle72.neocities.org/info.html#26Anchor

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”