xke
xke

Reputation: 1093

How to correctly use PLAY_VIDEO in Mirror API

I've been playing around with the Google Glass Mirror API and want to be able to stream a video.

This is the Python code snippet I tried:

def _insert_item_video_stream(self):
    """Insert a timeline item with streaming video."""
    logging.info('Inserting timeline item with streaming video')
    body = {
        'notification': {'level': 'DEFAULT'}, 
        'menuItems' : [{'action' : 'PLAY_VIDEO'},
                       {'payload' : 'https://eye-of-the-hawk.appspot.com/static/videos/waterfall.mp4'}],
    }
    self.mirror_service.timeline().insert(body=body).execute()
    return 'A timeline item with streaming video has been inserted.'

However, the video was just blank. Any ideas would be super helpful!

Upvotes: 1

Views: 264

Answers (1)

xke
xke

Reputation: 1093

Was able to fix this after removing two brackets! Oh, Python. :/

This is the fixed line:

   'menuItems' : [{'action' : 'PLAY_VIDEO', 'payload' : 'https://eye-of-the-hawk.appspot.com/static/videos/waterfall.mp4'}],

Upvotes: 1

Related Questions