Markup Formatting Reference: Videos (original) (raw)

Display an inline video player for a specified file in the resources of the playground.

Swift Playgrounds can play videos at remote URLs as well as video resources that are included in the Playground package. However, any poster images must be included in the Playground package in order to be displayed. For information on adding videos and other resource files to your playground, see Add resources to a playground in Xcode Help.

Works with:

Syntax

Example: Simple Inline Video Player

Display an inline video player for the file new-fonts.mp4 and provide alternative text.

  1. //: Watch the WWDC session introducing the San Francisco Font
  2. //: ![San Francisco font introduction](new-fonts.mp4)

The following screenshot shows the inline video player defined by the markup in Example: Simple Inline Video Player:

image: ../Art/MFR_video_pg_plain_2x.png

The alternative text displays if the video file cannot be loaded, or if the video file cannot be found. For example, this screenshot changes the name of the video file to nonexistent-file.mp4 in the markup in Example: Simple Inline Video Player:

image: ../Art/MFR_video_pg_alt_2x.png

Example: Poster Frame and Custom Size

Display an inline video player with a custom width and height for the file new-fonts.mp4 using the image font-poster.png as the poster frame.

  1. //: Watch the WWDC session introducing the San Francisco Font
  2. //:
  3. //: *The player is a custom size and has a poster image*
  4. //: ![](new-fonts.mp4 poster="font-poster.png" width="960" height="570")

This screenshot shows the larger inline video player with a custom poster image defined by the markup in Example: Poster Frame and Custom Size:

image: ../Art/MFR_video_pg_options_2x.png

Images

Attention

Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2017-06-05