slitaz-tools rev 979
Add tazbox video
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue May 24 13:59:12 2016 +0200 (2016-05-24) |
parents | 53c750021d6d |
children | 0e4d6400394a |
files | applications/video-player.desktop tazbox/tazbox |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/applications/video-player.desktop Tue May 24 13:59:12 2016 +0200 1.3 @@ -0,0 +1,9 @@ 1.4 +[Desktop Entry] 1.5 +Type=Application 1.6 +Name=Video player 1.7 +Name[fr]=Afficheur video 1.8 +Comment=Versatile HTML5 video player 1.9 +Comment[fr]=Lecteur video HTML5 versatile 1.10 +Exec=tazbox video 1.11 +Icon=video-x-generic 1.12 +Categories=AudioVideo;Video;Player;
2.1 --- a/tazbox/tazbox Mon May 23 23:25:04 2016 +0300 2.2 +++ b/tazbox/tazbox Tue May 24 13:59:12 2016 +0200 2.3 @@ -618,6 +618,49 @@ 2.4 } 2.5 2.6 2.7 +video() { 2.8 + icon='video-x-generic' 2.9 + 2.10 + # Get filename 2.11 + [ "$1" ] && file="$PWD/$(basename "$1")" 2.12 + [ -s "$file" ] || file="$(yad --file --width='500' --height='400' \ 2.13 + --window-icon $icon --title "Video file" --center)" 2.14 + 2.15 + # Extra parameters 2.16 + text= 2.17 + attr='autoplay="true"' 2.18 + for i in png jpg jpeg ; do 2.19 + [ -s ${file%.*}.$i ] && 2.20 + attr="poster=\"file://${file%.*}.$i\"" && break 2.21 + done 2.22 + for i in ${file%.*}_${LANG%.*}.vtt ${file%.*}_${LANG%_*}.vtt \ 2.23 + ${file%.*}.vtt ; do 2.24 + [ -s $i ] && text=" 2.25 +<track kind=\"captions\" label=\"*\" src=\"file://$i\" 2.26 + srclang=\"${LANG%_*}\" default>" 2.27 + done 2.28 + 2.29 + # Build the html5 page 2.30 + tmp=/tmp/video-player-$$.html 2.31 + cat > $tmp <<EOT 2.32 +<html> 2.33 +<head> 2.34 + <title>$(basename "$file")</title> 2.35 +</head> 2.36 +<body> 2.37 +<video controls="controls" $attr> 2.38 + <source src="file://$file" />$text 2.39 + Unsupported video file format 2.40 +</video> 2.41 +</body> 2.42 +</html> 2.43 +EOT 2.44 + 2.45 + tazweb --notoolbar file://$tmp || browser file://$tmp 2.46 + rm -f $tmp 2.47 +} 2.48 + 2.49 + 2.50 newvt() 2.51 { 2.52 ask_root newvt $@ || return 2.53 @@ -821,6 +864,10 @@ 2.54 vnc 2.55 ;; 2.56 2.57 + video) 2.58 + video "$@" 2.59 + ;; 2.60 + 2.61 newvt) 2.62 $@ 2.63 ;;