emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Paul Sexton <psexton@xnet.co.nz>
Cc: emacs-orgmode@gnu.org
Subject: Re: Audio/video file playback in org mode
Date: Thu, 09 Jun 2011 16:22:54 -0600	[thread overview]
Message-ID: <87ipsetzk1.fsf@gmail.com> (raw)
In-Reply-To: <loom.20110609T232702-277@post.gmane.org> (Paul Sexton's message of "Thu, 9 Jun 2011 21:55:17 +0000 (UTC)")

Very cool,

Would you mind posting this to Worg to increase that chances that it
will be found by future Orgers?

The first place that comes to mind is the org-hacks page at
http://orgmode.org/worg/org-hacks.html

Cheers -- Eric

Paul Sexton <psexton@xnet.co.nz> writes:

> I have spent a few hours figuring this out so I thought I would post it for
> the benefit of others.
>
> I am learning a language, and wanted to include hyperlinks to audio files
> within my org document, and be able to play each file by clicking on the
> link. 
>
> I eventually discovered the variable 'org-file-apps' which allows you to
> associate particular applications with particular file types. 
>
> I am using Bongo (https://github.com/dbrock/bongo) as the media player.
> EMMS is another actively developed media player, but setup looked too 
> complicated at first glance.
>
> I am using MPlayer as the actual media player. This supports almost all 
> audio and video file formats. Most importantly, it works on Windows as well
> as on Linux (VLC has a Windows port but it doesn't work with Bongo as the
> 'fake-tty' interface is not implemented on Windows.)
>
> My current setup means that clicking on a link such as [[file:song.mp3]] 
> adds it to the active Bongo playlist (in another buffer) and immediately 
> starts playing it. Playback can be paused, fast-forwarded etc using 
> Bongo.
>
> When Bongo plays a file it puts some icons in the modeline that
> resemble the 'play', 'stop' etc symbols, and can be used to control
> playback using the mouse. I found these worked erratically outside 
> the actual Bongo playlist buffer, so I have instead bound some 
> org-mode keys (ctrl + numpad keys) to the relevant functions.
> This is optional of course.
>
> I have only tested this with mp3 files, but it ought to work with
> video as well.
>
>
> My setup follows:
> -------------------
>
> ;;; Part 1. Bongo setup
>
> (add-to-list 'load-path "/path/to/bongo"))
> (autoload 'bongo "bongo"
>   "Start Bongo by switching to a Bongo buffer." t)
>
> (setq bongo-mplayer-program-name
>       (case system-type
>         ((windows-nt cygwin) "c:\\Program Files\\MPlayer for Windows\\MPlayer.exe")
>         (t "mplayer")))
>
> (setq bongo-enabled-backends '(mplayer))
>
> ;;; Part 2. Org setup
>
> (defvar av-file-regex
>   (concat "\\." (regexp-opt
>                  (append bongo-audio-file-name-extensions
>                          bongo-video-file-name-extensions)) "$"))
>
> (add-to-list 'org-file-apps
>              (cons av-file-regex '(org-play-media-file file)))
>
> (defun org-play-media-file (filename)
>   (with-bongo-buffer
>     (bongo-insert-file filename)
>     (backward-char)
>     (bongo-play)))
>
> ;;; Part 3. Keybindings to allow control of playback within Org buffer
> ;;; (optional)
>
> ;; Numpad Ctrl-0: pause/resume
> (define-key org-mode-map (kbd "<C-kp-0>") 'bongo-pause/resume)
> (define-key org-mode-map (kbd "<C-kp-insert>") 'bongo-pause/resume)
> ;; Numpad Ctrl-.: stop current track, or restart from beginning if stopped
> (define-key org-mode-map (kbd "<C-kp-decimal>") 'bongo-start/stop)
> (define-key org-mode-map (kbd "<C-kp-delete>") 'bongo-start/stop)
> ;; Numpad Ctrl-PgUp, Ctrl-PgDn: raise/lower volume
> (define-key org-mode-map (kbd "<C-kp-prior>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-next>") 'bongo-volume-lower)
> (define-key org-mode-map (kbd "<C-kp-9>") 'bongo-volume-raise)
> (define-key org-mode-map (kbd "<C-kp-3>") 'bongo-volume-lower)
> ;; Numpad Ctrl-left, Ctrl-right: skip back/forward 10 seconds
> (define-key org-mode-map (kbd "<C-kp-left>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-right>") 'bongo-seek-forward-10)
> (define-key org-mode-map (kbd "<C-kp-4>") 'bongo-seek-backward-10)
> (define-key org-mode-map (kbd "<C-kp-6>") 'bongo-seek-forward-10)
>
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-06-09 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 21:55 Audio/video file playback in org mode Paul Sexton
2011-06-09 22:22 ` Eric Schulte [this message]
2011-06-10  8:28 ` Michael Brand
2011-06-10 16:10   ` brian powell
2011-06-11  4:57     ` Paul Sexton
2011-06-11 14:00       ` Memnon Anon
2011-06-11 23:55         ` Alan E. Davis
2011-06-12  8:23           ` Christian Moe
2011-06-12  9:34             ` Michael Brand
2011-06-11  4:53   ` Paul Sexton
     [not found]   ` <4DF2F3B6.2030400@xnet.co.nz>
2011-06-11  6:23     ` Michael Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ipsetzk1.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=psexton@xnet.co.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).